Found while reviewing the wsdl2openapi interceptor for OpenAPI specification correctness.
XsdToSchema.applyMaxOccurs(...) wraps a repeating element in an ArraySchema but never sets minItems or maxItems:
if (UNBOUNDED.equals(maxOccurs) || isMoreThanOne(maxOccurs)) {
return new ArraySchema().items(fieldSchema);
}
So maxOccurs="3" and maxOccurs="unbounded" produce identical schemas, and minOccurs="2" only marks the property required without stating that at least two items are expected. Both are constraints with exact JSON Schema equivalents, and the converter otherwise makes a point of carrying XSD constraints over (facets, fixed, required).
Suggested fix
In the same method: maxItems from a numeric maxOccurs, minItems from minOccurs where it is greater than 1. Note both describe the list, unlike nillable and default, which the code correctly applies to each occurrence before the wrapping.
Location
core/src/main/java/com/predic8/membrane/core/interceptor/wsdl2openapi/XsdToSchema.java — applyMaxOccurs, addField
Found while reviewing the
wsdl2openapiinterceptor for OpenAPI specification correctness.XsdToSchema.applyMaxOccurs(...)wraps a repeating element in anArraySchemabut never setsminItemsormaxItems:So
maxOccurs="3"andmaxOccurs="unbounded"produce identical schemas, andminOccurs="2"only marks the propertyrequiredwithout stating that at least two items are expected. Both are constraints with exact JSON Schema equivalents, and the converter otherwise makes a point of carrying XSD constraints over (facets,fixed,required).Suggested fix
In the same method:
maxItemsfrom a numericmaxOccurs,minItemsfromminOccurswhere it is greater than 1. Note both describe the list, unlikenillableanddefault, which the code correctly applies to each occurrence before the wrapping.Location
core/src/main/java/com/predic8/membrane/core/interceptor/wsdl2openapi/XsdToSchema.java—applyMaxOccurs,addField