Open
Description
Expected Behavior
When fields are set as required on a schema and then set back as optional so that "required" field is empty, "required" should no be serialized in json or yaml, cause empty array is invalid for some openapi versions (cf: https://community.smartbear.com/discussions/swaggerostools/empty-array-in-required-field-in-schema-object/193184)
Actual Behavior
Required field is serialized as an empty array.
Steps to Reproduce the Problem
- Create a new openapi spec
- Create a new data type
- Create an required property on the data type
- Set previous property as not required
Specifications
- apicurio studio: 0.2.62.Final
- apicurio data models: 1.1.28
Cause
In apicurio-data-models, the ChangePropertyTypeCommand
which is called when required field is changed on a property will create a new array to store required properties and will keep an empty array when all required properties are removed.
Proposed solution
Call parent.setRequiredProperties(null);
to replace empty array by null so that "required" is not serialized when empty.
Metadata
Metadata
Assignees
Labels
No labels
Activity