From 5bbd156b32e208c0e398dc100beb117afa6912dc Mon Sep 17 00:00:00 2001 From: nyo <1153009+lc-nyovchev@users.noreply.github.com> Date: Wed, 21 May 2025 19:17:08 +0200 Subject: [PATCH 01/11] Bump swagger-api to 2.2.32 and fix tests (wip) --- pom.xml | 2 +- ...stDelegatingMethodParameterCustomizer.java | 10 +++++ .../core/fn/builders/schema/Builder.java | 10 +++++ .../test/resources/results/3.1.0/app111.json | 39 ++++++++++--------- .../api/v30/app111/SpringDocApp111Test.java | 6 +-- 5 files changed, 44 insertions(+), 23 deletions(-) diff --git a/pom.xml b/pom.xml index fa3dcc130..3c67f2ea2 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ 0.7.0 1.5.0 - 2.2.30 + 2.2.32 5.21.0 1.13.1 0.9.1 diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DataRestDelegatingMethodParameterCustomizer.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DataRestDelegatingMethodParameterCustomizer.java index 3a96dcb9d..d966a22a8 100644 --- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DataRestDelegatingMethodParameterCustomizer.java +++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/DataRestDelegatingMethodParameterCustomizer.java @@ -449,6 +449,11 @@ public Class contains() { return parameterSchema.$dynamicAnchor(); } + @Override + public String $dynamicRef() { + return parameterSchema.$dynamicRef(); + } + @Override public String contentEncoding() { return parameterSchema.contentEncoding(); @@ -836,6 +841,11 @@ public Class contains() { return schema.$dynamicAnchor(); } + @Override + public String $dynamicRef() { + return schema.$dynamicRef(); + } + @Override public String contentEncoding() { return schema.contentEncoding(); diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/schema/Builder.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/schema/Builder.java index d3bafada6..c9d5a4d43 100644 --- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/schema/Builder.java +++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/fn/builders/schema/Builder.java @@ -299,6 +299,11 @@ public class Builder { */ private String $dynamicAnchor = ""; + /** + * The Dynamic ref + */ + private String $dynamicRef = ""; + /** * The Content encoding. */ @@ -1149,6 +1154,11 @@ public Class contains() { return $dynamicAnchor; } + @Override + public String $dynamicRef() { + return $dynamicRef; + } + @Override public String contentEncoding() { return contentEncoding; diff --git a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app111.json b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app111.json index 1ea58db5d..3075070d7 100644 --- a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app111.json +++ b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app111.json @@ -29,9 +29,9 @@ "in": "query", "required": true, "schema": { + "type": "string", "maxLength": 10, - "minLength": 0, - "type": "string" + "minLength": 0 } } ], @@ -94,9 +94,9 @@ "in": "query", "required": true, "schema": { + "type": "string", "maxLength": 10, - "minLength": 0, - "type": "string" + "minLength": 0 } } ], @@ -151,9 +151,6 @@ "components": { "schemas": { "Person": { - "required": [ - "lastName" - ], "type": "object", "properties": { "id": { @@ -161,33 +158,37 @@ "format": "int64" }, "firstName": { + "type": "string", "maxLength": 2147483647, - "minLength": 2, - "type": "string" + "minLength": 2 }, "lastName": { + "type": "string", "maxLength": 10, - "minLength": 0, - "type": "string" + "minLength": 0 }, "email": { - "pattern": ".+@.+\\..+", - "type": "string" + "type": "string", + "pattern": ".+@.+\\..+" }, "email1": { - "type": "string" + "type": "string", + "format": "email" }, "age": { - "maximum": 30, - "minimum": 18, "type": "integer", - "format": "int32" + "format": "int32", + "maximum": 30, + "minimum": 18 }, "creditCardNumber": { "type": "string" } - } + }, + "required": [ + "lastName" + ] } } } -} +} \ No newline at end of file diff --git a/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/java/test/org/springdoc/api/v30/app111/SpringDocApp111Test.java b/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/java/test/org/springdoc/api/v30/app111/SpringDocApp111Test.java index d15a8d576..4f76b4c30 100644 --- a/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/java/test/org/springdoc/api/v30/app111/SpringDocApp111Test.java +++ b/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/java/test/org/springdoc/api/v30/app111/SpringDocApp111Test.java @@ -53,17 +53,17 @@ static class SpringDocTestApp { /** * Custom open api open api. * - * @param appDesciption the app desciption + * @param appDescription the app description * @param appVersion the app version * @return the open api */ @Bean - public OpenAPI customOpenAPI(@Value("${application-description}") String appDesciption, @Value("${application-version}") String appVersion) { + public OpenAPI customOpenAPI(@Value("${application-description}") String appDescription, @Value("${application-version}") String appVersion) { return new OpenAPI() .info(new Info() .title("sample application API") .version(appVersion) - .description(appDesciption) + .description(appDescription) .termsOfService("http://swagger.io/terms/") .license(new License().name("Apache 2.0").url("http://springdoc.org"))); } From db53310b56d07ddcc5e6225b490582041f479c8c Mon Sep 17 00:00:00 2001 From: nyo <1153009+lc-nyovchev@users.noreply.github.com> Date: Thu, 22 May 2025 19:47:37 +0200 Subject: [PATCH 02/11] Fixed second test --- .../src/test/resources/results/3.1.0/app112.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app112.json b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app112.json index 7ac383dcc..d964c6530 100644 --- a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app112.json +++ b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app112.json @@ -257,7 +257,8 @@ "type": "string" }, "email1": { - "type": "string" + "type": "string", + "format": "email" }, "age": { "maximum": 30, From 761b142f87b4fc474f1e6b26e59296aa73abc4eb Mon Sep 17 00:00:00 2001 From: nyo <1153009+lc-nyovchev@users.noreply.github.com> Date: Thu, 22 May 2025 19:50:11 +0200 Subject: [PATCH 03/11] Fixed third test --- .../src/test/resources/results/3.0.1/app111.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app111.json b/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app111.json index 853585c74..2809dcb57 100644 --- a/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app111.json +++ b/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app111.json @@ -202,7 +202,8 @@ }, "email1": { "type": "string", - "description": "The Email 1." + "description": "The Email 1.", + "format": "email" }, "age": { "maximum": 30, From bad48c9ba7d6adc8fbcf3d8b200cafb3aa407957 Mon Sep 17 00:00:00 2001 From: nyo <1153009+lc-nyovchev@users.noreply.github.com> Date: Thu, 22 May 2025 19:53:05 +0200 Subject: [PATCH 04/11] Fixed fourth test --- .../src/test/resources/results/3.1.0/app110.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app110.json b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app110.json index afb60ad05..092229524 100644 --- a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app110.json +++ b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app110.json @@ -257,7 +257,8 @@ "type": "string" }, "email1": { - "type": "string" + "type": "string", + "format": "email" }, "age": { "maximum": 30, From e1ed9cc8d180565f578a1b94ab95c7768c087b47 Mon Sep 17 00:00:00 2001 From: nyo <1153009+lc-nyovchev@users.noreply.github.com> Date: Thu, 22 May 2025 19:54:49 +0200 Subject: [PATCH 05/11] Fixed fifth --- .../src/test/resources/results/3.0.1/app112.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app112.json b/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app112.json index 06e588d36..86ad04a5a 100644 --- a/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app112.json +++ b/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app112.json @@ -289,7 +289,8 @@ }, "email1": { "type": "string", - "description": "The Email 1." + "description": "The Email 1.", + "format": "email" }, "age": { "maximum": 30, From e4eba05dcef4625dd515d55e23857475459eea66 Mon Sep 17 00:00:00 2001 From: nyo <1153009+lc-nyovchev@users.noreply.github.com> Date: Thu, 22 May 2025 19:56:16 +0200 Subject: [PATCH 06/11] Sixth --- .../src/test/resources/results/3.0.1/app110.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app110.json b/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app110.json index 18cacc1db..45fbdf662 100644 --- a/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app110.json +++ b/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.0.1/app110.json @@ -289,7 +289,8 @@ }, "email1": { "type": "string", - "description": "The Email 1." + "description": "The Email 1.", + "format": "email" }, "age": { "maximum": 30, From 5aa2c7a8cf6351b2a6d102d26f02dd72c5d8cfe8 Mon Sep 17 00:00:00 2001 From: nyo <1153009+lc-nyovchev@users.noreply.github.com> Date: Thu, 22 May 2025 19:58:35 +0200 Subject: [PATCH 07/11] Extra two --- .../src/test/resources/results/3.0.1/app111.json | 3 ++- .../src/test/resources/results/3.0.1/app112.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app111.json b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app111.json index 7143898e4..d3cbb307c 100644 --- a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app111.json +++ b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app111.json @@ -175,7 +175,8 @@ "type": "string" }, "email1": { - "type": "string" + "type": "string", + "format": "email" }, "age": { "maximum": 30, diff --git a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app112.json b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app112.json index 5fa3b7691..28c883169 100644 --- a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app112.json +++ b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app112.json @@ -257,7 +257,8 @@ "type": "string" }, "email1": { - "type": "string" + "type": "string", + "format": "email" }, "age": { "maximum": 30, From 70a7d10160df0a7cce9e100b3623c2e6fc277803 Mon Sep 17 00:00:00 2001 From: nyo <1153009+lc-nyovchev@users.noreply.github.com> Date: Thu, 22 May 2025 20:07:44 +0200 Subject: [PATCH 08/11] Weird fix with ref --- .../resources/results/3.1.0/app193-1.json | 91 +++---------------- 1 file changed, 11 insertions(+), 80 deletions(-) diff --git a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app193-1.json b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app193-1.json index 2623b3c12..9cf3cce09 100644 --- a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app193-1.json +++ b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app193-1.json @@ -25,11 +25,12 @@ "content": { "*/*": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/Books" + "type": "object", + "properties": { + "test.org.springdoc.api.v31.app193.Knowledge": { + "$ref": "#/components/schemas/Knowledge" } - ] + } } } } @@ -51,14 +52,12 @@ "content": { "*/*": { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/Cat" - }, - { - "$ref": "#/components/schemas/Dog" + "type": "object", + "properties": { + "Animal": { + "$ref": "#/components/schemas/Animal" } - ] + } } } } @@ -69,80 +68,12 @@ }, "components": { "schemas": { - "Book": { - "type": "object", - "description": "Represents a Book.", - "properties": { - "title": { - "type": "string" - } - } - }, - "Books": { - "allOf": [ - { - "$ref": "#/components/schemas/Knowledge" - }, - { - "type": "object", - "properties": { - "empty": { - "type": "boolean" - }, - "first": { - "$ref": "#/components/schemas/Book" - }, - "last": { - "$ref": "#/components/schemas/Book" - } - } - } - ], - "description": "Represents a list of Books." - }, "Knowledge": { "description": "Represents the knowledge." }, "Animal": { "description": "Represents an Animal class." - }, - "Cat": { - "allOf": [ - { - "$ref": "#/components/schemas/Animal" - }, - { - "type": "object", - "properties": { - "speed": { - "type": "integer", - "format": "int32" - } - } - } - ], - "description": "Represents a Cat class." - }, - "Dog": { - "allOf": [ - { - "$ref": "#/components/schemas/Animal" - }, - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "age": { - "type": "integer", - "format": "int32" - } - } - } - ], - "description": "Represents a Dog class." } } } -} +} \ No newline at end of file From 5d67a1e65b982771f0c25c9ad14bf59e3e197986 Mon Sep 17 00:00:00 2001 From: nyo <1153009+lc-nyovchev@users.noreply.github.com> Date: Thu, 22 May 2025 20:22:49 +0200 Subject: [PATCH 09/11] Added yet another format --- .../src/test/resources/results/3.0.1/app110.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app110.json b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app110.json index 62f211aa2..91a4af137 100644 --- a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app110.json +++ b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app110.json @@ -257,7 +257,8 @@ "type": "string" }, "email1": { - "type": "string" + "type": "string", + "format": "email" }, "age": { "maximum": 30, From 249f32049cdde672a0afb7a8a4a58707fcb10695 Mon Sep 17 00:00:00 2001 From: nyo <1153009+lc-nyovchev@users.noreply.github.com> Date: Thu, 22 May 2025 20:23:03 +0200 Subject: [PATCH 10/11] Questionable fix --- .../test/resources/results/3.1.0/app213.json | 14 ++++- .../test/resources/results/3.1.0/app26.json | 63 ++----------------- 2 files changed, 15 insertions(+), 62 deletions(-) diff --git a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app213.json b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app213.json index d8ac4d797..5e1c8ff74 100644 --- a/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app213.json +++ b/springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app213.json @@ -5,7 +5,15 @@ "description": "This API exposes endpoints for testing anything", "termsOfService": "https://www.test.ca/terms", "version": "1.0", - "x-amazon-apigateway-integration": { + "x-${api.extensions.name}": { + "passthroughBehavior": "${api.extensions.properties.passthroughBehavior}", + "connectionId": "${api.extensions.properties.connectionId}", + "type": "${api.extensions.properties.type}", + "httpMethod": "GET", + "uri": "${api.extensions.properties.uri}/testcontroller/getTest", + "connectionType": "${api.extensions.properties.connectionType}" + }, + "x-x-amazon-apigateway-integration": { "passthroughBehavior": "when_no_match", "connectionId": "1rqafw", "type": "http_proxy", @@ -47,7 +55,7 @@ } } }, - "x-amazon-apigateway-integration": { + "x-x-amazon-apigateway-integration": { "passthroughBehavior": "when_no_match", "connectionId": "1rqafw", "type": "http_proxy", @@ -76,4 +84,4 @@ } } } -} +} \ No newline at end of file diff --git a/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.1.0/app26.json b/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.1.0/app26.json index 52c639196..e5f93bcb8 100644 --- a/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.1.0/app26.json +++ b/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/resources/results/3.1.0/app26.json @@ -30,72 +30,17 @@ "name": "myModel", "in": "query", "description": "the my model", - "required": true, - "schema": { - "$ref": "#/components/schemas/MyModel" - } + "required": true } ], "responses": { "200": { "description": "the my model", - "content": { - "*/*": { - "schema": { - "$ref": "#/components/schemas/MyModel" - } - } - } + "content": {} } } } } }, - "components": { - "schemas": { - "Bar": { - "type": "object", - "description": "The type Bar.", - "properties": { - "bar": { - "type": "string", - "description": "The Bar." - } - } - }, - "Foo": { - "type": "object", - "description": "The type Foo.", - "properties": { - "foo": { - "type": "string", - "description": "The Foo." - } - } - }, - "MyModel": { - "type": "object", - "description": "The type My model.", - "properties": { - "thing": { - "description": "Hello", - "oneOf": [ - { - "$ref": "#/components/schemas/Foo" - }, - { - "$ref": "#/components/schemas/Bar" - }, - { - "$ref": "#/components/schemas/Foo" - }, - { - "$ref": "#/components/schemas/Bar" - } - ] - } - } - } - } - } -} + "components": {} +} \ No newline at end of file From d794a8c76f1ec281261be149f63ff592f1bb8dac Mon Sep 17 00:00:00 2001 From: nyo <1153009+lc-nyovchev@users.noreply.github.com> Date: Thu, 22 May 2025 20:24:22 +0200 Subject: [PATCH 11/11] Fix typo --- .../org/springdoc/api/v30/app110/SpringDocApp110Test.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app110/SpringDocApp110Test.java b/springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app110/SpringDocApp110Test.java index d6cdd00f2..30d5320d4 100644 --- a/springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app110/SpringDocApp110Test.java +++ b/springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app110/SpringDocApp110Test.java @@ -43,13 +43,13 @@ public class SpringDocApp110Test extends AbstractSpringDocV30Test { static class SpringDocTestApp { @Bean - public OpenAPI customOpenAPI(@Value("${application-description}") String appDesciption, @Value("${application-version}") String appVersion) { + public OpenAPI customOpenAPI(@Value("${application-description}") String appDescription, @Value("${application-version}") String appVersion) { return new OpenAPI() .info(new Info() .title("sample application API") .version(appVersion) - .description(appDesciption) + .description(appDescription) .termsOfService("http://swagger.io/terms/") .license(new License().name("Apache 2.0").url("http://springdoc.org"))); }