From db7cf978a50865124a4229b9dfdb5dde3073008a Mon Sep 17 00:00:00 2001 From: frantuma Date: Tue, 5 Jul 2022 16:52:05 +0200 Subject: [PATCH] update unevaluatedProperties type to Schema --- .../serialization/OpenAPI3_1SerializationTest.java | 14 ++++++++++---- .../io/swagger/v3/oas/models/media/Schema.java | 10 ++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/OpenAPI3_1SerializationTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/OpenAPI3_1SerializationTest.java index 93e5d82edc..e64abd56e0 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/OpenAPI3_1SerializationTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/OpenAPI3_1SerializationTest.java @@ -545,7 +545,8 @@ public void testComponentPathItemsSerialization() { " body:\n" + " content:\n" + " application/json:\n" + - " schema: {}\n" + + " schema: \n" + + " type: object\n" + " headers:\n" + " test-head:\n" + " description: test header description\n" + @@ -605,7 +606,9 @@ public void testComponentPathItemsSerialization() { " \"body\" : {\n" + " \"content\" : {\n" + " \"application/json\" : {\n" + - " \"schema\" : { }\n" + + " \"schema\" : {\n" + + " \"type\" : \"object\"\n" + + " }\n" + " }\n" + " }\n" + " }\n" + @@ -1110,7 +1113,8 @@ public void testRequestBodyRefSerialization() { " body:\n" + " content:\n" + " application/json:\n" + - " schema: {}"); + " schema: \n" + + " type: object"); SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + " \"openapi\" : \"3.1.0\",\n" + " \"paths\" : {\n" + @@ -1130,7 +1134,9 @@ public void testRequestBodyRefSerialization() { " \"body\" : {\n" + " \"content\" : {\n" + " \"application/json\" : {\n" + - " \"schema\" : { }\n" + + " \"schema\" : {\n" + + " \"type\" : \"object\"\n" + + " }\n" + " }\n" + " }\n" + " }\n" + diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Schema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Schema.java index 74f1b88fb9..242c7cda3e 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Schema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Schema.java @@ -177,7 +177,7 @@ public Schema specVersion(SpecVersion specVersion) { * @since 2.2.0 (OpenAPI 3.1.0) */ @OpenAPI31 - private Object unevaluatedProperties; + private Schema unevaluatedProperties; /** * @since 2.2.0 (OpenAPI 3.1.0) @@ -586,6 +586,7 @@ public Schema() { protected Schema(String type, String format) { this.type = type; + this.addType(type); this.format = format; } @@ -595,6 +596,7 @@ public Schema(SpecVersion specVersion) { protected Schema(String type, String format, SpecVersion specVersion) { this.type = type; + this.addType(type); this.format = format; this.specVersion = specVersion; } @@ -1560,7 +1562,7 @@ public Schema propertyNames(Schema propertyNames) { * @since 2.2.0 (OpenAPI 3.1.0) */ @OpenAPI31 - public Object getUnevaluatedProperties() { + public Schema getUnevaluatedProperties() { return unevaluatedProperties; } @@ -1569,7 +1571,7 @@ public Object getUnevaluatedProperties() { * @since 2.2.0 (OpenAPI 3.1.0) */ @OpenAPI31 - public void setUnevaluatedProperties(Object unevaluatedProperties) { + public void setUnevaluatedProperties(Schema unevaluatedProperties) { this.unevaluatedProperties = unevaluatedProperties; } @@ -1578,7 +1580,7 @@ public void setUnevaluatedProperties(Object unevaluatedProperties) { * @since 2.2.0 (OpenAPI 3.1.0) */ @OpenAPI31 - public Schema unevaluatedProperties(Object unevaluatedProperties) { + public Schema unevaluatedProperties(Schema unevaluatedProperties) { this.unevaluatedProperties = unevaluatedProperties; return this; }