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/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"))); } 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, 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, 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, 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-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, 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 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/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"))); } 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, 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, 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, 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