From 6f56a7e82f72e600ec05e3526ccb09d3b52072a8 Mon Sep 17 00:00:00 2001 From: Filip Michalski Date: Fri, 5 May 2023 14:30:37 +0200 Subject: [PATCH] Fix additionalProperty when true/false --- .../openapi/src/test/resources/swagger/swagger-20.json | 5 +++-- .../touk/nussknacker/engine/json/swagger/SwaggerTyped.scala | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/openapi/src/test/resources/swagger/swagger-20.json b/components/openapi/src/test/resources/swagger/swagger-20.json index 9679551a45a..50b933c9001 100644 --- a/components/openapi/src/test/resources/swagger/swagger-20.json +++ b/components/openapi/src/test/resources/swagger/swagger-20.json @@ -78,8 +78,9 @@ "type": "integer", "format": "int32" } - } - } + }, + "additionalProperties": false + } }, "400": { "description": "Problem with request" diff --git a/utils/json-utils/src/main/scala/pl/touk/nussknacker/engine/json/swagger/SwaggerTyped.scala b/utils/json-utils/src/main/scala/pl/touk/nussknacker/engine/json/swagger/SwaggerTyped.scala index 8a1d67928f6..60a4d175ac5 100644 --- a/utils/json-utils/src/main/scala/pl/touk/nussknacker/engine/json/swagger/SwaggerTyped.scala +++ b/utils/json-utils/src/main/scala/pl/touk/nussknacker/engine/json/swagger/SwaggerTyped.scala @@ -232,6 +232,8 @@ object SwaggerObject { case null => AdditionalPropertiesEnabled(SwaggerAny) case schema: Schema[_] if schema.getBooleanSchemaValue == false => AdditionalPropertiesDisabled case schema: Schema[_] => AdditionalPropertiesEnabled(SwaggerTyped(schema, swaggerRefSchemas, usedRefs)) + case additionalPropertyEnabled if additionalPropertyEnabled == true => AdditionalPropertiesEnabled(SwaggerAny) + case additionalPropertyEnabled if additionalPropertyEnabled == false => AdditionalPropertiesDisabled } SwaggerObject(properties, additionalProperties, patternProperties) }