Open
Description
API Platform version(s) affected: main
Description
When PropertySchemaCollectionRestriction
fails to identify nested constraint restrictions the generated OpenAPI schema might be invalid.
How to reproduce
Given this validation rule:
<property name="someArray">
<constraint name="Collection">
<option name="fields">
<value key="someField">
<constraint name="Optional">
<constraint name="SomeConstraintWithoutMatchingRestriction"/>
</constraint>
</value>
</option>
</constraint>
</property>
The generated schema will look like this:
"Schema": {
"type": "object",
"properties": {
"someArray": {
"type": "object",
"properties": {
"someField": [],
},
"additionalProperties": false,
"items": {
"type": "string"
}
}
}
}
The issue here is that someField
is an empty array but should be an empty object.