Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313568 - JAXB Externalized Metadata: minoccurs for xml-path elements not being set and are hence required
Summary: JAXB Externalized Metadata: minoccurs for xml-path elements not being set and...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 308677
  Show dependency tree
 
Reported: 2010-05-19 12:24 EDT by David McCann CLA
Modified: 2022-06-09 10:28 EDT (History)
1 user (show)

See Also:


Attachments
proposed fix and updates tests (33.74 KB, patch)
2010-05-20 15:42 EDT, Matt MacIvor CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David McCann CLA 2010-05-19 12:24:24 EDT
When we generate schema components based on a given xml-path we are not setting the minOccurs value on the path elements.  This results in the default value of "1" being used.  

We should be setting minOccurs on each path element up to the last one, and perhaps on the last element unless it has 'required' set to true/false.
Comment 1 David McCann CLA 2010-05-19 12:26:55 EDT
This blocks bug# 308677 (JAXB Externalized Metadata JUnit: mappings tests should validate instance docs against generated schema) because in the read-only case, to be valid against the schema the instance document must have empty elements up to and including the last element of the path.  For example:

<employee><read-only><stuff/></read-only></employee>

BUT, when we marshal we will only write out:

<employee/>

Which is not valid against the schema.
Comment 2 David McCann CLA 2010-05-19 12:32:25 EDT
Test method testSchemaGenAndValidation in externalizedmetadata.mappings.anyattribute.AnyAttributeMappingTestCases contains commented out code that can verify the fix.
Comment 3 David McCann CLA 2010-05-20 13:01:06 EDT
Test method testSchemaGenAndValidation in
externalizedmetadata.mappings.anyattribute.AnyCollectionMappingTestCases and externalizedmetadata.mappings.anyattribute.AnyObjectMappingTestCases contains commented out code that can verify the fix.
Comment 4 David McCann CLA 2010-05-20 15:25:02 EDT
Test method testSchemaGenAndValidation in
externalizedmetadata.mappings.binarydatacollection.BinaryDataCollectionMappingTestCases has a commented out section that can be enabled when this bug is fixed.
Comment 5 Matt MacIvor CLA 2010-05-20 15:42:26 EDT
Created attachment 169404 [details]
proposed fix and updates tests
Comment 6 Matt MacIvor CLA 2010-05-21 09:07:02 EDT
Attached patch checked into SVN
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:28:50 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink