Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ private void generateXsd(Map<String, Object> parameters) throws IOException, Mod

// we assume parameters not null
String xsdFileName = (String) parameters.get(ModelloParameterConstants.OUTPUT_XSD_FILE_NAME);
// enforceMandatoryElements parameter is kept for backward compatibility but is no longer used.
// Required fields are now always enforced based on field.isRequired() value.
boolean enforceMandatoryElements =
Boolean.parseBoolean((String) parameters.get(ModelloParameterConstants.XSD_ENFORCE_MANDATORY_ELEMENTS));

Expand Down Expand Up @@ -232,9 +234,7 @@ private void writeComplexTypeDescriptor(
}
w.startElement("xs:element");

if (!enforceMandatoryElements || !field.isRequired()) {
// Usually, would only do this if the field is not "required", but due to inheritance, it may be
// present, even if not here, so we need to let it slide
if (!field.isRequired()) {
w.addAttribute("minOccurs", "0");
}
}
Expand Down
1 change: 0 additions & 1 deletion src/main/mdo/modello.mdo
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,6 @@
<field xml.insertParentFieldsUpTo="versionRange">
<name>type</name>
<version>1.0.0+</version>
<required>true</required>
<type>String</type>
<description><![CDATA[
Simple type for this field (or array of such type). Can be one of : <code>boolean</code>, <code>byte</code>,
Expand Down