OpenAPI 3.1.0 support: additionalProperties: false
adds additionalProp1
to samples
#9022
Labels
additionalProperties: false
adds additionalProp1
to samples
#9022
Q&A
89f04d3
(latest master)Content & configuration
Example OpenAPI definition
Minimal example that demonstrates the issue for
"additionalProperties": false
with OpenAPI 3.1.0Describe the bug you're encountering
When the value of
openapi
in the OpenAPI definition is3.0.3
, the sample body for aPOST /
request is correctly rendered asHowever, when the value of
openapi
is3.1.0
, the sample body for aPOST /
request is incorrectly rendered asTo reproduce...
Steps to reproduce the behavior:
dev-helpers/examples/openapi.json
dev-helpers/dev-helper-initializer.js
by replacinghttps://petstore.swagger.io/v2/swagger.json
with./examples/openapi.json
additionalProp1
field is present, violating"additionalProperties": false
in OpenAPI definitionModifying the value of
openapi
to3.0.3
(or any existing 3.0.x version) indev-helpers/examples/openapi.json
will display a correct sample.Expected behavior
The sample request body for OpenAPI 3.1.0+ should not generate additional properties when
"additionalProperties": false
is present, instead maintaining consistency with OpenAPI 3.0.x samples.Screenshots
Correct sample with OpenAPI 3.0.3:
Incorrect sample with OpenAPI 3.1.0:
Additional context or thoughts
Introduced in the implementation of #8577 in the PR #8910 in
src/core/plugins/json-schema-2020-12/samples-extensions/fn/main.js
with change from
if (additionalProperties === true) {
toif (isBooleanJSONSchema(additionalProperties)) {
.The text was updated successfully, but these errors were encountered: