Community
Participate
Working Groups
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.
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.
Test method testSchemaGenAndValidation in externalizedmetadata.mappings.anyattribute.AnyAttributeMappingTestCases contains commented out code that can verify the fix.
Test method testSchemaGenAndValidation in externalizedmetadata.mappings.anyattribute.AnyCollectionMappingTestCases and externalizedmetadata.mappings.anyattribute.AnyObjectMappingTestCases contains commented out code that can verify the fix.
Test method testSchemaGenAndValidation in externalizedmetadata.mappings.binarydatacollection.BinaryDataCollectionMappingTestCases has a commented out section that can be enabled when this bug is fixed.
Created attachment 169404 [details] proposed fix and updates tests
Attached patch checked into SVN
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink