From edb1eac1fe08b5b90d57e09261bf2a3a6140c230 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 29 Sep 2021 17:38:26 +0000 Subject: [PATCH 01/79] prepare release 2.1.11 --- README.md | 5 +++-- modules/swagger-annotations/pom.xml | 2 +- modules/swagger-core/pom.xml | 2 +- .../swagger-eclipse-transformer-maven-plugin/pom.xml | 2 +- modules/swagger-gradle-plugin/README.md | 4 ++-- modules/swagger-gradle-plugin/gradle.properties | 2 +- .../io/swagger/v3/plugins/gradle/SwaggerPlugin.java | 2 +- .../v3/plugins/gradle/SwaggerResolveTest.java | 2 +- modules/swagger-integration/pom.xml | 2 +- .../swagger-jaxrs2-servlet-initializer-v2/pom.xml | 2 +- modules/swagger-jaxrs2-servlet-initializer/pom.xml | 2 +- modules/swagger-jaxrs2/pom.xml | 2 +- modules/swagger-maven-plugin/README.md | 12 ++++++------ modules/swagger-maven-plugin/pom.xml | 2 +- modules/swagger-models/pom.xml | 2 +- .../modules/swagger-annotations-jakarta/pom.xml | 2 +- .../modules/swagger-core-jakarta/pom.xml | 2 +- .../modules/swagger-integration-jakarta/pom.xml | 2 +- .../modules/swagger-jaxrs2-jakarta/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../modules/swagger-maven-plugin-jakarta/pom.xml | 2 +- .../modules/swagger-models-jakarta/pom.xml | 2 +- modules/swagger-project-jakarta/pom.xml | 2 +- pom.xml | 2 +- 25 files changed, 33 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index c420235d29..23bf426023 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,8 @@ The OpenAPI Specification has undergone several revisions since initial creation Swagger core Version | Release Date | OpenAPI Spec compatibility | Notes | Status ------------------------- | ------------ | -------------------------- | ----- | ---- -2.1.10 (**current stable**)| 2021-06-28 | 3.0 | [tag v2.1.10](https://github.com/swagger-api/swagger-core/tree/v2.1.10) | Supported +2.1.11 (**current stable**)| 2021-09-29 | 3.0 | [tag v2.1.11](https://github.com/swagger-api/swagger-core/tree/v2.1.11) | Supported +2.1.10 | 2021-06-28 | 3.0 | [tag v2.1.10](https://github.com/swagger-api/swagger-core/tree/v2.1.10) | Supported 2.1.9 | 2021-04-20 | 3.0 | [tag v2.1.9](https://github.com/swagger-api/swagger-core/tree/v2.1.9) | Supported 2.1.8 | 2021-04-18 | 3.0 | [tag v2.1.8](https://github.com/swagger-api/swagger-core/tree/v2.1.8) | Supported 2.1.7 | 2021-02-18 | 3.0 | [tag v2.1.7](https://github.com/swagger-api/swagger-core/tree/v2.1.7) | Supported @@ -75,7 +76,7 @@ You need the following installed and available in your $PATH: * Jackson 2.4.5 or greater -### To build from source (currently 2.1.11-SNAPSHOT) +### To build from source (currently 2.1.12-SNAPSHOT) ``` # first time building locally mvn -N diff --git a/modules/swagger-annotations/pom.xml b/modules/swagger-annotations/pom.xml index 119efefd83..f994c72d92 100644 --- a/modules/swagger-annotations/pom.xml +++ b/modules/swagger-annotations/pom.xml @@ -3,7 +3,7 @@ io.swagger.core.v3 swagger-project - 2.1.11-SNAPSHOT + 2.1.11 ../.. 4.0.0 diff --git a/modules/swagger-core/pom.xml b/modules/swagger-core/pom.xml index b5c494280a..56c0aa60ed 100644 --- a/modules/swagger-core/pom.xml +++ b/modules/swagger-core/pom.xml @@ -3,7 +3,7 @@ io.swagger.core.v3 swagger-project - 2.1.11-SNAPSHOT + 2.1.11 ../.. 4.0.0 diff --git a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml index d27e64b01a..0f3453776c 100644 --- a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml +++ b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.11-SNAPSHOT + 2.1.11 ../.. 4.0.0 diff --git a/modules/swagger-gradle-plugin/README.md b/modules/swagger-gradle-plugin/README.md index 4097766c2e..47ae43b87a 100644 --- a/modules/swagger-gradle-plugin/README.md +++ b/modules/swagger-gradle-plugin/README.md @@ -26,7 +26,7 @@ Alternatively provide as value a classpath with the following dependencies (repl ``` plugins { - id "io.swagger.core.v3.swagger-gradle-plugin" version "2.1.10" + id "io.swagger.core.v3.swagger-gradle-plugin" version "2.1.11" } ``` ### Gradle 1.x and 2.0 @@ -43,7 +43,7 @@ buildscript { } } dependencies { - classpath "io.swagger.core.v3:swagger-gradle-plugin:2.1.10" + classpath "io.swagger.core.v3:swagger-gradle-plugin:2.1.11" } } diff --git a/modules/swagger-gradle-plugin/gradle.properties b/modules/swagger-gradle-plugin/gradle.properties index f8cfe1ffe4..e216528366 100644 --- a/modules/swagger-gradle-plugin/gradle.properties +++ b/modules/swagger-gradle-plugin/gradle.properties @@ -1,2 +1,2 @@ -version=2.1.11-SNAPSHOT +version=2.1.11 jettyVersion=9.4.43.v20210629 diff --git a/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java b/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java index c3f2666a89..9ee96d0524 100644 --- a/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java +++ b/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java @@ -16,7 +16,7 @@ public void apply(Project project) { config.defaultDependencies(new Action() { public void execute(DependencySet dependencies) { dependencies.add(project.getDependencies().create("org.apache.commons:commons-lang3:3.7")); - dependencies.add(project.getDependencies().create("io.swagger.core.v3:swagger-jaxrs2:2.1.11-SNAPSHOT")); + dependencies.add(project.getDependencies().create("io.swagger.core.v3:swagger-jaxrs2:2.1.11")); dependencies.add(project.getDependencies().create("javax.ws.rs:javax.ws.rs-api:2.1")); dependencies.add(project.getDependencies().create("javax.servlet:javax.servlet-api:3.1.0")); } diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java index c6475d8e50..25b143c477 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java @@ -82,7 +82,7 @@ public void testSwaggerResolveTask() throws IOException { " mavenCentral()\n" + "}\n" + "dependencies { \n" + - " compile group: 'io.swagger.core.v3', name: 'swagger-jaxrs2', version:'2.1.11-SNAPSHOT'\n" + + " compile group: 'io.swagger.core.v3', name: 'swagger-jaxrs2', version:'2.1.11'\n" + " compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version:'2.1'\n" + " compile group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'\n" + " testCompile group: 'com.github.tomakehurst', name: 'wiremock', version:'2.27.2'\n" + diff --git a/modules/swagger-integration/pom.xml b/modules/swagger-integration/pom.xml index b67b22d86b..6a0f20a04d 100644 --- a/modules/swagger-integration/pom.xml +++ b/modules/swagger-integration/pom.xml @@ -6,7 +6,7 @@ io.swagger.core.v3 swagger-project - 2.1.11-SNAPSHOT + 2.1.11 ../.. swagger-integration diff --git a/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml b/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml index bcb7a7f551..4be3b9beb3 100644 --- a/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml +++ b/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.11-SNAPSHOT + 2.1.11 ../../ 4.0.0 diff --git a/modules/swagger-jaxrs2-servlet-initializer/pom.xml b/modules/swagger-jaxrs2-servlet-initializer/pom.xml index d69affccb2..a657ba88eb 100644 --- a/modules/swagger-jaxrs2-servlet-initializer/pom.xml +++ b/modules/swagger-jaxrs2-servlet-initializer/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.11-SNAPSHOT + 2.1.11 ../../ 4.0.0 diff --git a/modules/swagger-jaxrs2/pom.xml b/modules/swagger-jaxrs2/pom.xml index d6602e15a9..d007c16d89 100644 --- a/modules/swagger-jaxrs2/pom.xml +++ b/modules/swagger-jaxrs2/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.11-SNAPSHOT + 2.1.11 ../../ 4.0.0 diff --git a/modules/swagger-maven-plugin/README.md b/modules/swagger-maven-plugin/README.md index 8ee2ea6da8..2044b054b8 100644 --- a/modules/swagger-maven-plugin/README.md +++ b/modules/swagger-maven-plugin/README.md @@ -22,7 +22,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-maven-plugin - 2.1.10 + 2.1.11 openapi ${project.build.directory}/generatedtest @@ -47,7 +47,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-jaxrs2 - 2.1.10 + 2.1.11 @@ -73,7 +73,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-maven-plugin-jakarta - 2.1.10 + 2.1.11 openapi ${project.build.directory}/generatedtest @@ -98,7 +98,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-jaxrs2-jakarta - 2.1.10 + 2.1.11 @@ -126,7 +126,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-maven-plugin - 2.1.10 + 2.1.11 openapi ${project.build.directory}/generatedtest @@ -155,7 +155,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-maven-plugin-jakarta - 2.1.10 + 2.1.11 openapi ${project.build.directory}/generatedtest diff --git a/modules/swagger-maven-plugin/pom.xml b/modules/swagger-maven-plugin/pom.xml index 8ed7b8b775..3bbb1cb145 100644 --- a/modules/swagger-maven-plugin/pom.xml +++ b/modules/swagger-maven-plugin/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.11-SNAPSHOT + 2.1.11 ../.. 4.0.0 diff --git a/modules/swagger-models/pom.xml b/modules/swagger-models/pom.xml index 6f8a5a18d5..4966891900 100644 --- a/modules/swagger-models/pom.xml +++ b/modules/swagger-models/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.11-SNAPSHOT + 2.1.11 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml index 9ef3308917..cc14f2a092 100644 --- a/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11-SNAPSHOT + 2.1.11 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml index 67e6d6e92c..b10e637095 100644 --- a/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11-SNAPSHOT + 2.1.11 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml index 3ffdc7f1e3..d362befd71 100644 --- a/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11-SNAPSHOT + 2.1.11 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml index a241906a9d..f62de08c8e 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11-SNAPSHOT + 2.1.11 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml index 58cb54acc8..c4e5292bcd 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11-SNAPSHOT + 2.1.11 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml index 4f54fcd28d..07fd5028d1 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11-SNAPSHOT + 2.1.11 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml index 6be34b3d2a..aa9680635b 100644 --- a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11-SNAPSHOT + 2.1.11 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml index cc1ea3b011..bab50c848e 100644 --- a/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11-SNAPSHOT + 2.1.11 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/pom.xml b/modules/swagger-project-jakarta/pom.xml index bf449c8138..30d0a5a268 100644 --- a/modules/swagger-project-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/pom.xml @@ -6,7 +6,7 @@ pom swagger-project-jakarta swagger-project-jakarta - 2.1.11-SNAPSHOT + 2.1.11 https://github.com/swagger-api/swagger-core scm:git:git@github.com:swagger-api/swagger-core.git diff --git a/pom.xml b/pom.xml index 028e957976..b483826476 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ pom swagger-project swagger-project - 2.1.11-SNAPSHOT + 2.1.11 https://github.com/swagger-api/swagger-core scm:git:git@github.com:swagger-api/swagger-core.git From 8882c2555cb7b4f7a154f34b1f570ef88d9cc858 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 29 Sep 2021 18:13:41 +0000 Subject: [PATCH 02/79] bump snapshot 2.1.12-SNAPSHOT --- modules/swagger-annotations/pom.xml | 2 +- modules/swagger-core/pom.xml | 2 +- modules/swagger-eclipse-transformer-maven-plugin/pom.xml | 2 +- modules/swagger-gradle-plugin/gradle.properties | 2 +- .../main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java | 2 +- .../java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java | 2 +- modules/swagger-integration/pom.xml | 2 +- modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml | 2 +- modules/swagger-jaxrs2-servlet-initializer/pom.xml | 2 +- modules/swagger-jaxrs2/pom.xml | 2 +- modules/swagger-maven-plugin/pom.xml | 2 +- modules/swagger-models/pom.xml | 2 +- .../modules/swagger-annotations-jakarta/pom.xml | 2 +- .../modules/swagger-core-jakarta/pom.xml | 2 +- .../modules/swagger-integration-jakarta/pom.xml | 2 +- .../modules/swagger-jaxrs2-jakarta/pom.xml | 2 +- .../modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml | 2 +- .../swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml | 2 +- .../modules/swagger-maven-plugin-jakarta/pom.xml | 2 +- .../modules/swagger-models-jakarta/pom.xml | 2 +- modules/swagger-project-jakarta/pom.xml | 2 +- pom.xml | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/modules/swagger-annotations/pom.xml b/modules/swagger-annotations/pom.xml index f994c72d92..53c7e6e493 100644 --- a/modules/swagger-annotations/pom.xml +++ b/modules/swagger-annotations/pom.xml @@ -3,7 +3,7 @@ io.swagger.core.v3 swagger-project - 2.1.11 + 2.1.12-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-core/pom.xml b/modules/swagger-core/pom.xml index 56c0aa60ed..ec8e004dbd 100644 --- a/modules/swagger-core/pom.xml +++ b/modules/swagger-core/pom.xml @@ -3,7 +3,7 @@ io.swagger.core.v3 swagger-project - 2.1.11 + 2.1.12-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml index 0f3453776c..865f8a1068 100644 --- a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml +++ b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.11 + 2.1.12-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-gradle-plugin/gradle.properties b/modules/swagger-gradle-plugin/gradle.properties index e216528366..53ac342041 100644 --- a/modules/swagger-gradle-plugin/gradle.properties +++ b/modules/swagger-gradle-plugin/gradle.properties @@ -1,2 +1,2 @@ -version=2.1.11 +version=2.1.12-SNAPSHOT jettyVersion=9.4.43.v20210629 diff --git a/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java b/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java index 9ee96d0524..97dae85d81 100644 --- a/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java +++ b/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java @@ -16,7 +16,7 @@ public void apply(Project project) { config.defaultDependencies(new Action() { public void execute(DependencySet dependencies) { dependencies.add(project.getDependencies().create("org.apache.commons:commons-lang3:3.7")); - dependencies.add(project.getDependencies().create("io.swagger.core.v3:swagger-jaxrs2:2.1.11")); + dependencies.add(project.getDependencies().create("io.swagger.core.v3:swagger-jaxrs2:2.1.12-SNAPSHOT")); dependencies.add(project.getDependencies().create("javax.ws.rs:javax.ws.rs-api:2.1")); dependencies.add(project.getDependencies().create("javax.servlet:javax.servlet-api:3.1.0")); } diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java index 25b143c477..df55df572a 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java @@ -82,7 +82,7 @@ public void testSwaggerResolveTask() throws IOException { " mavenCentral()\n" + "}\n" + "dependencies { \n" + - " compile group: 'io.swagger.core.v3', name: 'swagger-jaxrs2', version:'2.1.11'\n" + + " compile group: 'io.swagger.core.v3', name: 'swagger-jaxrs2', version:'2.1.12-SNAPSHOT'\n" + " compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version:'2.1'\n" + " compile group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'\n" + " testCompile group: 'com.github.tomakehurst', name: 'wiremock', version:'2.27.2'\n" + diff --git a/modules/swagger-integration/pom.xml b/modules/swagger-integration/pom.xml index 6a0f20a04d..d048bfa70c 100644 --- a/modules/swagger-integration/pom.xml +++ b/modules/swagger-integration/pom.xml @@ -6,7 +6,7 @@ io.swagger.core.v3 swagger-project - 2.1.11 + 2.1.12-SNAPSHOT ../.. swagger-integration diff --git a/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml b/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml index 4be3b9beb3..caf33f0b17 100644 --- a/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml +++ b/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.11 + 2.1.12-SNAPSHOT ../../ 4.0.0 diff --git a/modules/swagger-jaxrs2-servlet-initializer/pom.xml b/modules/swagger-jaxrs2-servlet-initializer/pom.xml index a657ba88eb..9def14025d 100644 --- a/modules/swagger-jaxrs2-servlet-initializer/pom.xml +++ b/modules/swagger-jaxrs2-servlet-initializer/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.11 + 2.1.12-SNAPSHOT ../../ 4.0.0 diff --git a/modules/swagger-jaxrs2/pom.xml b/modules/swagger-jaxrs2/pom.xml index d007c16d89..040a443a4a 100644 --- a/modules/swagger-jaxrs2/pom.xml +++ b/modules/swagger-jaxrs2/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.11 + 2.1.12-SNAPSHOT ../../ 4.0.0 diff --git a/modules/swagger-maven-plugin/pom.xml b/modules/swagger-maven-plugin/pom.xml index 3bbb1cb145..9618b81515 100644 --- a/modules/swagger-maven-plugin/pom.xml +++ b/modules/swagger-maven-plugin/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.11 + 2.1.12-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-models/pom.xml b/modules/swagger-models/pom.xml index 4966891900..76f62136f7 100644 --- a/modules/swagger-models/pom.xml +++ b/modules/swagger-models/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.11 + 2.1.12-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml index cc14f2a092..b43de48338 100644 --- a/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11 + 2.1.12-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml index b10e637095..e478eddea4 100644 --- a/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11 + 2.1.12-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml index d362befd71..4f6bce64f7 100644 --- a/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11 + 2.1.12-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml index f62de08c8e..5a58351aed 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11 + 2.1.12-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml index c4e5292bcd..5fef378f22 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11 + 2.1.12-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml index 07fd5028d1..e345d29678 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11 + 2.1.12-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml index aa9680635b..63c5343400 100644 --- a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11 + 2.1.12-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml index bab50c848e..152ec5d41a 100644 --- a/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.11 + 2.1.12-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/pom.xml b/modules/swagger-project-jakarta/pom.xml index 30d0a5a268..7f1b0cad99 100644 --- a/modules/swagger-project-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/pom.xml @@ -6,7 +6,7 @@ pom swagger-project-jakarta swagger-project-jakarta - 2.1.11 + 2.1.12-SNAPSHOT https://github.com/swagger-api/swagger-core scm:git:git@github.com:swagger-api/swagger-core.git diff --git a/pom.xml b/pom.xml index b483826476..95cd4d97b8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ pom swagger-project swagger-project - 2.1.11 + 2.1.12-SNAPSHOT https://github.com/swagger-api/swagger-core scm:git:git@github.com:swagger-api/swagger-core.git From 15328d5418ac71a2929308edc882c414fdf773ea Mon Sep 17 00:00:00 2001 From: Francesco Tumanischvili Date: Wed, 29 Sep 2021 20:19:29 +0200 Subject: [PATCH 03/79] update README releases list --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 23bf426023..13f2bb151e 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,8 @@ Swagger core Version | Release Date | OpenAPI Spec compatibility | Notes | 2.0.5 | 2018-09-19 | 3.0 | [tag v2.0.5](https://github.com/swagger-api/swagger-core/tree/v2.0.5) | Supported 2.0.4 | 2018-09-05 | 3.0 | [tag v2.0.4](https://github.com/swagger-api/swagger-core/tree/v2.0.4) | Supported 2.0.3 | 2018-08-09 | 3.0 | [tag v2.0.3](https://github.com/swagger-api/swagger-core/tree/v2.0.3) | Supported -1.6.2 (**current stable**)| 2020-07-01 | 2.0 | [tag v1.6.2](https://github.com/swagger-api/swagger-core/tree/v1.6.2) | Supported +1.6.3 (**current stable**)| 2021-09-29 | 2.0 | [tag v1.6.3](https://github.com/swagger-api/swagger-core/tree/v1.6.3) | Supported +1.6.2 | 2020-07-01 | 2.0 | [tag v1.6.2](https://github.com/swagger-api/swagger-core/tree/v1.6.2) | Supported 1.6.1 | 2020-04-01 | 2.0 | [tag v1.6.1](https://github.com/swagger-api/swagger-core/tree/v1.6.1) | Supported 1.6.0 | 2019-11-16 | 2.0 | [tag v1.6.0](https://github.com/swagger-api/swagger-core/tree/v1.6.0) | Supported 1.5.24 | 2019-10-11 | 2.0 | [tag v1.5.24](https://github.com/swagger-api/swagger-core/tree/v1.5.24) | Supported From f6bed822e102db344a6d3474962d17f8bda8908b Mon Sep 17 00:00:00 2001 From: frantuma Date: Fri, 1 Oct 2021 11:59:06 +0200 Subject: [PATCH 04/79] fix #4031 - bump classgraph version, solve CWE-611 --- modules/swagger-project-jakarta/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/swagger-project-jakarta/pom.xml b/modules/swagger-project-jakarta/pom.xml index 7f1b0cad99..825f16d51a 100644 --- a/modules/swagger-project-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/pom.xml @@ -565,7 +565,7 @@ 4.13.1 2.12.1 1.2.3 - 4.8.95 + 4.8.117 30.1-jre 1.10.11 3.7 diff --git a/pom.xml b/pom.xml index 95cd4d97b8..0e2e8c90d5 100644 --- a/pom.xml +++ b/pom.xml @@ -626,7 +626,7 @@ 4.13.1 2.12.1 1.2.3 - 4.8.95 + 4.8.117 30.1-jre 1.10.11 3.7 From 1b1e2a2b03b699d3c75f15f445b4e59877ab998f Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sun, 3 Oct 2021 22:25:39 +0100 Subject: [PATCH 05/79] jknack:handlebars 4.2.1 --- modules/swagger-gradle-plugin/build.gradle | 4 ++-- modules/swagger-maven-plugin/pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/swagger-gradle-plugin/build.gradle b/modules/swagger-gradle-plugin/build.gradle index e0b1728021..912187ab36 100644 --- a/modules/swagger-gradle-plugin/build.gradle +++ b/modules/swagger-gradle-plugin/build.gradle @@ -50,8 +50,8 @@ dependencies { testImplementation "commons-codec:commons-codec:1.15" testImplementation "commons-io:commons-io:2.7" testImplementation "org.apache.commons:commons-compress:1.21" - testImplementation "com.github.jknack:handlebars:4.1.2" - testImplementation "com.github.jknack:handlebars-helpers:4.1.2" + testImplementation "com.github.jknack:handlebars:4.2.1" + testImplementation "com.github.jknack:handlebars-helpers:4.2.1" } // * * * * * * * * * * * * diff --git a/modules/swagger-maven-plugin/pom.xml b/modules/swagger-maven-plugin/pom.xml index 9618b81515..f12290b49d 100644 --- a/modules/swagger-maven-plugin/pom.xml +++ b/modules/swagger-maven-plugin/pom.xml @@ -279,13 +279,13 @@ com.github.jknack handlebars-helpers test - 4.1.2 + 4.2.1 com.github.jknack handlebars test - 4.1.2 + 4.2.1 From 6b928acb91c47e3c0651e7ba4bdf56fe7f245cad Mon Sep 17 00:00:00 2001 From: Josh Ponelat Date: Mon, 22 Nov 2021 13:52:31 +0200 Subject: [PATCH 06/79] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 13f2bb151e..e3a98c035d 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ **NOTE:** If you're looking for Swagger Core 1.5.X and OpenAPI 2.0, please refer to [1.5 branch](https://github.com/swagger-api/swagger-core/tree/1.5). -**NOTE:** Since version 2.1.7 Swagger Core supports also Jakarta namespace, with a parallel set of artifacts with `-jakarta` suffix, providing the same functionality as the "standard" `javax` namespace ones. -Please check [Wiki](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Getting-started) for more details +**NOTE:** Since version 2.1.7, Swagger Core also supports the Jakarta namespace. There are a parallel set of artifacts with the `-jakarta` suffix, providing the same functionality as the unsuffixed (i.e.: `javax`) artifacts. +Please see the [Wiki](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Getting-started) for more details. ![Build Test Deploy](https://github.com/swagger-api/swagger-core/workflows/Build%20Test%20Deploy%20master/badge.svg?branch=master) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.swagger.core.v3/swagger-project/badge.svg?style=plastic)](https://maven-badges.herokuapp.com/maven-central/io.swagger.core.v3/swagger-project) From 78906a257dcd20849fe195289ddafa813f0d74af Mon Sep 17 00:00:00 2001 From: Christopher Cudennec Date: Thu, 25 Nov 2021 08:46:51 +0100 Subject: [PATCH 07/79] fix: Support enums with unbounded wildcards --- .../v3/core/jackson/ModelResolver.java | 48 ++++++++++--------- .../swagger/v3/core/resolving/EnumTest.java | 31 ++++++++++-- 2 files changed, 54 insertions(+), 25 deletions(-) diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java index 03d25f73a8..777d60a73f 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java @@ -947,28 +947,32 @@ protected void _addEnumProps(Class propClass, Schema property) { Class> enumClass = (Class>) propClass; Enum[] enumConstants = enumClass.getEnumConstants(); - String[] enumValues = _intr.findEnumValues(propClass, enumConstants, new String[enumConstants.length]); - - for (Enum en : enumConstants) { - String n; - - String enumValue = enumValues[en.ordinal()]; - String s = jsonValueMethod.flatMap(m -> ReflectionUtils.safeInvoke(m, en)).map(Object::toString).orElse(null); - - if (s != null) { - n = s; - } else if (enumValue != null) { - n = enumValue; - } else if (useIndex) { - n = String.valueOf(en.ordinal()); - } else if (useToString) { - n = en.toString(); - } else { - n = _intr.findEnumValue(en); - } - if (property instanceof StringSchema) { - StringSchema sp = (StringSchema) property; - sp.addEnumItem(n); + if (enumConstants != null) { + String[] enumValues = _intr.findEnumValues(propClass, enumConstants, + new String[enumConstants.length]); + + for (Enum en : enumConstants) { + String n; + + String enumValue = enumValues[en.ordinal()]; + String s = jsonValueMethod.flatMap(m -> ReflectionUtils.safeInvoke(m, en)) + .map(Object::toString).orElse(null); + + if (s != null) { + n = s; + } else if (enumValue != null) { + n = enumValue; + } else if (useIndex) { + n = String.valueOf(en.ordinal()); + } else if (useToString) { + n = en.toString(); + } else { + n = _intr.findEnumValue(en); + } + if (property instanceof StringSchema) { + StringSchema sp = (StringSchema) property; + sp.addEnumItem(n); + } } } } diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/EnumTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/EnumTest.java index ccd06061b5..72dd08ee12 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/EnumTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/EnumTest.java @@ -15,13 +15,12 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; public class EnumTest extends SwaggerTestBase { @Test - public void testEnum() throws Exception { + public void testEnum() { final ModelResolver modelResolver = new ModelResolver(mapper()); final ModelConverterContextImpl context = new ModelConverterContextImpl(modelResolver); @@ -41,11 +40,37 @@ public void testEnum() throws Exception { final StringSchema strProperty = (StringSchema) property; assertNotNull(strProperty.getEnum()); final Collection values = - new ArrayList(Collections2.transform(Arrays.asList(Currency.values()), Functions.toStringFunction())); + new ArrayList<>(Collections2.transform(Arrays.asList(Currency.values()), Functions.toStringFunction())); assertEquals(strProperty.getEnum(), values); } + @Test + public void testEnumGenerics() { + final ModelResolver modelResolver = new ModelResolver(mapper()); + final ModelConverterContextImpl context = new ModelConverterContextImpl(modelResolver); + + final Schema model = context.resolve((new AnnotatedType().type(Contract.class))); + assertNotNull(model); + assertEquals(model.getName(), "Contract"); + assertTrue(model.getProperties().containsKey("type")); + assertNotNull(model.getProperties().get("type")); + } + public enum Currency { USA, CANADA } + + public static class Contract { + + private Enum type; + + public Enum getType() { + return type; + } + + public Contract setType(Enum type) { + this.type = type; + return this; + } + } } From 2f81363c21ad13d5726a07c83af8a6cd8aa99918 Mon Sep 17 00:00:00 2001 From: vrossello Date: Tue, 30 Nov 2021 22:13:16 +0100 Subject: [PATCH 08/79] Typo in ModelResolver --- .../src/main/java/io/swagger/v3/core/jackson/ModelResolver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java index 777d60a73f..45a0583fa9 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java @@ -907,7 +907,7 @@ private Schema clone(Schema property) { property = Json.mapper().readValue(Json.pretty(property), Schema.class); property.setName(cloneName); } catch (IOException e) { - LOGGER.error("Could not clone property, e"); + LOGGER.error("Could not clone property", e); } return property; } From 375b2f57fba1e02c37c1afe8c71c515e12034ad8 Mon Sep 17 00:00:00 2001 From: Jason Voss Date: Fri, 10 Dec 2021 01:02:00 -0600 Subject: [PATCH 09/79] schema json object defaultValue --- .../v3/core/jackson/ModelResolver.java | 13 ++- .../swagger/v3/core/converting/PojoTest.java | 90 +++++++++++++++++++ 2 files changed, 99 insertions(+), 4 deletions(-) diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java index 45a0583fa9..f2d5fdcf89 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java @@ -1520,10 +1520,15 @@ protected String resolveFormat(Annotated a, Annotation[] annotations, io.swagger return null; } - protected String resolveDefaultValue(Annotated a, Annotation[] annotations, io.swagger.v3.oas.annotations.media.Schema schema) { + protected Object resolveDefaultValue(Annotated a, Annotation[] annotations, io.swagger.v3.oas.annotations.media.Schema schema) { if (schema != null) { if (!schema.defaultValue().isEmpty()) { - return schema.defaultValue(); + try { + ObjectMapper mapper = ObjectMapperFactory.buildStrictGenericObjectMapper(); + return mapper.readTree(schema.defaultValue()); + } catch (IOException e) { + return schema.defaultValue(); + } } } if (a == null) { @@ -2005,8 +2010,8 @@ protected void resolveSchemaMembers(Schema schema, Annotated a, Annotation[] ann if (StringUtils.isNotBlank(format) && StringUtils.isBlank(schema.getFormat())) { schema.format(format); } - String defaultValue = resolveDefaultValue(a, annotations, schemaAnnotation); - if (StringUtils.isNotBlank(defaultValue)) { + Object defaultValue = resolveDefaultValue(a, annotations, schemaAnnotation); + if (defaultValue != null) { schema.setDefault(defaultValue); } Object example = resolveExample(a, annotations, schemaAnnotation); diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java index e15c8ff80b..7a3f6e36e8 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java @@ -482,6 +482,65 @@ public void setExampleJson(String exampleJson) { } + /** + * Test schema with json object defaultValue and example. + */ + @Test(description = "Shows how to provide model examples as json") + public void testModelPropertyExampleDefaultJson() { + + String json = "{\"ExampleJsonExtended\": {" + + "\"type\":\"object\"," + + "\"properties\":{" + + "\"id\":{" + + "\"type\":\"integer\"," + + "\"format\":\"int32\"" + + "}," + + "\"idType\":{" + + "\"type\":\"string\"" + + "}," + + "\"isActive\":{" + + "\"type\":\"boolean\"" + + "}" + + "}," + + "\"example\":{" + + "\"id\":19877734," + + "\"idType\":\"employee code\"," + + "\"isActive\":false" + + "}," + + "\"default\":{" + + "\"id\":19877734," + + "\"idType\":\"employee code\"," + + "\"isActive\":false" + + "}" + + "}," + + "\"modelWithPropertyExampleDefaultJson\":{" + + "\"type\":\"object\"," + + "\"properties\":{" + + "\"exampleJsonExtended\":{" + + "\"$ref\":\"#/components/schemas/ExampleJsonExtended\"" + + "}" + + "}" + + "}" + + "}"; + SerializationMatchers.assertEqualsToJson(readAll(modelWithPropertyExampleDefaultJson.class), json); + } + + static class modelWithPropertyExampleDefaultJson { + final String SAMPLE = "{\"id\": 19877734, \"idType\":\"employee code\", \"isActive\":false}"; + ExampleJsonExtended tester = new ExampleJsonExtended(); + + @Schema( example = SAMPLE, defaultValue = SAMPLE) + private ExampleJsonExtended exampleJsonExtended; + + public ExampleJsonExtended getExampleJsonExtended() { + return exampleJsonExtended; + } + + public void setExampleJsonExtended(ExampleJsonExtended exampleJsonExtended) { + this.exampleJsonExtended = exampleJsonExtended; + } + } + @Test(description = "Shows how to provide model examples as json") public void testModelPropertyStringExampleJson() { @@ -524,6 +583,37 @@ public void setId(String id) { } + static class ExampleJsonExtended { + private int id; + private String idType; + private boolean isActive; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getIdType() { + return idType; + } + + public void setIdType(String idType) { + this.idType = idType; + } + + public boolean getIsActive() { + return isActive; + } + + public void setIsActive(boolean isActive) { + this.isActive = isActive; + } + + } + @Test(description = "Shows how to provide an example array") public void testExampleArray() { From 8d480a825d3d134cfe0c29c411799cb1970ec170 Mon Sep 17 00:00:00 2001 From: frantuma Date: Thu, 23 Dec 2021 08:58:30 +0100 Subject: [PATCH 10/79] bump logback version --- modules/swagger-project-jakarta/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/swagger-project-jakarta/pom.xml b/modules/swagger-project-jakarta/pom.xml index 825f16d51a..1314106c44 100644 --- a/modules/swagger-project-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/pom.xml @@ -564,7 +564,7 @@ 3.0.1 4.13.1 2.12.1 - 1.2.3 + 1.2.9 4.8.117 30.1-jre 1.10.11 diff --git a/pom.xml b/pom.xml index 0e2e8c90d5..b69aefe430 100644 --- a/pom.xml +++ b/pom.xml @@ -625,7 +625,7 @@ 2.26 4.13.1 2.12.1 - 1.2.3 + 1.2.9 4.8.117 30.1-jre 1.10.11 From 2415fcd057817867b2f47ecc390cb2bcd0982b82 Mon Sep 17 00:00:00 2001 From: frantuma Date: Thu, 23 Dec 2021 10:24:36 +0100 Subject: [PATCH 11/79] update readme --- README.md | 89 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 45 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index e3a98c035d..e405b02c58 100644 --- a/README.md +++ b/README.md @@ -19,51 +19,52 @@ The [github wiki](https://github.com/swagger-api/swagger-core/wiki) contains doc ## Compatibility The OpenAPI Specification has undergone several revisions since initial creation in 2010. The Swagger Core project has the following compatibilities with the OpenAPI Specification: -Swagger core Version | Release Date | OpenAPI Spec compatibility | Notes | Status -------------------------- | ------------ | -------------------------- | ----- | ---- -2.1.11 (**current stable**)| 2021-09-29 | 3.0 | [tag v2.1.11](https://github.com/swagger-api/swagger-core/tree/v2.1.11) | Supported -2.1.10 | 2021-06-28 | 3.0 | [tag v2.1.10](https://github.com/swagger-api/swagger-core/tree/v2.1.10) | Supported -2.1.9 | 2021-04-20 | 3.0 | [tag v2.1.9](https://github.com/swagger-api/swagger-core/tree/v2.1.9) | Supported -2.1.8 | 2021-04-18 | 3.0 | [tag v2.1.8](https://github.com/swagger-api/swagger-core/tree/v2.1.8) | Supported -2.1.7 | 2021-02-18 | 3.0 | [tag v2.1.7](https://github.com/swagger-api/swagger-core/tree/v2.1.7) | Supported -2.1.6 | 2020-12-04 | 3.0 | [tag v2.1.6](https://github.com/swagger-api/swagger-core/tree/v2.1.6) | Supported -2.1.5 | 2020-10-01 | 3.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-core/tree/v2.1.5) | Supported -2.1.4 | 2020-07-24 | 3.0 | [tag v2.1.4](https://github.com/swagger-api/swagger-core/tree/v2.1.4) | Supported -2.1.3 | 2020-06-27 | 3.0 | [tag v2.1.3](https://github.com/swagger-api/swagger-core/tree/v2.1.3) | Supported -2.1.2 | 2020-04-01 | 3.0 | [tag v2.1.2](https://github.com/swagger-api/swagger-core/tree/v2.1.2) | Supported -2.1.1 | 2020-01-02 | 3.0 | [tag v2.1.1](https://github.com/swagger-api/swagger-core/tree/v2.1.1) | Supported -2.1.0 | 2019-11-16 | 3.0 | [tag v2.1.0](https://github.com/swagger-api/swagger-core/tree/v2.1.0) | Supported -2.0.10 | 2019-10-11 | 3.0 | [tag v2.0.10](https://github.com/swagger-api/swagger-core/tree/v2.0.10) | Supported -2.0.9 | 2019-08-22 | 3.0 | [tag v2.0.9](https://github.com/swagger-api/swagger-core/tree/v2.0.9) | Supported -2.0.8 | 2019-04-24 | 3.0 | [tag v2.0.8](https://github.com/swagger-api/swagger-core/tree/v2.0.8) | Supported -2.0.7 | 2019-02-18 | 3.0 | [tag v2.0.7](https://github.com/swagger-api/swagger-core/tree/v2.0.7) | Supported -2.0.6 | 2018-11-27 | 3.0 | [tag v2.0.6](https://github.com/swagger-api/swagger-core/tree/v2.0.6) | Supported -2.0.5 | 2018-09-19 | 3.0 | [tag v2.0.5](https://github.com/swagger-api/swagger-core/tree/v2.0.5) | Supported -2.0.4 | 2018-09-05 | 3.0 | [tag v2.0.4](https://github.com/swagger-api/swagger-core/tree/v2.0.4) | Supported -2.0.3 | 2018-08-09 | 3.0 | [tag v2.0.3](https://github.com/swagger-api/swagger-core/tree/v2.0.3) | Supported -1.6.3 (**current stable**)| 2021-09-29 | 2.0 | [tag v1.6.3](https://github.com/swagger-api/swagger-core/tree/v1.6.3) | Supported -1.6.2 | 2020-07-01 | 2.0 | [tag v1.6.2](https://github.com/swagger-api/swagger-core/tree/v1.6.2) | Supported -1.6.1 | 2020-04-01 | 2.0 | [tag v1.6.1](https://github.com/swagger-api/swagger-core/tree/v1.6.1) | Supported -1.6.0 | 2019-11-16 | 2.0 | [tag v1.6.0](https://github.com/swagger-api/swagger-core/tree/v1.6.0) | Supported -1.5.24 | 2019-10-11 | 2.0 | [tag v1.5.24](https://github.com/swagger-api/swagger-core/tree/v1.5.24) | Supported -1.5.23 | 2019-08-22 | 2.0 | [tag v1.5.23](https://github.com/swagger-api/swagger-core/tree/v1.5.23) | Supported -1.5.22 | 2019-02-18 | 2.0 | [tag v1.5.22](https://github.com/swagger-api/swagger-core/tree/v1.5.22) | Supported -1.5.21 | 2018-08-09 | 2.0 | [tag v1.5.21](https://github.com/swagger-api/swagger-core/tree/v1.5.21) | Supported -1.5.20 | 2018-05-23 | 2.0 | [tag v1.5.20](https://github.com/swagger-api/swagger-core/tree/v1.5.20) | Supported -2.0.2 | 2018-05-23 | 3.0 | [tag v2.0.2](https://github.com/swagger-api/swagger-core/tree/v2.0.2) | Supported -2.0.1 | 2018-04-16 | 3.0 | [tag v2.0.1](https://github.com/swagger-api/swagger-core/tree/v2.0.1) | Supported -1.5.19 | 2018-04-16 | 2.0 | [tag v1.5.19](https://github.com/swagger-api/swagger-core/tree/v1.5.19) | Supported -2.0.0 | 2018-03-20 | 3.0 | [tag v2.0.0](https://github.com/swagger-api/swagger-core/tree/v2.0.0) | Supported -2.0.0-rc4 | 2018-01-22 | 3.0 | [tag v2.0.0-rc4](https://github.com/swagger-api/swagger-core/tree/v2.0.0-rc4) | Supported -2.0.0-rc3 | 2017-11-21 | 3.0 | [tag v2.0.0-rc3](https://github.com/swagger-api/swagger-core/tree/v2.0.0-rc3) | Supported -2.0.0-rc2 | 2017-09-29 | 3.0 | [tag v2.0.0-rc2](https://github.com/swagger-api/swagger-core/tree/v2.0.0-rc2) | Supported -2.0.0-rc1 | 2017-08-17 | 3.0 | [tag v2.0.0-rc1](https://github.com/swagger-api/swagger-core/tree/v2.0.0-rc1) | Supported -1.5.18 | 2018-01-22 | 2.0 | [tag v1.5.18](https://github.com/swagger-api/swagger-core/tree/v1.5.18) | Supported -1.5.17 | 2017-11-21 | 2.0 | [tag v1.5.17](https://github.com/swagger-api/swagger-core/tree/v1.5.17) | Supported -1.5.16 | 2017-07-15 | 2.0 | [tag v1.5.16](https://github.com/swagger-api/swagger-core/tree/v1.5.16) | Supported -1.3.12 | 2014-12-23 | 1.2 | [tag v1.3.12](https://github.com/swagger-api/swagger-core/tree/v1.3.12) | Supported +Swagger core Version | Release Date | OpenAPI Spec compatibility | Notes | Status +------------------------- |--------------| -------------------------- |-------------------------------------------------------------------------------------------------------------------| ---- +2.1.11 (**current stable**)| 2021-09-29 | 3.0 | [tag v2.1.11](https://github.com/swagger-api/swagger-core/tree/v2.1.11) | Supported +2.1.10 | 2021-06-28 | 3.0 | [tag v2.1.10](https://github.com/swagger-api/swagger-core/tree/v2.1.10) | Supported +2.1.9 | 2021-04-20 | 3.0 | [tag v2.1.9](https://github.com/swagger-api/swagger-core/tree/v2.1.9) | Supported +2.1.8 | 2021-04-18 | 3.0 | [tag v2.1.8](https://github.com/swagger-api/swagger-core/tree/v2.1.8) | Supported +2.1.7 | 2021-02-18 | 3.0 | [tag v2.1.7](https://github.com/swagger-api/swagger-core/tree/v2.1.7) | Supported +2.1.6 | 2020-12-04 | 3.0 | [tag v2.1.6](https://github.com/swagger-api/swagger-core/tree/v2.1.6) | Supported +2.1.5 | 2020-10-01 | 3.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-core/tree/v2.1.5) | Supported +2.1.4 | 2020-07-24 | 3.0 | [tag v2.1.4](https://github.com/swagger-api/swagger-core/tree/v2.1.4) | Supported +2.1.3 | 2020-06-27 | 3.0 | [tag v2.1.3](https://github.com/swagger-api/swagger-core/tree/v2.1.3) | Supported +2.1.2 | 2020-04-01 | 3.0 | [tag v2.1.2](https://github.com/swagger-api/swagger-core/tree/v2.1.2) | Supported +2.1.1 | 2020-01-02 | 3.0 | [tag v2.1.1](https://github.com/swagger-api/swagger-core/tree/v2.1.1) | Supported +2.1.0 | 2019-11-16 | 3.0 | [tag v2.1.0](https://github.com/swagger-api/swagger-core/tree/v2.1.0) | Supported +2.0.10 | 2019-10-11 | 3.0 | [tag v2.0.10](https://github.com/swagger-api/swagger-core/tree/v2.0.10) | Supported +2.0.9 | 2019-08-22 | 3.0 | [tag v2.0.9](https://github.com/swagger-api/swagger-core/tree/v2.0.9) | Supported +2.0.8 | 2019-04-24 | 3.0 | [tag v2.0.8](https://github.com/swagger-api/swagger-core/tree/v2.0.8) | Supported +2.0.7 | 2019-02-18 | 3.0 | [tag v2.0.7](https://github.com/swagger-api/swagger-core/tree/v2.0.7) | Supported +2.0.6 | 2018-11-27 | 3.0 | [tag v2.0.6](https://github.com/swagger-api/swagger-core/tree/v2.0.6) | Supported +2.0.5 | 2018-09-19 | 3.0 | [tag v2.0.5](https://github.com/swagger-api/swagger-core/tree/v2.0.5) | Supported +2.0.4 | 2018-09-05 | 3.0 | [tag v2.0.4](https://github.com/swagger-api/swagger-core/tree/v2.0.4) | Supported +2.0.3 | 2018-08-09 | 3.0 | [tag v2.0.3](https://github.com/swagger-api/swagger-core/tree/v2.0.3) | Supported +1.6.4 (**current stable**)| 2021-12-23 | 2.0 | [tag v1.6.4](https://github.com/swagger-api/swagger-core/tree/v1.6.4) | Supported +1.6.3 | 2021-09-29 | 2.0 | [tag v1.6.3](https://github.com/swagger-api/swagger-core/tree/v1.6.3) | Supported +1.6.2 | 2020-07-01 | 2.0 | [tag v1.6.2](https://github.com/swagger-api/swagger-core/tree/v1.6.2) | Supported +1.6.1 | 2020-04-01 | 2.0 | [tag v1.6.1](https://github.com/swagger-api/swagger-core/tree/v1.6.1) | Supported +1.6.0 | 2019-11-16 | 2.0 | [tag v1.6.0](https://github.com/swagger-api/swagger-core/tree/v1.6.0) | Supported +1.5.24 | 2019-10-11 | 2.0 | [tag v1.5.24](https://github.com/swagger-api/swagger-core/tree/v1.5.24) | Supported +1.5.23 | 2019-08-22 | 2.0 | [tag v1.5.23](https://github.com/swagger-api/swagger-core/tree/v1.5.23) | Supported +1.5.22 | 2019-02-18 | 2.0 | [tag v1.5.22](https://github.com/swagger-api/swagger-core/tree/v1.5.22) | Supported +1.5.21 | 2018-08-09 | 2.0 | [tag v1.5.21](https://github.com/swagger-api/swagger-core/tree/v1.5.21) | Supported +1.5.20 | 2018-05-23 | 2.0 | [tag v1.5.20](https://github.com/swagger-api/swagger-core/tree/v1.5.20) | Supported +2.0.2 | 2018-05-23 | 3.0 | [tag v2.0.2](https://github.com/swagger-api/swagger-core/tree/v2.0.2) | Supported +2.0.1 | 2018-04-16 | 3.0 | [tag v2.0.1](https://github.com/swagger-api/swagger-core/tree/v2.0.1) | Supported +1.5.19 | 2018-04-16 | 2.0 | [tag v1.5.19](https://github.com/swagger-api/swagger-core/tree/v1.5.19) | Supported +2.0.0 | 2018-03-20 | 3.0 | [tag v2.0.0](https://github.com/swagger-api/swagger-core/tree/v2.0.0) | Supported +2.0.0-rc4 | 2018-01-22 | 3.0 | [tag v2.0.0-rc4](https://github.com/swagger-api/swagger-core/tree/v2.0.0-rc4) | Supported +2.0.0-rc3 | 2017-11-21 | 3.0 | [tag v2.0.0-rc3](https://github.com/swagger-api/swagger-core/tree/v2.0.0-rc3) | Supported +2.0.0-rc2 | 2017-09-29 | 3.0 | [tag v2.0.0-rc2](https://github.com/swagger-api/swagger-core/tree/v2.0.0-rc2) | Supported +2.0.0-rc1 | 2017-08-17 | 3.0 | [tag v2.0.0-rc1](https://github.com/swagger-api/swagger-core/tree/v2.0.0-rc1) | Supported +1.5.18 | 2018-01-22 | 2.0 | [tag v1.5.18](https://github.com/swagger-api/swagger-core/tree/v1.5.18) | Supported +1.5.17 | 2017-11-21 | 2.0 | [tag v1.5.17](https://github.com/swagger-api/swagger-core/tree/v1.5.17) | Supported +1.5.16 | 2017-07-15 | 2.0 | [tag v1.5.16](https://github.com/swagger-api/swagger-core/tree/v1.5.16) | Supported +1.3.12 | 2014-12-23 | 1.2 | [tag v1.3.12](https://github.com/swagger-api/swagger-core/tree/v1.3.12) | Supported 1.2.4 | 2013-06-19 | 1.1 | [tag swagger-project_2.10.0-1.2.4](https://github.com/swagger-api/swagger-core/tree/swagger-project_2.10.0-1.2.4) | Deprecated -1.0.0 | 2011-10-16 | 1.0 | [tag v1.0](https://github.com/swagger-api/swagger-core/tree/v1.0) | Deprecated +1.0.0 | 2011-10-16 | 1.0 | [tag v1.0](https://github.com/swagger-api/swagger-core/tree/v1.0) | Deprecated ### Change History From 0d7cfb2b42ee91f63956487ec47d7e0a112d60aa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 23 Dec 2021 10:30:35 +0000 Subject: [PATCH 12/79] prepare release 2.1.12 --- README.md | 4 ++-- modules/swagger-annotations/pom.xml | 2 +- modules/swagger-core/pom.xml | 2 +- .../swagger-eclipse-transformer-maven-plugin/pom.xml | 2 +- modules/swagger-gradle-plugin/README.md | 4 ++-- modules/swagger-gradle-plugin/gradle.properties | 2 +- .../io/swagger/v3/plugins/gradle/SwaggerPlugin.java | 2 +- .../v3/plugins/gradle/SwaggerResolveTest.java | 2 +- modules/swagger-integration/pom.xml | 2 +- .../swagger-jaxrs2-servlet-initializer-v2/pom.xml | 2 +- modules/swagger-jaxrs2-servlet-initializer/pom.xml | 2 +- modules/swagger-jaxrs2/pom.xml | 2 +- modules/swagger-maven-plugin/README.md | 12 ++++++------ modules/swagger-maven-plugin/pom.xml | 2 +- modules/swagger-models/pom.xml | 2 +- .../modules/swagger-annotations-jakarta/pom.xml | 2 +- .../modules/swagger-core-jakarta/pom.xml | 2 +- .../modules/swagger-integration-jakarta/pom.xml | 2 +- .../modules/swagger-jaxrs2-jakarta/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../modules/swagger-maven-plugin-jakarta/pom.xml | 2 +- .../modules/swagger-models-jakarta/pom.xml | 2 +- modules/swagger-project-jakarta/pom.xml | 2 +- pom.xml | 2 +- 25 files changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index e405b02c58..6e74912bbd 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The OpenAPI Specification has undergone several revisions since initial creation Swagger core Version | Release Date | OpenAPI Spec compatibility | Notes | Status ------------------------- |--------------| -------------------------- |-------------------------------------------------------------------------------------------------------------------| ---- -2.1.11 (**current stable**)| 2021-09-29 | 3.0 | [tag v2.1.11](https://github.com/swagger-api/swagger-core/tree/v2.1.11) | Supported +2.1.11 | 2021-09-29 | 3.0 | [tag v2.1.11](https://github.com/swagger-api/swagger-core/tree/v2.1.11) | Supported 2.1.10 | 2021-06-28 | 3.0 | [tag v2.1.10](https://github.com/swagger-api/swagger-core/tree/v2.1.10) | Supported 2.1.9 | 2021-04-20 | 3.0 | [tag v2.1.9](https://github.com/swagger-api/swagger-core/tree/v2.1.9) | Supported 2.1.8 | 2021-04-18 | 3.0 | [tag v2.1.8](https://github.com/swagger-api/swagger-core/tree/v2.1.8) | Supported @@ -78,7 +78,7 @@ You need the following installed and available in your $PATH: * Jackson 2.4.5 or greater -### To build from source (currently 2.1.12-SNAPSHOT) +### To build from source (currently 2.1.13-SNAPSHOT) ``` # first time building locally mvn -N diff --git a/modules/swagger-annotations/pom.xml b/modules/swagger-annotations/pom.xml index 53c7e6e493..0ede962e6f 100644 --- a/modules/swagger-annotations/pom.xml +++ b/modules/swagger-annotations/pom.xml @@ -3,7 +3,7 @@ io.swagger.core.v3 swagger-project - 2.1.12-SNAPSHOT + 2.1.12 ../.. 4.0.0 diff --git a/modules/swagger-core/pom.xml b/modules/swagger-core/pom.xml index ec8e004dbd..0e810c792a 100644 --- a/modules/swagger-core/pom.xml +++ b/modules/swagger-core/pom.xml @@ -3,7 +3,7 @@ io.swagger.core.v3 swagger-project - 2.1.12-SNAPSHOT + 2.1.12 ../.. 4.0.0 diff --git a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml index 865f8a1068..f187270eef 100644 --- a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml +++ b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.12-SNAPSHOT + 2.1.12 ../.. 4.0.0 diff --git a/modules/swagger-gradle-plugin/README.md b/modules/swagger-gradle-plugin/README.md index 47ae43b87a..4befe6defb 100644 --- a/modules/swagger-gradle-plugin/README.md +++ b/modules/swagger-gradle-plugin/README.md @@ -26,7 +26,7 @@ Alternatively provide as value a classpath with the following dependencies (repl ``` plugins { - id "io.swagger.core.v3.swagger-gradle-plugin" version "2.1.11" + id "io.swagger.core.v3.swagger-gradle-plugin" version "2.1.12" } ``` ### Gradle 1.x and 2.0 @@ -43,7 +43,7 @@ buildscript { } } dependencies { - classpath "io.swagger.core.v3:swagger-gradle-plugin:2.1.11" + classpath "io.swagger.core.v3:swagger-gradle-plugin:2.1.12" } } diff --git a/modules/swagger-gradle-plugin/gradle.properties b/modules/swagger-gradle-plugin/gradle.properties index 53ac342041..2aacbbacdd 100644 --- a/modules/swagger-gradle-plugin/gradle.properties +++ b/modules/swagger-gradle-plugin/gradle.properties @@ -1,2 +1,2 @@ -version=2.1.12-SNAPSHOT +version=2.1.12 jettyVersion=9.4.43.v20210629 diff --git a/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java b/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java index 97dae85d81..182a899775 100644 --- a/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java +++ b/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java @@ -16,7 +16,7 @@ public void apply(Project project) { config.defaultDependencies(new Action() { public void execute(DependencySet dependencies) { dependencies.add(project.getDependencies().create("org.apache.commons:commons-lang3:3.7")); - dependencies.add(project.getDependencies().create("io.swagger.core.v3:swagger-jaxrs2:2.1.12-SNAPSHOT")); + dependencies.add(project.getDependencies().create("io.swagger.core.v3:swagger-jaxrs2:2.1.12")); dependencies.add(project.getDependencies().create("javax.ws.rs:javax.ws.rs-api:2.1")); dependencies.add(project.getDependencies().create("javax.servlet:javax.servlet-api:3.1.0")); } diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java index df55df572a..361570e79d 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java @@ -82,7 +82,7 @@ public void testSwaggerResolveTask() throws IOException { " mavenCentral()\n" + "}\n" + "dependencies { \n" + - " compile group: 'io.swagger.core.v3', name: 'swagger-jaxrs2', version:'2.1.12-SNAPSHOT'\n" + + " compile group: 'io.swagger.core.v3', name: 'swagger-jaxrs2', version:'2.1.12'\n" + " compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version:'2.1'\n" + " compile group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'\n" + " testCompile group: 'com.github.tomakehurst', name: 'wiremock', version:'2.27.2'\n" + diff --git a/modules/swagger-integration/pom.xml b/modules/swagger-integration/pom.xml index d048bfa70c..368663fc45 100644 --- a/modules/swagger-integration/pom.xml +++ b/modules/swagger-integration/pom.xml @@ -6,7 +6,7 @@ io.swagger.core.v3 swagger-project - 2.1.12-SNAPSHOT + 2.1.12 ../.. swagger-integration diff --git a/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml b/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml index caf33f0b17..7c672b36df 100644 --- a/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml +++ b/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.12-SNAPSHOT + 2.1.12 ../../ 4.0.0 diff --git a/modules/swagger-jaxrs2-servlet-initializer/pom.xml b/modules/swagger-jaxrs2-servlet-initializer/pom.xml index 9def14025d..36ea206161 100644 --- a/modules/swagger-jaxrs2-servlet-initializer/pom.xml +++ b/modules/swagger-jaxrs2-servlet-initializer/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.12-SNAPSHOT + 2.1.12 ../../ 4.0.0 diff --git a/modules/swagger-jaxrs2/pom.xml b/modules/swagger-jaxrs2/pom.xml index 040a443a4a..4bbc95b0fd 100644 --- a/modules/swagger-jaxrs2/pom.xml +++ b/modules/swagger-jaxrs2/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.12-SNAPSHOT + 2.1.12 ../../ 4.0.0 diff --git a/modules/swagger-maven-plugin/README.md b/modules/swagger-maven-plugin/README.md index 2044b054b8..e842ecece1 100644 --- a/modules/swagger-maven-plugin/README.md +++ b/modules/swagger-maven-plugin/README.md @@ -22,7 +22,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-maven-plugin - 2.1.11 + 2.1.12 openapi ${project.build.directory}/generatedtest @@ -47,7 +47,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-jaxrs2 - 2.1.11 + 2.1.12 @@ -73,7 +73,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-maven-plugin-jakarta - 2.1.11 + 2.1.12 openapi ${project.build.directory}/generatedtest @@ -98,7 +98,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-jaxrs2-jakarta - 2.1.11 + 2.1.12 @@ -126,7 +126,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-maven-plugin - 2.1.11 + 2.1.12 openapi ${project.build.directory}/generatedtest @@ -155,7 +155,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-maven-plugin-jakarta - 2.1.11 + 2.1.12 openapi ${project.build.directory}/generatedtest diff --git a/modules/swagger-maven-plugin/pom.xml b/modules/swagger-maven-plugin/pom.xml index f12290b49d..b1b3f3f369 100644 --- a/modules/swagger-maven-plugin/pom.xml +++ b/modules/swagger-maven-plugin/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.12-SNAPSHOT + 2.1.12 ../.. 4.0.0 diff --git a/modules/swagger-models/pom.xml b/modules/swagger-models/pom.xml index 76f62136f7..4964908813 100644 --- a/modules/swagger-models/pom.xml +++ b/modules/swagger-models/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.12-SNAPSHOT + 2.1.12 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml index b43de48338..00c3347a6f 100644 --- a/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12-SNAPSHOT + 2.1.12 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml index e478eddea4..bf9f151f59 100644 --- a/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12-SNAPSHOT + 2.1.12 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml index 4f6bce64f7..1182ab7cf0 100644 --- a/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12-SNAPSHOT + 2.1.12 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml index 5a58351aed..db1ab10584 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12-SNAPSHOT + 2.1.12 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml index 5fef378f22..f64ccaa11c 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12-SNAPSHOT + 2.1.12 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml index e345d29678..becaf57a37 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12-SNAPSHOT + 2.1.12 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml index 63c5343400..3e18c7f22f 100644 --- a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12-SNAPSHOT + 2.1.12 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml index 152ec5d41a..b2dc405d77 100644 --- a/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12-SNAPSHOT + 2.1.12 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/pom.xml b/modules/swagger-project-jakarta/pom.xml index 1314106c44..44dcb408ca 100644 --- a/modules/swagger-project-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/pom.xml @@ -6,7 +6,7 @@ pom swagger-project-jakarta swagger-project-jakarta - 2.1.12-SNAPSHOT + 2.1.12 https://github.com/swagger-api/swagger-core scm:git:git@github.com:swagger-api/swagger-core.git diff --git a/pom.xml b/pom.xml index b69aefe430..e3c621731b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ pom swagger-project swagger-project - 2.1.12-SNAPSHOT + 2.1.12 https://github.com/swagger-api/swagger-core scm:git:git@github.com:swagger-api/swagger-core.git From b1edeb1ab3e23201c6c82b96e9a4b184380658ab Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 23 Dec 2021 10:50:37 +0000 Subject: [PATCH 13/79] bump snapshot 2.1.13-SNAPSHOT --- modules/swagger-annotations/pom.xml | 2 +- modules/swagger-core/pom.xml | 2 +- modules/swagger-eclipse-transformer-maven-plugin/pom.xml | 2 +- modules/swagger-gradle-plugin/gradle.properties | 2 +- .../main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java | 2 +- .../java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java | 2 +- modules/swagger-integration/pom.xml | 2 +- modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml | 2 +- modules/swagger-jaxrs2-servlet-initializer/pom.xml | 2 +- modules/swagger-jaxrs2/pom.xml | 2 +- modules/swagger-maven-plugin/pom.xml | 2 +- modules/swagger-models/pom.xml | 2 +- .../modules/swagger-annotations-jakarta/pom.xml | 2 +- .../modules/swagger-core-jakarta/pom.xml | 2 +- .../modules/swagger-integration-jakarta/pom.xml | 2 +- .../modules/swagger-jaxrs2-jakarta/pom.xml | 2 +- .../modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml | 2 +- .../swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml | 2 +- .../modules/swagger-maven-plugin-jakarta/pom.xml | 2 +- .../modules/swagger-models-jakarta/pom.xml | 2 +- modules/swagger-project-jakarta/pom.xml | 2 +- pom.xml | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/modules/swagger-annotations/pom.xml b/modules/swagger-annotations/pom.xml index 0ede962e6f..3e86a5b1de 100644 --- a/modules/swagger-annotations/pom.xml +++ b/modules/swagger-annotations/pom.xml @@ -3,7 +3,7 @@ io.swagger.core.v3 swagger-project - 2.1.12 + 2.1.13-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-core/pom.xml b/modules/swagger-core/pom.xml index 0e810c792a..b834bfd6a5 100644 --- a/modules/swagger-core/pom.xml +++ b/modules/swagger-core/pom.xml @@ -3,7 +3,7 @@ io.swagger.core.v3 swagger-project - 2.1.12 + 2.1.13-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml index f187270eef..38adc2f7a0 100644 --- a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml +++ b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.12 + 2.1.13-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-gradle-plugin/gradle.properties b/modules/swagger-gradle-plugin/gradle.properties index 2aacbbacdd..e0cd5b3ea4 100644 --- a/modules/swagger-gradle-plugin/gradle.properties +++ b/modules/swagger-gradle-plugin/gradle.properties @@ -1,2 +1,2 @@ -version=2.1.12 +version=2.1.13-SNAPSHOT jettyVersion=9.4.43.v20210629 diff --git a/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java b/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java index 182a899775..22e60a9b18 100644 --- a/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java +++ b/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java @@ -16,7 +16,7 @@ public void apply(Project project) { config.defaultDependencies(new Action() { public void execute(DependencySet dependencies) { dependencies.add(project.getDependencies().create("org.apache.commons:commons-lang3:3.7")); - dependencies.add(project.getDependencies().create("io.swagger.core.v3:swagger-jaxrs2:2.1.12")); + dependencies.add(project.getDependencies().create("io.swagger.core.v3:swagger-jaxrs2:2.1.13-SNAPSHOT")); dependencies.add(project.getDependencies().create("javax.ws.rs:javax.ws.rs-api:2.1")); dependencies.add(project.getDependencies().create("javax.servlet:javax.servlet-api:3.1.0")); } diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java index 361570e79d..38bf0c1a48 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java @@ -82,7 +82,7 @@ public void testSwaggerResolveTask() throws IOException { " mavenCentral()\n" + "}\n" + "dependencies { \n" + - " compile group: 'io.swagger.core.v3', name: 'swagger-jaxrs2', version:'2.1.12'\n" + + " compile group: 'io.swagger.core.v3', name: 'swagger-jaxrs2', version:'2.1.13-SNAPSHOT'\n" + " compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version:'2.1'\n" + " compile group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'\n" + " testCompile group: 'com.github.tomakehurst', name: 'wiremock', version:'2.27.2'\n" + diff --git a/modules/swagger-integration/pom.xml b/modules/swagger-integration/pom.xml index 368663fc45..0a1ca5b2d6 100644 --- a/modules/swagger-integration/pom.xml +++ b/modules/swagger-integration/pom.xml @@ -6,7 +6,7 @@ io.swagger.core.v3 swagger-project - 2.1.12 + 2.1.13-SNAPSHOT ../.. swagger-integration diff --git a/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml b/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml index 7c672b36df..f329710ee4 100644 --- a/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml +++ b/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.12 + 2.1.13-SNAPSHOT ../../ 4.0.0 diff --git a/modules/swagger-jaxrs2-servlet-initializer/pom.xml b/modules/swagger-jaxrs2-servlet-initializer/pom.xml index 36ea206161..f3c3b57b88 100644 --- a/modules/swagger-jaxrs2-servlet-initializer/pom.xml +++ b/modules/swagger-jaxrs2-servlet-initializer/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.12 + 2.1.13-SNAPSHOT ../../ 4.0.0 diff --git a/modules/swagger-jaxrs2/pom.xml b/modules/swagger-jaxrs2/pom.xml index 4bbc95b0fd..f98ba023b4 100644 --- a/modules/swagger-jaxrs2/pom.xml +++ b/modules/swagger-jaxrs2/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.12 + 2.1.13-SNAPSHOT ../../ 4.0.0 diff --git a/modules/swagger-maven-plugin/pom.xml b/modules/swagger-maven-plugin/pom.xml index b1b3f3f369..5a286e631c 100644 --- a/modules/swagger-maven-plugin/pom.xml +++ b/modules/swagger-maven-plugin/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.12 + 2.1.13-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-models/pom.xml b/modules/swagger-models/pom.xml index 4964908813..5cf1fa7cd3 100644 --- a/modules/swagger-models/pom.xml +++ b/modules/swagger-models/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.12 + 2.1.13-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml index 00c3347a6f..5701d78d97 100644 --- a/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12 + 2.1.13-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml index bf9f151f59..8f2e100ffe 100644 --- a/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12 + 2.1.13-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml index 1182ab7cf0..2a05635a02 100644 --- a/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12 + 2.1.13-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml index db1ab10584..95c12c052e 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12 + 2.1.13-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml index f64ccaa11c..26a84230c2 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12 + 2.1.13-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml index becaf57a37..204af11804 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12 + 2.1.13-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml index 3e18c7f22f..618cb0ac27 100644 --- a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12 + 2.1.13-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml index b2dc405d77..d1de1b88bd 100644 --- a/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.12 + 2.1.13-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/pom.xml b/modules/swagger-project-jakarta/pom.xml index 44dcb408ca..39ba956a84 100644 --- a/modules/swagger-project-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/pom.xml @@ -6,7 +6,7 @@ pom swagger-project-jakarta swagger-project-jakarta - 2.1.12 + 2.1.13-SNAPSHOT https://github.com/swagger-api/swagger-core scm:git:git@github.com:swagger-api/swagger-core.git diff --git a/pom.xml b/pom.xml index e3c621731b..79dbde0d5c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ pom swagger-project swagger-project - 2.1.12 + 2.1.13-SNAPSHOT https://github.com/swagger-api/swagger-core scm:git:git@github.com:swagger-api/swagger-core.git From ac5cfaba34172e635c6c07801f67751437a4c1e6 Mon Sep 17 00:00:00 2001 From: Francesco Tumanischvili Date: Thu, 23 Dec 2021 11:56:55 +0100 Subject: [PATCH 14/79] add latest v2 release to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6e74912bbd..27ef99f413 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ The OpenAPI Specification has undergone several revisions since initial creation Swagger core Version | Release Date | OpenAPI Spec compatibility | Notes | Status ------------------------- |--------------| -------------------------- |-------------------------------------------------------------------------------------------------------------------| ---- +2.1.12 (**current stable**)| 2021-12-23 | 3.0 | [tag v2.1.12](https://github.com/swagger-api/swagger-core/tree/v2.1.12) | Supported 2.1.11 | 2021-09-29 | 3.0 | [tag v2.1.11](https://github.com/swagger-api/swagger-core/tree/v2.1.11) | Supported 2.1.10 | 2021-06-28 | 3.0 | [tag v2.1.10](https://github.com/swagger-api/swagger-core/tree/v2.1.10) | Supported 2.1.9 | 2021-04-20 | 3.0 | [tag v2.1.9](https://github.com/swagger-api/swagger-core/tree/v2.1.9) | Supported From 02b1e771a566b3a9c297625f51a010a873a274b9 Mon Sep 17 00:00:00 2001 From: frantuma Date: Thu, 23 Dec 2021 19:44:25 +0100 Subject: [PATCH 15/79] fix readme compatibility header --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 27ef99f413..5350c5a6ec 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,10 @@ The [github wiki](https://github.com/swagger-api/swagger-core/wiki) contains doc ## Compatibility The OpenAPI Specification has undergone several revisions since initial creation in 2010. The Swagger Core project has the following compatibilities with the OpenAPI Specification: -Swagger core Version | Release Date | OpenAPI Spec compatibility | Notes | Status -------------------------- |--------------| -------------------------- |-------------------------------------------------------------------------------------------------------------------| ---- +Swagger core Version | Release Date | OpenAPI Spec compatibility | Notes | Status +------------------------- | ------------ | -------------------------- | ----- | ---- 2.1.12 (**current stable**)| 2021-12-23 | 3.0 | [tag v2.1.12](https://github.com/swagger-api/swagger-core/tree/v2.1.12) | Supported -2.1.11 | 2021-09-29 | 3.0 | [tag v2.1.11](https://github.com/swagger-api/swagger-core/tree/v2.1.11) | Supported +2.1.11 | 2021-09-29 | 3.0 | [tag v2.1.11](https://github.com/swagger-api/swagger-core/tree/v2.1.11) | Supported** 2.1.10 | 2021-06-28 | 3.0 | [tag v2.1.10](https://github.com/swagger-api/swagger-core/tree/v2.1.10) | Supported 2.1.9 | 2021-04-20 | 3.0 | [tag v2.1.9](https://github.com/swagger-api/swagger-core/tree/v2.1.9) | Supported 2.1.8 | 2021-04-18 | 3.0 | [tag v2.1.8](https://github.com/swagger-api/swagger-core/tree/v2.1.8) | Supported From 06890d4fbd538a702e8ae4a2445cbbdabbb78191 Mon Sep 17 00:00:00 2001 From: frantuma Date: Mon, 24 Jan 2022 11:21:47 +0100 Subject: [PATCH 16/79] refs #4095 - remove jcenter() in gradle plugin --- modules/swagger-gradle-plugin/build.gradle | 4 +--- .../java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java | 2 +- pom.xml | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/swagger-gradle-plugin/build.gradle b/modules/swagger-gradle-plugin/build.gradle index 912187ab36..5f1ccd46ae 100644 --- a/modules/swagger-gradle-plugin/build.gradle +++ b/modules/swagger-gradle-plugin/build.gradle @@ -3,9 +3,8 @@ // * * * * * * * * * * * * plugins { id 'java-gradle-plugin' - id 'net.researchgate.release' version '2.6.0' // Publishing publicly - id 'com.gradle.plugin-publish' version '0.11.0' + id 'com.gradle.plugin-publish' version '0.19.0' // Publishing to maven id 'maven-publish' } @@ -15,7 +14,6 @@ plugins { // * * * * * * * * * * * * repositories { - jcenter() mavenLocal() mavenCentral() } diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java index 38bf0c1a48..03407ec734 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java @@ -77,7 +77,6 @@ public void testSwaggerResolveTask() throws IOException { " }\n" + "}\n" + "repositories {\n" + - " jcenter()\n" + " mavenLocal()\n" + " mavenCentral()\n" + "}\n" + @@ -108,6 +107,7 @@ public void testSwaggerResolveTask() throws IOException { " maven {\n" + " url mavenLocal().url\n" + " }\n" + + " mavenCentral()\n" + " gradlePluginPortal()\n" + " }\n" + "}\n" + diff --git a/pom.xml b/pom.xml index 79dbde0d5c..14c677ae3e 100644 --- a/pom.xml +++ b/pom.xml @@ -620,7 +620,7 @@ 2.1.6 2.3.3 1.2.2 - 5.1.2 + 5.2.0 4.0.3 2.26 4.13.1 From adb433752205a28c2e0f5ed54fe4732ab0e199cf Mon Sep 17 00:00:00 2001 From: frantuma Date: Fri, 4 Feb 2022 09:00:16 +0100 Subject: [PATCH 17/79] implement null example serialization --- .../v3/core/jackson/MediaTypeSerializer.java | 43 +++ .../v3/core/jackson/ModelResolver.java | 4 +- .../v3/core/jackson/SchemaSerializer.java | 15 +- .../v3/core/jackson/mixin/MediaTypeMixin.java | 2 +- .../v3/core/jackson/mixin/SchemaMixin.java | 7 +- .../v3/core/util/ObjectMapperFactory.java | 3 + .../serialization/JsonSerializationTest.java | 19 ++ .../resources/specFiles/null-example.yaml | 260 ++++++++++++++++++ .../specFiles/null-in-schema-example.yaml | 26 ++ .../v3/oas/models/media/ObjectSchema.java | 2 + 10 files changed, 370 insertions(+), 11 deletions(-) create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/MediaTypeSerializer.java create mode 100644 modules/swagger-core/src/test/resources/specFiles/null-example.yaml create mode 100644 modules/swagger-core/src/test/resources/specFiles/null-in-schema-example.yaml diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/MediaTypeSerializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/MediaTypeSerializer.java new file mode 100644 index 0000000000..809261d3e9 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/MediaTypeSerializer.java @@ -0,0 +1,43 @@ +package io.swagger.v3.core.jackson; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.ResolvableSerializer; +import io.swagger.v3.oas.models.media.MediaType; + +import java.io.IOException; + +public class MediaTypeSerializer extends JsonSerializer implements ResolvableSerializer { + + private JsonSerializer defaultSerializer; + + public MediaTypeSerializer(JsonSerializer serializer) { + defaultSerializer = serializer; + } + + @Override + public void resolve(SerializerProvider serializerProvider) throws JsonMappingException { + if (defaultSerializer instanceof ResolvableSerializer) { + ((ResolvableSerializer) defaultSerializer).resolve(serializerProvider); + } + } + + @Override + public void serialize( + MediaType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException { + + if (value.getExampleSetFlag() && value.getExample() == null) { + jgen.writeStartObject(); + defaultSerializer.unwrappingSerializer(null).serialize(value, jgen, provider); + jgen.writeNullField("example"); + jgen.writeEndObject(); + } else { + defaultSerializer.serialize(value, jgen, provider); + } + } +} + + diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java index f2d5fdcf89..3884c6d418 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java @@ -1372,7 +1372,6 @@ private boolean resolveSubtypes(Schema model, BeanDescription bean, ModelConvert .additionalProperties(subtypeModel.getAdditionalProperties()) .description(subtypeModel.getDescription()) .discriminator(subtypeModel.getDiscriminator()) - .example(subtypeModel.getExample()) .exclusiveMaximum(subtypeModel.getExclusiveMaximum()) .exclusiveMinimum(subtypeModel.getExclusiveMinimum()) .externalDocs(subtypeModel.getExternalDocs()) @@ -1398,6 +1397,9 @@ private boolean resolveSubtypes(Schema model, BeanDescription bean, ModelConvert .xml(subtypeModel.getXml()) .extensions(subtypeModel.getExtensions()); + if (subtypeModel.getExample() != null || subtypeModel.getExampleSetFlag()) { + composedSchema.example(subtypeModel.getExample()); + } composedSchema.setEnum(subtypeModel.getEnum()); } else { composedSchema = (ComposedSchema) subtypeModel; diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/SchemaSerializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/SchemaSerializer.java index a0dc7611f2..95ac91c7b2 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/SchemaSerializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/SchemaSerializer.java @@ -30,13 +30,22 @@ public void serialize( Schema value, JsonGenerator jgen, SerializerProvider provider) throws IOException { - // handle ref schema serialization skipping all other props if (StringUtils.isBlank(value.get$ref())) { - defaultSerializer.serialize(value, jgen, provider); + + if (value.getExampleSetFlag() && value.getExample() == null) { + jgen.writeStartObject(); + defaultSerializer.unwrappingSerializer(null).serialize(value, jgen, provider); + jgen.writeNullField("example"); + jgen.writeEndObject(); + } else { + defaultSerializer.serialize(value, jgen, provider); + } + } else { + // handle ref schema serialization skipping all other props jgen.writeStartObject(); jgen.writeStringField("$ref", value.get$ref()); jgen.writeEndObject(); } } -} \ No newline at end of file +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/MediaTypeMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/MediaTypeMixin.java index 1776eb2116..a189022694 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/MediaTypeMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/MediaTypeMixin.java @@ -18,6 +18,6 @@ public abstract class MediaTypeMixin { @JsonIgnore public abstract boolean getExampleSetFlag(); - @JsonInclude(JsonInclude.Include.CUSTOM) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) public abstract Object getExample(); } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java index 26c4dc793e..f1bfb5c578 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java @@ -7,11 +7,6 @@ import java.util.Map; -/* - TODO: this handles deserialization, but not serialization of "explicit" null value (as we are serializing non null fields) - to handle it, a custom schema serializer / JsonFilter / BeanSerializerModifier must be added, using non null for all fields except example where the flag would - be checked to serialize or skip null example field. - */ public abstract class SchemaMixin { @JsonAnyGetter @@ -23,6 +18,6 @@ public abstract class SchemaMixin { @JsonIgnore public abstract boolean getExampleSetFlag(); - @JsonInclude(JsonInclude.Include.CUSTOM) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) public abstract Object getExample(); } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java index ab92655626..561c8f70fd 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java @@ -14,6 +14,7 @@ import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import io.swagger.v3.core.jackson.MediaTypeSerializer; import io.swagger.v3.core.jackson.SchemaSerializer; import io.swagger.v3.core.jackson.mixin.ComponentsMixin; import io.swagger.v3.core.jackson.mixin.DateSchemaMixin; @@ -89,6 +90,8 @@ public JsonSerializer modifySerializer( SerializationConfig config, BeanDescription desc, JsonSerializer serializer) { if (Schema.class.isAssignableFrom(desc.getBeanClass())) { return new SchemaSerializer((JsonSerializer) serializer); + } else if (MediaType.class.isAssignableFrom(desc.getBeanClass())) { + return new MediaTypeSerializer((JsonSerializer) serializer); } return serializer; } diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/JsonSerializationTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/JsonSerializationTest.java index d96854446e..00d2ea0b4f 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/JsonSerializationTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/JsonSerializationTest.java @@ -1,6 +1,9 @@ package io.swagger.v3.core.serialization; +import io.swagger.v3.core.matchers.SerializationMatchers; import io.swagger.v3.core.util.Json; +import io.swagger.v3.core.util.ResourceUtils; +import io.swagger.v3.core.util.Yaml; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.PathItem; @@ -67,4 +70,20 @@ public void testSerializeASpecWithResponseReferences() throws Exception { assertEquals(rebuilt.getPaths().get("/health").getGet().getResponses().get("200"), expectedResponse); } + + @Test + public void testSerializeNullExample() throws Exception { + final String yaml = ResourceUtils.loadClassResource(getClass(), "specFiles/null-example.yaml"); + OpenAPI deser = Yaml.mapper().readValue(yaml, OpenAPI.class); + SerializationMatchers.assertEqualsToYaml(deser, yaml); + + } + + @Test + public void testSerializeNullInSchemaExample() throws Exception { + final String yaml = ResourceUtils.loadClassResource(getClass(), "specFiles/null-in-schema-example.yaml"); + OpenAPI deser = Yaml.mapper().readValue(yaml, OpenAPI.class); + SerializationMatchers.assertEqualsToYaml(deser, yaml); + + } } diff --git a/modules/swagger-core/src/test/resources/specFiles/null-example.yaml b/modules/swagger-core/src/test/resources/specFiles/null-example.yaml new file mode 100644 index 0000000000..81124e714e --- /dev/null +++ b/modules/swagger-core/src/test/resources/specFiles/null-example.yaml @@ -0,0 +1,260 @@ +openapi: 3.0.2 +info: + title: VirtServer support for null examples + version: 1.0.0 +paths: + + /object-with-null-example: + get: + description: Response should be `null` + responses: + '200': + description: Should be `null` + content: + application/json: + schema: + $ref: '#/components/schemas/ObjectWithNullExample' + + /object-with-null-in-schema-example: + get: + description: 'Response should be `{..., "d": null}`' + responses: + '200': + description: 'Should be `{..., "d": null}`' + content: + application/json: + schema: + $ref: '#/components/schemas/ObjectWithNullInSchemaExample' + + /object-with-null-property-example: + get: + description: 'Response should be `{"a": 5, "b": null}`' + responses: + '200': + description: 'Should be `{"a": 5, "b": null}`' + content: + application/json: + schema: + $ref: '#/components/schemas/ObjectWithNullPropertyExample' + + /string-with-null-example: + get: + description: Response should be `null` + responses: + '200': + description: Should be `null` + content: + application/json: + schema: + $ref: '#/components/schemas/StringWithNullExample' + + /array-with-null-array-example: + get: + description: Response should be `null` + responses: + '200': + description: Should be `null` + content: + application/json: + schema: + $ref: '#/components/schemas/ArrayWithNullArrayExample' + + /array-with-null-item-example: + get: + description: Response should be `[null]` + responses: + '200': + description: Should be `[null]` + content: + application/json: + schema: + $ref: '#/components/schemas/ArrayWithNullItemExample' + + /arrey-with-null-in-array-example: + get: + description: Response should be `["foo", null]` + responses: + '200': + description: Should be `["foo", null]` + content: + application/json: + schema: + $ref: '#/components/schemas/ArrayWithNullInArrayExample' + + /object-without-null-example: + get: + description: Response should be `null` + responses: + '200': + description: Should be `null` + content: + application/json: + schema: + $ref: '#/components/schemas/ObjectWithoutNullExample' + + /object-without-null-in-schema-example: + get: + description: 'Response should be `{..., "d": null}`' + responses: + '200': + description: 'Should be `{..., "d": null}`' + content: + application/json: + schema: + $ref: '#/components/schemas/ObjectWithoutNullInSchemaExample' + + /object-without-null-property-example: + get: + description: 'Response should be `{"a": 5, "b": null}`' + responses: + '200': + description: 'Should be `{"a": 5, "b": null}`' + content: + application/json: + schema: + $ref: '#/components/schemas/ObjectWithoutNullPropertyExample' + + /string-without-null-example: + get: + description: Response should be `null` + responses: + '200': + description: Should be `null` + content: + application/json: + schema: + $ref: '#/components/schemas/StringWithoutNullExample' + + /array-without-null-array-example: + get: + description: Response should be `null` + responses: + '200': + description: Should be `null` + content: + application/json: + schema: + $ref: '#/components/schemas/ArrayWithoutNullArrayExample' + + /array-without-null-item-example: + get: + description: Response should be `[null]` + responses: + '200': + description: Should be `[null]` + content: + application/json: + schema: + $ref: '#/components/schemas/ArrayWithoutNullItemExample' + + /arrey-without-null-in-array-example: + get: + description: Response should be `["foo", null]` + responses: + '200': + description: Should be `["foo", null]` + content: + application/json: + schema: + $ref: '#/components/schemas/ArrayWithoutNullInArrayExample' +components: + schemas: + ObjectWithNullExample: + type: object + properties: + foo: + type: string + nullable: true + example: null + + ObjectWithNullInSchemaExample: + type: object + example: + a: 5 + b: test + c: true + d: null + + ObjectWithNullPropertyExample: + type: object + properties: + a: + type: integer + example: 5 + b: + type: string + nullable: true + example: null + + StringWithNullExample: + type: string + nullable: true + example: null + + ArrayWithNullArrayExample: + type: array + items: + type: string + nullable: true + example: null + + ArrayWithNullItemExample: + type: array + items: + type: string + nullable: true + example: null + + ArrayWithNullInArrayExample: + type: array + items: + type: string + nullable: true + example: [foo, null] + + ObjectWithoutNullExample: + type: object + properties: + foo: + type: string + nullable: true + + ObjectWithoutNullInSchemaExample: + type: object + example: + a: 5 + b: test + c: true + + ObjectWithoutNullPropertyExample: + type: object + properties: + a: + type: integer + example: 5 + b: + type: string + nullable: true + + StringWithoutNullExample: + type: string + nullable: true + + ArrayWithoutNullArrayExample: + type: array + items: + type: string + nullable: true + + ArrayWithoutNullItemExample: + type: array + items: + type: string + nullable: true + + ArrayWithoutNullInArrayExample: + type: array + items: + type: string + nullable: true + example: [foo] diff --git a/modules/swagger-core/src/test/resources/specFiles/null-in-schema-example.yaml b/modules/swagger-core/src/test/resources/specFiles/null-in-schema-example.yaml new file mode 100644 index 0000000000..f3c1e92b74 --- /dev/null +++ b/modules/swagger-core/src/test/resources/specFiles/null-in-schema-example.yaml @@ -0,0 +1,26 @@ +openapi: 3.0.2 +info: + title: VirtServer support for null examples + version: 1.0.0 +paths: + + /object-with-null-in-schema-example: + get: + description: 'Response should be `{..., "d": null}`' + responses: + '200': + description: 'Should be `{..., "d": null}`' + content: + application/json: + schema: + $ref: '#/components/schemas/ObjectWithNullInSchemaExample' + +components: + schemas: + ObjectWithNullInSchemaExample: + type: object + example: + a: 5 + b: test + c: true + d: null diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ObjectSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ObjectSchema.java index 48a5ccf692..e00a93ca85 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ObjectSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ObjectSchema.java @@ -38,6 +38,8 @@ public ObjectSchema type(String type) { public ObjectSchema example(Object example) { if (example != null) { super.setExample(example.toString()); + } else { + super.setExample(example); } return this; } From 478179915454e843f056bc766e8855af72423efa Mon Sep 17 00:00:00 2001 From: frantuma Date: Mon, 7 Feb 2022 17:02:53 +0100 Subject: [PATCH 18/79] update dependencies --- modules/swagger-maven-plugin/pom.xml | 2 +- .../modules/swagger-maven-plugin-jakarta/pom.xml | 2 +- modules/swagger-project-jakarta/pom.xml | 14 +++++++------- pom.xml | 14 +++++++------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/swagger-maven-plugin/pom.xml b/modules/swagger-maven-plugin/pom.xml index 5a286e631c..88c981e968 100644 --- a/modules/swagger-maven-plugin/pom.xml +++ b/modules/swagger-maven-plugin/pom.xml @@ -140,7 +140,7 @@ org.apache.commons commons-lang3 - 3.7 + ${commons-lang-version} org.codehaus.plexus diff --git a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml index 618cb0ac27..110250cb3c 100644 --- a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml @@ -152,7 +152,7 @@ org.apache.commons commons-lang3 - 3.7 + ${commons-lang-version} org.codehaus.plexus diff --git a/modules/swagger-project-jakarta/pom.xml b/modules/swagger-project-jakarta/pom.xml index 39ba956a84..c8728e8ca0 100644 --- a/modules/swagger-project-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/pom.xml @@ -554,8 +554,8 @@ 1.9.2 - 2.9.9 - 1.27 + 2.10.13 + 1.30 3.0.0 3.0.0 2.0.0 @@ -565,12 +565,12 @@ 4.13.1 2.12.1 1.2.9 - 4.8.117 - 30.1-jre + 4.8.138 + 31.0.1-jre 1.10.11 - 3.7 - 2.7 - 1.7.25 + 3.12.0 + 2.11.0 + 1.7.35 9.4.43.v20210629 7.3.0 2.28.2 diff --git a/pom.xml b/pom.xml index 14c677ae3e..1185c2355d 100644 --- a/pom.xml +++ b/pom.xml @@ -615,8 +615,8 @@ 1.9.2 - 2.9.9 - 1.27 + 2.10.13 + 1.30 2.1.6 2.3.3 1.2.2 @@ -626,12 +626,12 @@ 4.13.1 2.12.1 1.2.9 - 4.8.117 - 30.1-jre + 4.8.138 + 31.0.1-jre 1.10.11 - 3.7 - 2.7 - 1.7.25 + 3.12.0 + 2.11.0 + 1.7.35 9.4.43.v20210629 7.3.0 2.28.2 From 884ecec245bbebbc48933cdeed2403e3ee102ba5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 7 Feb 2022 16:33:08 +0000 Subject: [PATCH 19/79] prepare release 2.1.13 --- README.md | 5 +++-- modules/swagger-annotations/pom.xml | 2 +- modules/swagger-core/pom.xml | 2 +- .../swagger-eclipse-transformer-maven-plugin/pom.xml | 2 +- modules/swagger-gradle-plugin/README.md | 4 ++-- modules/swagger-gradle-plugin/gradle.properties | 2 +- .../io/swagger/v3/plugins/gradle/SwaggerPlugin.java | 2 +- .../v3/plugins/gradle/SwaggerResolveTest.java | 2 +- modules/swagger-integration/pom.xml | 2 +- .../swagger-jaxrs2-servlet-initializer-v2/pom.xml | 2 +- modules/swagger-jaxrs2-servlet-initializer/pom.xml | 2 +- modules/swagger-jaxrs2/pom.xml | 2 +- modules/swagger-maven-plugin/README.md | 12 ++++++------ modules/swagger-maven-plugin/pom.xml | 2 +- modules/swagger-models/pom.xml | 2 +- .../modules/swagger-annotations-jakarta/pom.xml | 2 +- .../modules/swagger-core-jakarta/pom.xml | 2 +- .../modules/swagger-integration-jakarta/pom.xml | 2 +- .../modules/swagger-jaxrs2-jakarta/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../modules/swagger-maven-plugin-jakarta/pom.xml | 2 +- .../modules/swagger-models-jakarta/pom.xml | 2 +- modules/swagger-project-jakarta/pom.xml | 2 +- pom.xml | 2 +- 25 files changed, 33 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 5350c5a6ec..5e2c27e118 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,8 @@ The OpenAPI Specification has undergone several revisions since initial creation Swagger core Version | Release Date | OpenAPI Spec compatibility | Notes | Status ------------------------- | ------------ | -------------------------- | ----- | ---- -2.1.12 (**current stable**)| 2021-12-23 | 3.0 | [tag v2.1.12](https://github.com/swagger-api/swagger-core/tree/v2.1.12) | Supported +2.1.13 (**current stable**)| 2022-02-07 | 3.0 | [tag v2.1.13](https://github.com/swagger-api/swagger-core/tree/v2.1.13) | Supported +2.1.12 | 2021-12-23 | 3.0 | [tag v2.1.12](https://github.com/swagger-api/swagger-core/tree/v2.1.12) | Supported 2.1.11 | 2021-09-29 | 3.0 | [tag v2.1.11](https://github.com/swagger-api/swagger-core/tree/v2.1.11) | Supported** 2.1.10 | 2021-06-28 | 3.0 | [tag v2.1.10](https://github.com/swagger-api/swagger-core/tree/v2.1.10) | Supported 2.1.9 | 2021-04-20 | 3.0 | [tag v2.1.9](https://github.com/swagger-api/swagger-core/tree/v2.1.9) | Supported @@ -79,7 +80,7 @@ You need the following installed and available in your $PATH: * Jackson 2.4.5 or greater -### To build from source (currently 2.1.13-SNAPSHOT) +### To build from source (currently 2.1.14-SNAPSHOT) ``` # first time building locally mvn -N diff --git a/modules/swagger-annotations/pom.xml b/modules/swagger-annotations/pom.xml index 3e86a5b1de..2a03bb9b2b 100644 --- a/modules/swagger-annotations/pom.xml +++ b/modules/swagger-annotations/pom.xml @@ -3,7 +3,7 @@ io.swagger.core.v3 swagger-project - 2.1.13-SNAPSHOT + 2.1.13 ../.. 4.0.0 diff --git a/modules/swagger-core/pom.xml b/modules/swagger-core/pom.xml index b834bfd6a5..314ed8e519 100644 --- a/modules/swagger-core/pom.xml +++ b/modules/swagger-core/pom.xml @@ -3,7 +3,7 @@ io.swagger.core.v3 swagger-project - 2.1.13-SNAPSHOT + 2.1.13 ../.. 4.0.0 diff --git a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml index 38adc2f7a0..75a269339c 100644 --- a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml +++ b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.13-SNAPSHOT + 2.1.13 ../.. 4.0.0 diff --git a/modules/swagger-gradle-plugin/README.md b/modules/swagger-gradle-plugin/README.md index 4befe6defb..28574bfcac 100644 --- a/modules/swagger-gradle-plugin/README.md +++ b/modules/swagger-gradle-plugin/README.md @@ -26,7 +26,7 @@ Alternatively provide as value a classpath with the following dependencies (repl ``` plugins { - id "io.swagger.core.v3.swagger-gradle-plugin" version "2.1.12" + id "io.swagger.core.v3.swagger-gradle-plugin" version "2.1.13" } ``` ### Gradle 1.x and 2.0 @@ -43,7 +43,7 @@ buildscript { } } dependencies { - classpath "io.swagger.core.v3:swagger-gradle-plugin:2.1.12" + classpath "io.swagger.core.v3:swagger-gradle-plugin:2.1.13" } } diff --git a/modules/swagger-gradle-plugin/gradle.properties b/modules/swagger-gradle-plugin/gradle.properties index e0cd5b3ea4..5d96ac4857 100644 --- a/modules/swagger-gradle-plugin/gradle.properties +++ b/modules/swagger-gradle-plugin/gradle.properties @@ -1,2 +1,2 @@ -version=2.1.13-SNAPSHOT +version=2.1.13 jettyVersion=9.4.43.v20210629 diff --git a/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java b/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java index 22e60a9b18..2187d3eb98 100644 --- a/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java +++ b/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java @@ -16,7 +16,7 @@ public void apply(Project project) { config.defaultDependencies(new Action() { public void execute(DependencySet dependencies) { dependencies.add(project.getDependencies().create("org.apache.commons:commons-lang3:3.7")); - dependencies.add(project.getDependencies().create("io.swagger.core.v3:swagger-jaxrs2:2.1.13-SNAPSHOT")); + dependencies.add(project.getDependencies().create("io.swagger.core.v3:swagger-jaxrs2:2.1.13")); dependencies.add(project.getDependencies().create("javax.ws.rs:javax.ws.rs-api:2.1")); dependencies.add(project.getDependencies().create("javax.servlet:javax.servlet-api:3.1.0")); } diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java index 03407ec734..e6ce7edd90 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java @@ -81,7 +81,7 @@ public void testSwaggerResolveTask() throws IOException { " mavenCentral()\n" + "}\n" + "dependencies { \n" + - " compile group: 'io.swagger.core.v3', name: 'swagger-jaxrs2', version:'2.1.13-SNAPSHOT'\n" + + " compile group: 'io.swagger.core.v3', name: 'swagger-jaxrs2', version:'2.1.13'\n" + " compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version:'2.1'\n" + " compile group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'\n" + " testCompile group: 'com.github.tomakehurst', name: 'wiremock', version:'2.27.2'\n" + diff --git a/modules/swagger-integration/pom.xml b/modules/swagger-integration/pom.xml index 0a1ca5b2d6..cbec9ea913 100644 --- a/modules/swagger-integration/pom.xml +++ b/modules/swagger-integration/pom.xml @@ -6,7 +6,7 @@ io.swagger.core.v3 swagger-project - 2.1.13-SNAPSHOT + 2.1.13 ../.. swagger-integration diff --git a/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml b/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml index f329710ee4..a226c8c670 100644 --- a/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml +++ b/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.13-SNAPSHOT + 2.1.13 ../../ 4.0.0 diff --git a/modules/swagger-jaxrs2-servlet-initializer/pom.xml b/modules/swagger-jaxrs2-servlet-initializer/pom.xml index f3c3b57b88..fdffd60ec5 100644 --- a/modules/swagger-jaxrs2-servlet-initializer/pom.xml +++ b/modules/swagger-jaxrs2-servlet-initializer/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.13-SNAPSHOT + 2.1.13 ../../ 4.0.0 diff --git a/modules/swagger-jaxrs2/pom.xml b/modules/swagger-jaxrs2/pom.xml index f98ba023b4..0affbbbf4e 100644 --- a/modules/swagger-jaxrs2/pom.xml +++ b/modules/swagger-jaxrs2/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.13-SNAPSHOT + 2.1.13 ../../ 4.0.0 diff --git a/modules/swagger-maven-plugin/README.md b/modules/swagger-maven-plugin/README.md index e842ecece1..f552d5368d 100644 --- a/modules/swagger-maven-plugin/README.md +++ b/modules/swagger-maven-plugin/README.md @@ -22,7 +22,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-maven-plugin - 2.1.12 + 2.1.13 openapi ${project.build.directory}/generatedtest @@ -47,7 +47,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-jaxrs2 - 2.1.12 + 2.1.13 @@ -73,7 +73,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-maven-plugin-jakarta - 2.1.12 + 2.1.13 openapi ${project.build.directory}/generatedtest @@ -98,7 +98,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-jaxrs2-jakarta - 2.1.12 + 2.1.13 @@ -126,7 +126,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-maven-plugin - 2.1.12 + 2.1.13 openapi ${project.build.directory}/generatedtest @@ -155,7 +155,7 @@ Both `javax` and `jakarta` examples are provided below io.swagger.core.v3 swagger-maven-plugin-jakarta - 2.1.12 + 2.1.13 openapi ${project.build.directory}/generatedtest diff --git a/modules/swagger-maven-plugin/pom.xml b/modules/swagger-maven-plugin/pom.xml index 88c981e968..7b6537372c 100644 --- a/modules/swagger-maven-plugin/pom.xml +++ b/modules/swagger-maven-plugin/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.13-SNAPSHOT + 2.1.13 ../.. 4.0.0 diff --git a/modules/swagger-models/pom.xml b/modules/swagger-models/pom.xml index 5cf1fa7cd3..dd2d54a92a 100644 --- a/modules/swagger-models/pom.xml +++ b/modules/swagger-models/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.13-SNAPSHOT + 2.1.13 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml index 5701d78d97..25b95e58ee 100644 --- a/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13-SNAPSHOT + 2.1.13 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml index 8f2e100ffe..6107ce0af4 100644 --- a/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13-SNAPSHOT + 2.1.13 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml index 2a05635a02..eb737c52dc 100644 --- a/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13-SNAPSHOT + 2.1.13 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml index 95c12c052e..1522a17b84 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13-SNAPSHOT + 2.1.13 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml index 26a84230c2..88c09bc314 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13-SNAPSHOT + 2.1.13 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml index 204af11804..2d8b2d0442 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13-SNAPSHOT + 2.1.13 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml index 110250cb3c..38dec0191a 100644 --- a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13-SNAPSHOT + 2.1.13 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml index d1de1b88bd..2385d75a0e 100644 --- a/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13-SNAPSHOT + 2.1.13 ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/pom.xml b/modules/swagger-project-jakarta/pom.xml index c8728e8ca0..6a2b2acb2e 100644 --- a/modules/swagger-project-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/pom.xml @@ -6,7 +6,7 @@ pom swagger-project-jakarta swagger-project-jakarta - 2.1.13-SNAPSHOT + 2.1.13 https://github.com/swagger-api/swagger-core scm:git:git@github.com:swagger-api/swagger-core.git diff --git a/pom.xml b/pom.xml index 1185c2355d..b4834620fe 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ pom swagger-project swagger-project - 2.1.13-SNAPSHOT + 2.1.13 https://github.com/swagger-api/swagger-core scm:git:git@github.com:swagger-api/swagger-core.git From 8d50a7912de6c055fa2dcec12e4978984157cb5b Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 7 Feb 2022 17:46:39 +0000 Subject: [PATCH 20/79] bump snapshot 2.1.14-SNAPSHOT --- modules/swagger-annotations/pom.xml | 2 +- modules/swagger-core/pom.xml | 2 +- modules/swagger-eclipse-transformer-maven-plugin/pom.xml | 2 +- modules/swagger-gradle-plugin/gradle.properties | 2 +- .../main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java | 2 +- .../java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java | 2 +- modules/swagger-integration/pom.xml | 2 +- modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml | 2 +- modules/swagger-jaxrs2-servlet-initializer/pom.xml | 2 +- modules/swagger-jaxrs2/pom.xml | 2 +- modules/swagger-maven-plugin/pom.xml | 2 +- modules/swagger-models/pom.xml | 2 +- .../modules/swagger-annotations-jakarta/pom.xml | 2 +- .../modules/swagger-core-jakarta/pom.xml | 2 +- .../modules/swagger-integration-jakarta/pom.xml | 2 +- .../modules/swagger-jaxrs2-jakarta/pom.xml | 2 +- .../modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml | 2 +- .../swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml | 2 +- .../modules/swagger-maven-plugin-jakarta/pom.xml | 2 +- .../modules/swagger-models-jakarta/pom.xml | 2 +- modules/swagger-project-jakarta/pom.xml | 2 +- pom.xml | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/modules/swagger-annotations/pom.xml b/modules/swagger-annotations/pom.xml index 2a03bb9b2b..b7a51bdf7a 100644 --- a/modules/swagger-annotations/pom.xml +++ b/modules/swagger-annotations/pom.xml @@ -3,7 +3,7 @@ io.swagger.core.v3 swagger-project - 2.1.13 + 2.1.14-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-core/pom.xml b/modules/swagger-core/pom.xml index 314ed8e519..f7de61f09f 100644 --- a/modules/swagger-core/pom.xml +++ b/modules/swagger-core/pom.xml @@ -3,7 +3,7 @@ io.swagger.core.v3 swagger-project - 2.1.13 + 2.1.14-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml index 75a269339c..b4097e22ca 100644 --- a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml +++ b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.13 + 2.1.14-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-gradle-plugin/gradle.properties b/modules/swagger-gradle-plugin/gradle.properties index 5d96ac4857..d31f621c50 100644 --- a/modules/swagger-gradle-plugin/gradle.properties +++ b/modules/swagger-gradle-plugin/gradle.properties @@ -1,2 +1,2 @@ -version=2.1.13 +version=2.1.14-SNAPSHOT jettyVersion=9.4.43.v20210629 diff --git a/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java b/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java index 2187d3eb98..bc4d96f75b 100644 --- a/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java +++ b/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java @@ -16,7 +16,7 @@ public void apply(Project project) { config.defaultDependencies(new Action() { public void execute(DependencySet dependencies) { dependencies.add(project.getDependencies().create("org.apache.commons:commons-lang3:3.7")); - dependencies.add(project.getDependencies().create("io.swagger.core.v3:swagger-jaxrs2:2.1.13")); + dependencies.add(project.getDependencies().create("io.swagger.core.v3:swagger-jaxrs2:2.1.14-SNAPSHOT")); dependencies.add(project.getDependencies().create("javax.ws.rs:javax.ws.rs-api:2.1")); dependencies.add(project.getDependencies().create("javax.servlet:javax.servlet-api:3.1.0")); } diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java index e6ce7edd90..387b887aaf 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java @@ -81,7 +81,7 @@ public void testSwaggerResolveTask() throws IOException { " mavenCentral()\n" + "}\n" + "dependencies { \n" + - " compile group: 'io.swagger.core.v3', name: 'swagger-jaxrs2', version:'2.1.13'\n" + + " compile group: 'io.swagger.core.v3', name: 'swagger-jaxrs2', version:'2.1.14-SNAPSHOT'\n" + " compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version:'2.1'\n" + " compile group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'\n" + " testCompile group: 'com.github.tomakehurst', name: 'wiremock', version:'2.27.2'\n" + diff --git a/modules/swagger-integration/pom.xml b/modules/swagger-integration/pom.xml index cbec9ea913..39796cb272 100644 --- a/modules/swagger-integration/pom.xml +++ b/modules/swagger-integration/pom.xml @@ -6,7 +6,7 @@ io.swagger.core.v3 swagger-project - 2.1.13 + 2.1.14-SNAPSHOT ../.. swagger-integration diff --git a/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml b/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml index a226c8c670..365b1dbfbd 100644 --- a/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml +++ b/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.13 + 2.1.14-SNAPSHOT ../../ 4.0.0 diff --git a/modules/swagger-jaxrs2-servlet-initializer/pom.xml b/modules/swagger-jaxrs2-servlet-initializer/pom.xml index fdffd60ec5..b400fd90fd 100644 --- a/modules/swagger-jaxrs2-servlet-initializer/pom.xml +++ b/modules/swagger-jaxrs2-servlet-initializer/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.13 + 2.1.14-SNAPSHOT ../../ 4.0.0 diff --git a/modules/swagger-jaxrs2/pom.xml b/modules/swagger-jaxrs2/pom.xml index 0affbbbf4e..1baaf29c4f 100644 --- a/modules/swagger-jaxrs2/pom.xml +++ b/modules/swagger-jaxrs2/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.13 + 2.1.14-SNAPSHOT ../../ 4.0.0 diff --git a/modules/swagger-maven-plugin/pom.xml b/modules/swagger-maven-plugin/pom.xml index 7b6537372c..50d097d346 100644 --- a/modules/swagger-maven-plugin/pom.xml +++ b/modules/swagger-maven-plugin/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.13 + 2.1.14-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-models/pom.xml b/modules/swagger-models/pom.xml index dd2d54a92a..3fcf82074d 100644 --- a/modules/swagger-models/pom.xml +++ b/modules/swagger-models/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.13 + 2.1.14-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml index 25b95e58ee..19da802b42 100644 --- a/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13 + 2.1.14-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml index 6107ce0af4..6dd67914cd 100644 --- a/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13 + 2.1.14-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml index eb737c52dc..e25228c533 100644 --- a/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13 + 2.1.14-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml index 1522a17b84..d537aa8a3d 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13 + 2.1.14-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml index 88c09bc314..442c93cddc 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13 + 2.1.14-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml index 2d8b2d0442..f79667d5a4 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13 + 2.1.14-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml index 38dec0191a..71c3b55b45 100644 --- a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13 + 2.1.14-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml index 2385d75a0e..f26174a411 100644 --- a/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.13 + 2.1.14-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/pom.xml b/modules/swagger-project-jakarta/pom.xml index 6a2b2acb2e..7d361e6fb9 100644 --- a/modules/swagger-project-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/pom.xml @@ -6,7 +6,7 @@ pom swagger-project-jakarta swagger-project-jakarta - 2.1.13 + 2.1.14-SNAPSHOT https://github.com/swagger-api/swagger-core scm:git:git@github.com:swagger-api/swagger-core.git diff --git a/pom.xml b/pom.xml index b4834620fe..2e1854fdca 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ pom swagger-project swagger-project - 2.1.13 + 2.1.14-SNAPSHOT https://github.com/swagger-api/swagger-core scm:git:git@github.com:swagger-api/swagger-core.git From 35f0e9283915f79e2c3e0cf02967ae3440bda578 Mon Sep 17 00:00:00 2001 From: "whitesource-for-github-com[bot]" <50673670+whitesource-for-github-com[bot]@users.noreply.github.com> Date: Wed, 26 Jan 2022 20:57:38 +0000 Subject: [PATCH 21/79] Migrate .whitesource configuration file to inheritance mode --- .whitesource | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.whitesource b/.whitesource index db4b0fec82..031a010215 100644 --- a/.whitesource +++ b/.whitesource @@ -1,15 +1,3 @@ { - "scanSettings": { - "configMode": "AUTO", - "configExternalURL": "", - "projectToken": "", - "baseBranches": [] - }, - "checkRunSettings": { - "vulnerableCheckRunConclusionLevel": "failure", - "displayMode": "diff" - }, - "issueSettings": { - "minSeverityLevel": "LOW" - } + "settingsInheritedFrom": "swagger-api/whitesource-config@main" } \ No newline at end of file From 0bafd5b227b606f2819ddcf893c29c08010c207d Mon Sep 17 00:00:00 2001 From: Francesco Tumanischvili Date: Mon, 14 Feb 2022 12:31:26 +0100 Subject: [PATCH 22/79] whitesource - set master and 1.5 as base branches --- .whitesource | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.whitesource b/.whitesource index 031a010215..afd38cde04 100644 --- a/.whitesource +++ b/.whitesource @@ -1,3 +1,6 @@ { - "settingsInheritedFrom": "swagger-api/whitesource-config@main" -} \ No newline at end of file + "settingsInheritedFrom": "swagger-api/whitesource-config@main", + "scanSettings": { + "baseBranches": ["master", "1.5"] + } +} From 56c658629adcbda6fa06586de76e4668f21fcc80 Mon Sep 17 00:00:00 2001 From: gracekarina Date: Mon, 21 Feb 2022 10:58:20 -0500 Subject: [PATCH 23/79] add org.owasp dependency --- pom.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pom.xml b/pom.xml index 2e1854fdca..1ab5b0ad4c 100644 --- a/pom.xml +++ b/pom.xml @@ -88,6 +88,21 @@ target ${project.artifactId}-${project.version} + + org.owasp + dependency-check-maven + 6.5.3 + + true + + + + + check + + + + maven-compiler-plugin 3.8.1 From 6ef85fc558c9be6030c7611a61f35153321739e0 Mon Sep 17 00:00:00 2001 From: frantuma Date: Mon, 5 Apr 2021 12:53:38 +0200 Subject: [PATCH 24/79] OpenAPI 3.1 - initial support --- .../annotations/media/PatternProperties.java | 48 +++ .../annotations/media/PatternProperty.java | 66 ++++ .../annotations/media/SchemaProperties.java | 46 +++ .../oas/annotations/media/SchemaProperty.java | 64 ++++ .../v3/core/converter/ModelConverters.java | 9 +- .../v3/core/jackson/CallbackSerializer.java | 5 +- .../v3/core/jackson/ModelResolver.java | 160 ++++++++- .../v3/core/jackson/Schema31Serializer.java | 38 ++ .../v3/core/jackson/mixin/Schema31Mixin.java | 37 ++ .../jackson/mixin/SchemaConverterMixin.java | 36 ++ .../v3/core/jackson/mixin/SchemaMixin.java | 14 + .../core/util/ApiResponses31Deserializer.java | 9 + .../core/util/ApiResponsesDeserializer.java | 15 +- .../v3/core/util/DeserializationModule31.java | 30 ++ .../java/io/swagger/v3/core/util/Json31.java | 72 ++++ .../v3/core/util/Model31Deserializer.java | 22 ++ .../v3/core/util/ObjectMapperFactory.java | 148 ++++++-- .../core/util/OpenAPISchema2JsonSchema.java | 34 ++ .../v3/core/util/Parameter31Deserializer.java | 32 ++ .../v3/core/util/ParameterDeserializer.java | 25 +- .../v3/core/util/Paths31Deserializer.java | 8 + .../v3/core/util/PathsDeserializer.java | 16 +- .../core/util/SecuritySchemeDeserializer.java | 4 + .../java/io/swagger/v3/core/util/Yaml31.java | 62 ++++ .../OpenAPI3_1DeserializationTest.java | 45 +++ .../core/matchers/SerializationMatchers.java | 26 +- .../v31/PatternAndSchemaPropertiesTest.java | 181 ++++++++++ .../resolving/v31/model/AnnotatedPet.java | 109 ++++++ .../AnnotatedPetSinglePatternProperty.java | 93 +++++ .../v3/core/resolving/v31/model/Category.java | 51 +++ .../resolving/v31/model/CustomGenerator.java | 32 ++ .../resolving/v31/model/ExtensionUser.java | 128 +++++++ .../core/resolving/v31/model/JacksonBean.java | 76 ++++ .../v31/model/ListOfStringsBeanParam.java | 17 + .../v31/model/ModelWithJsonIdentity.java | 145 ++++++++ .../model/ModelWithJsonIdentityCyclic.java | 29 ++ .../resolving/v31/model/MultipleBaseBean.java | 11 + .../resolving/v31/model/MultipleSub1Bean.java | 8 + .../resolving/v31/model/MultipleSub2Bean.java | 8 + .../resolving/v31/model/NotFoundModel.java | 30 ++ .../v3/core/resolving/v31/model/Pet.java | 76 ++++ .../v3/core/resolving/v31/model/Tag.java | 44 +++ .../v3/core/resolving/v31/model/User.java | 107 ++++++ .../OpenAPI3_1SerializationTest.java | 335 ++++++++++++++++++ .../specFiles/3.1.0/changelog-3.1.yaml | 137 +++++++ .../specFiles/3.1.0/petstore-3.1.yaml | 124 +++++++ .../integration/GenericOpenApiContext.java | 115 +++++- .../IntegrationObjectMapperFactory.java | 4 + .../oas/integration/SwaggerConfiguration.java | 24 ++ .../integration/api/OpenAPIConfiguration.java | 4 + .../jaxrs2/integration/SortedOutputTest.java | 13 + .../java/io/swagger/v3/oas/OpenAPI30.java | 23 ++ .../java/io/swagger/v3/oas/OpenAPI31.java | 23 ++ .../io/swagger/v3/oas/models/Components.java | 8 + .../io/swagger/v3/oas/models/OpenAPI.java | 40 ++- .../swagger/v3/oas/models/info/License.java | 35 +- .../swagger/v3/oas/models/media/Schema.java | 126 ++++++- .../oas/models/security/SecurityScheme.java | 3 +- 58 files changed, 3169 insertions(+), 61 deletions(-) create mode 100644 modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperties.java create mode 100644 modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperty.java create mode 100644 modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperties.java create mode 100644 modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperty.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/util/ApiResponses31Deserializer.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/util/DeserializationModule31.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/util/Json31.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/util/Model31Deserializer.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/util/OpenAPISchema2JsonSchema.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/util/Parameter31Deserializer.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/util/Paths31Deserializer.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/util/Yaml31.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/PatternAndSchemaPropertiesTest.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/AnnotatedPet.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/AnnotatedPetSinglePatternProperty.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Category.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/CustomGenerator.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ExtensionUser.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/JacksonBean.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ListOfStringsBeanParam.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ModelWithJsonIdentity.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ModelWithJsonIdentityCyclic.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/MultipleBaseBean.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/MultipleSub1Bean.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/MultipleSub2Bean.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/NotFoundModel.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Pet.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Tag.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/User.java create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/OpenAPI3_1SerializationTest.java create mode 100644 modules/swagger-core/src/test/resources/specFiles/3.1.0/changelog-3.1.yaml create mode 100644 modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1.yaml create mode 100644 modules/swagger-models/src/main/java/io/swagger/v3/oas/OpenAPI30.java create mode 100644 modules/swagger-models/src/main/java/io/swagger/v3/oas/OpenAPI31.java diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperties.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperties.java new file mode 100644 index 0000000000..d002806315 --- /dev/null +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperties.java @@ -0,0 +1,48 @@ +/** + * Copyright 2017 SmartBear Software + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.swagger.v3.oas.annotations.media; + +import io.swagger.v3.oas.annotations.responses.ApiResponse; + +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; + +/** + * Container for repeatable {@link PatternProperty} annotation + * + * @see PatternProperty + */ +@Target({FIELD, METHOD, PARAMETER, TYPE, ANNOTATION_TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +public @interface PatternProperties { + /** + * An array of PatternProperty annotations + * + * @return the array of the PatternProperty + **/ + PatternProperty[] value() default {}; + +} diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperty.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperty.java new file mode 100644 index 0000000000..c791ad02a4 --- /dev/null +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperty.java @@ -0,0 +1,66 @@ +/** + * Copyright 2021 SmartBear Software + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.swagger.v3.oas.annotations.media; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Repeatable; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; + +/** + * The annotation may be used in OpenAPI 3.1 schemas / JSON Schema. + * + * @see JSON Schema section 10.3.2.2 + * @see Schema + * + * @since 2.1.8 + **/ +@Target({FIELD, METHOD, PARAMETER, TYPE, ANNOTATION_TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +@Repeatable(PatternProperties.class) +public @interface PatternProperty { + /** + * The regex. + * + * @return the regex + **/ + String regex() default ""; + + /** + * The schema to validate against for properties matching the regex. + * + * @return the schema + **/ + Schema schema() default @Schema(); + + /** + * The schema of the array to validate against for properties matching the regex. + * + * @return the schema of the array + */ + ArraySchema array() default @ArraySchema(); + +} diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperties.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperties.java new file mode 100644 index 0000000000..62ff05b84e --- /dev/null +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperties.java @@ -0,0 +1,46 @@ +/** + * Copyright 2017 SmartBear Software + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.swagger.v3.oas.annotations.media; + +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; + +/** + * Container for repeatable {@link SchemaProperty} annotation + * + * @see SchemaProperty + */ +@Target({FIELD, METHOD, PARAMETER, TYPE, ANNOTATION_TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +public @interface SchemaProperties { + /** + * An array of SchemaProperty annotations + * + * @return the array of the SchemaProperty + **/ + SchemaProperty[] value() default {}; + +} diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperty.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperty.java new file mode 100644 index 0000000000..33dd07617c --- /dev/null +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperty.java @@ -0,0 +1,64 @@ +/** + * Copyright 2021 SmartBear Software + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.swagger.v3.oas.annotations.media; + +import java.lang.annotation.Inherited; +import java.lang.annotation.Repeatable; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; + +/** + * The annotation may be used to define properties for an Object Schema + * + * @see Schema + * + * @since 2.1.8 + **/ +@Target({FIELD, METHOD, PARAMETER, TYPE, ANNOTATION_TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +@Repeatable(SchemaProperties.class) +public @interface SchemaProperty { + /** + * The name. + * + * @return the name + **/ + String name() default ""; + + /** + * The schema of the property. + * + * @return the schema + **/ + Schema schema() default @Schema(); + + /** + * The schema of the array. + * + * @return the schema of the array + */ + ArraySchema array() default @ArraySchema(); + +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/converter/ModelConverters.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/converter/ModelConverters.java index ec479d7505..0cbb130b64 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/converter/ModelConverters.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/converter/ModelConverters.java @@ -97,14 +97,7 @@ public ResolvedSchema readAllAsResolvedSchema(Type type) { } public ResolvedSchema readAllAsResolvedSchema(AnnotatedType type) { if (shouldProcess(type.getType())) { - ModelConverterContextImpl context = new ModelConverterContextImpl( - converters); - - ResolvedSchema resolvedSchema = new ResolvedSchema(); - resolvedSchema.schema = context.resolve(type); - resolvedSchema.referencedSchemas = context.getDefinedModels(); - - return resolvedSchema; + return resolveAsResolvedSchema(type); } return null; } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/CallbackSerializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/CallbackSerializer.java index 374f658bd1..9d3dd5757c 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/CallbackSerializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/CallbackSerializer.java @@ -18,16 +18,19 @@ public void serialize( Callback value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + // has extensions if (value != null && value.getExtensions() != null && !value.getExtensions().isEmpty()) { jgen.writeStartObject(); + // not a ref if (StringUtils.isBlank(value.get$ref())) { if (!value.isEmpty()) { + // write map for (Entry entry: value.entrySet()) { jgen.writeObjectField(entry.getKey() , entry.getValue()); } } - } else { // handle ref schema serialization skipping all other props + } else { // handle ref schema serialization skipping all other props ... jgen.writeStringField("$ref", value.get$ref()); } for (String ext: value.getExtensions().keySet()) { diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java index 3884c6d418..9c10c21676 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java @@ -33,12 +33,18 @@ import io.swagger.v3.core.util.AnnotationsUtils; import io.swagger.v3.core.util.Constants; import io.swagger.v3.core.util.Json; +import io.swagger.v3.core.util.Json31; import io.swagger.v3.core.util.ObjectMapperFactory; +import io.swagger.v3.core.util.OpenAPISchema2JsonSchema; import io.swagger.v3.core.util.OptionalUtils; import io.swagger.v3.core.util.PrimitiveType; import io.swagger.v3.core.util.ReflectionUtils; import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.media.DiscriminatorMapping; +import io.swagger.v3.oas.annotations.media.PatternProperties; +import io.swagger.v3.oas.annotations.media.PatternProperty; +import io.swagger.v3.oas.annotations.media.SchemaProperties; +import io.swagger.v3.oas.annotations.media.SchemaProperty; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.ExternalDocumentation; import io.swagger.v3.oas.models.media.ArraySchema; @@ -95,6 +101,7 @@ import static io.swagger.v3.core.util.RefUtils.constructRef; public class ModelResolver extends AbstractModelConverter implements ModelConverter { + Logger LOGGER = LoggerFactory.getLogger(ModelResolver.class); public static List NOT_NULL_ANNOTATIONS = Arrays.asList("NotNull", "NonNull", "NotBlank", "NotEmpty"); @@ -108,6 +115,11 @@ public class ModelResolver extends AbstractModelConverter implements ModelConver */ public static boolean enumsAsRef = System.getProperty(SET_PROPERTY_OF_ENUMS_AS_REF) != null; + /** + * @since 2.1.8 + */ + protected OpenAPISchema2JsonSchema jsonSchemaProcessor = new OpenAPISchema2JsonSchema(); + public ModelResolver(ObjectMapper mapper) { super(mapper); } @@ -192,11 +204,15 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context if (resolvedSchemaAnnotation != null && StringUtils.isNotEmpty(resolvedSchemaAnnotation.ref())) { if (resolvedArrayAnnotation == null) { + Schema result = new Schema().$ref(resolvedSchemaAnnotation.ref()).name(name); + jsonSchemaProcessor.process(result); return new Schema().$ref(resolvedSchemaAnnotation.ref()).name(name); } else { ArraySchema schema = new ArraySchema(); resolveArraySchema(annotatedType, schema, resolvedArrayAnnotation); - return schema.items(new Schema().$ref(resolvedSchemaAnnotation.ref()).name(name)); + schema.items(new Schema().$ref(resolvedSchemaAnnotation.ref()).name(name)); + jsonSchemaProcessor.process(schema); + return schema; } } @@ -248,6 +264,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context } } schema.setItems(innerSchema); + jsonSchemaProcessor.process(schema); return schema; } else { Schema implSchema = context.resolve(aType); @@ -259,6 +276,9 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context } else if (implSchema != null && implSchema.get$ref() != null) { implSchema = new Schema().$ref(StringUtils.isNotEmpty(implSchema.get$ref()) ? implSchema.get$ref() : implSchema.getName()); } + if (implSchema != null) { + jsonSchemaProcessor.process(implSchema); + } return implSchema; } } @@ -306,6 +326,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context } model = new GeneratorWrapper().processJsonIdentity(annotatedType, context, _mapper, jsonIdentityInfo, jsonIdentityReference); if (model != null) { + jsonSchemaProcessor.process(model); return model; } } @@ -336,14 +357,19 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context ArraySchema schema = new ArraySchema(); resolveArraySchema(annotatedType, schema, resolvedArrayAnnotation); schema.setItems(model); + jsonSchemaProcessor.process(schema); return schema; } if (type.isEnumType() && shouldResolveEnumAsRef(resolvedSchemaAnnotation)) { // Store off the ref and add the enum as a top-level model + jsonSchemaProcessor.process(model); context.defineModel(name, model, annotatedType, null); // Return the model as a ref only property model = new Schema().$ref(Components.COMPONENTS_SCHEMAS_REF + name); } + if (model != null) { + jsonSchemaProcessor.process(model); + } return model; } @@ -362,6 +388,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context Schema resolvedModel = context.resolve(annotatedType); if (resolvedModel != null) { if (name != null && name.equals(resolvedModel.getName())) { + jsonSchemaProcessor.process(resolvedModel); return resolvedModel; } } @@ -379,7 +406,11 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context .propertyName(annotatedType.getPropertyName()) .ctxAnnotations(annotatedType.getCtxAnnotations()) .skipOverride(true); - return context.resolve(aType); + Schema result = context.resolve(aType); + if (result != null) { + jsonSchemaProcessor.process(result); + } + return result; } List> composedSchemaReferencedClasses = getComposedSchemaReferencedClasses(type.getRawClass(), annotatedType.getCtxAnnotations(), resolvedSchemaAnnotation); @@ -495,6 +526,9 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context AnnotatedType aType = OptionalUtils.unwrapOptional(annotatedType); if (aType != null) { model = context.resolve(aType); + if (model != null) { + jsonSchemaProcessor.process(model); + } return model; } else { model = new Schema() @@ -505,6 +539,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context if (!type.isContainerType() && StringUtils.isNotBlank(name)) { // define the model here to support self/cyclic referencing of models + jsonSchemaProcessor.process(model); context.defineModel(name, model, annotatedType, null); } @@ -731,6 +766,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context * available for modification by resolveSubtypes, when their parents are created. */ if (!type.isContainerType() && StringUtils.isNotBlank(name)) { + jsonSchemaProcessor.process(model); context.defineModel(name, model, annotatedType, null); } @@ -766,6 +802,25 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context } } + Map patternProperties = resolvePatternProperties(type, annotatedType.getCtxAnnotations(), context); + if (model != null && patternProperties != null && !patternProperties.isEmpty()) { + if (model.getPatternProperties() == null) { + model.patternProperties(patternProperties); + } else { + model.getPatternProperties().putAll(patternProperties); + } + } + + + Map schemaProperties = resolveSchemaProperties(type, annotatedType.getCtxAnnotations(), context); + if (model != null && schemaProperties != null && !schemaProperties.isEmpty()) { + if (model.getProperties() == null) { + model.properties(schemaProperties); + } else { + model.getProperties().putAll(schemaProperties); + } + } + if (isComposedSchema) { ComposedSchema composedSchema = (ComposedSchema) model; @@ -842,6 +897,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context if (!type.isContainerType() && StringUtils.isNotBlank(name)) { // define the model here to support self/cyclic referencing of models + jsonSchemaProcessor.process(model); context.defineModel(name, model, annotatedType, null); } @@ -861,6 +917,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context ArraySchema schema = new ArraySchema(); schema.setItems(model); resolveArraySchema(annotatedType, schema, resolvedArrayAnnotation); + jsonSchemaProcessor.process(schema); return schema; } else { if (model instanceof ArraySchema) { @@ -1425,6 +1482,7 @@ private boolean resolveSubtypes(Schema model, BeanDescription bean, ModelConvert // replace previous schema.. Class currentType = subtype.getType(); if (StringUtils.isNotBlank(composedSchema.getName())) { + jsonSchemaProcessor.process(composedSchema); context.defineModel(composedSchema.getName(), composedSchema, new AnnotatedType().type(currentType), null); } @@ -1522,6 +1580,104 @@ protected String resolveFormat(Annotated a, Annotation[] annotations, io.swagger return null; } + protected Map resolvePatternProperties(JavaType a, Annotation[] annotations, ModelConverterContext context) { + + final Map propList = new LinkedHashMap<>(); + + PatternProperties props = a.getRawClass().getAnnotation(PatternProperties.class); + if (props != null && props.value().length > 0) { + for (PatternProperty prop: props.value()) { + propList.put(prop.regex(), prop); + } + } + PatternProperty singleProp = a.getRawClass().getAnnotation(PatternProperty.class); + if (singleProp != null) { + propList.put(singleProp.regex(), singleProp); + } + props = AnnotationsUtils.getAnnotation(PatternProperties.class, annotations); + if (props != null && props.value().length > 0) { + for (PatternProperty prop: props.value()) { + propList.put(prop.regex(), prop); + } + } + singleProp = AnnotationsUtils.getAnnotation(PatternProperty.class, annotations); + if (singleProp != null) { + propList.put(singleProp.regex(), singleProp); + } + + if (propList.isEmpty()) { + return null; + } + + Map patternProperties = new LinkedHashMap<>(); + + for (PatternProperty prop: propList.values()) { + String key = prop.regex(); + if (StringUtils.isBlank(key)) { + continue; + } + Annotation[] propAnnotations = new Annotation[]{prop.schema(), prop.array()}; + AnnotatedType propType = new AnnotatedType() + .type(String.class) + .ctxAnnotations(propAnnotations) + .resolveAsRef(true); + Schema resolvedPropSchema = context.resolve(propType); + if (resolvedPropSchema != null) { + patternProperties.put(key, resolvedPropSchema); + } + } + return patternProperties; + } + + protected Map resolveSchemaProperties(JavaType a, Annotation[] annotations, ModelConverterContext context) { + + final Map propList = new LinkedHashMap<>(); + + SchemaProperties props = a.getRawClass().getAnnotation(SchemaProperties.class); + if (props != null && props.value().length > 0) { + for (SchemaProperty prop: props.value()) { + propList.put(prop.name(), prop); + } + } + SchemaProperty singleProp = a.getRawClass().getAnnotation(SchemaProperty.class); + if (singleProp != null) { + propList.put(singleProp.name(), singleProp); + } + props = AnnotationsUtils.getAnnotation(SchemaProperties.class, annotations); + if (props != null && props.value().length > 0) { + for (SchemaProperty prop: props.value()) { + propList.put(prop.name(), prop); + } + } + singleProp = AnnotationsUtils.getAnnotation(SchemaProperty.class, annotations); + if (singleProp != null) { + propList.put(singleProp.name(), singleProp); + } + + if (propList.isEmpty()) { + return null; + } + + Map schemaProperties = new LinkedHashMap<>(); + + for (SchemaProperty prop: propList.values()) { + String key = prop.name(); + if (StringUtils.isBlank(key)) { + continue; + } + Annotation[] propAnnotations = new Annotation[]{prop.schema(), prop.array()}; + AnnotatedType propType = new AnnotatedType() + .type(String.class) + .ctxAnnotations(propAnnotations) + .resolveAsRef(true); + Schema resolvedPropSchema = context.resolve(propType); + if (resolvedPropSchema != null) { + schemaProperties.put(key, resolvedPropSchema); + } + } + return schemaProperties; + } + protected Object resolveDefaultValue(Annotated a, Annotation[] annotations, io.swagger.v3.oas.annotations.media.Schema schema) { if (schema != null) { if (!schema.defaultValue().isEmpty()) { diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java new file mode 100644 index 0000000000..dcac551620 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java @@ -0,0 +1,38 @@ +package io.swagger.v3.core.jackson; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.ResolvableSerializer; +import io.swagger.v3.oas.models.media.Schema; +import org.apache.commons.lang3.StringUtils; + +import java.io.IOException; + +public class Schema31Serializer extends JsonSerializer implements ResolvableSerializer { + + private JsonSerializer defaultSerializer; + + public Schema31Serializer(JsonSerializer serializer) { + defaultSerializer = serializer; + } + + @Override + public void resolve(SerializerProvider serializerProvider) throws JsonMappingException { + if (defaultSerializer instanceof ResolvableSerializer) { + ((ResolvableSerializer) defaultSerializer).resolve(serializerProvider); + } + } + + @Override + public void serialize( + Schema value, JsonGenerator jgen, SerializerProvider provider) + throws IOException { + + // handle ref schema serialization skipping all other props + if (value.getJsonSchema() != null) { + jgen.writeObject(value.getJsonSchema()); + } + } +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java new file mode 100644 index 0000000000..ceb77aaf63 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java @@ -0,0 +1,37 @@ +package io.swagger.v3.core.jackson.mixin; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonValue; + +import java.util.Map; + +public abstract class Schema31Mixin { + + @JsonValue + public abstract Map getJsonSchema(); + + @JsonIgnore + public abstract Boolean getNullable(); + + @JsonIgnore + public abstract Boolean getExclusiveMinimum(); + + @JsonIgnore + public abstract Boolean getExclusiveMaximum(); + + @JsonAnyGetter + public abstract Map getExtensions(); + + @JsonAnySetter + public abstract void addExtension(String name, Object value); + + @JsonIgnore + public abstract boolean getExampleSetFlag(); + + @JsonInclude(JsonInclude.Include.CUSTOM) + public abstract Object getExample(); + +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java new file mode 100644 index 0000000000..cf7a876e2c --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java @@ -0,0 +1,36 @@ +package io.swagger.v3.core.jackson.mixin; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.util.Map; + +public abstract class SchemaConverterMixin { + + @JsonIgnore + public abstract Map getJsonSchema(); + + @JsonIgnore + public abstract Boolean getNullable(); + + @JsonIgnore + public abstract Boolean getExclusiveMinimum(); + + @JsonIgnore + public abstract Boolean getExclusiveMaximum(); + + @JsonAnyGetter + public abstract Map getExtensions(); + + @JsonAnySetter + public abstract void addExtension(String name, Object value); + + @JsonIgnore + public abstract boolean getExampleSetFlag(); + + @JsonInclude(JsonInclude.Include.CUSTOM) + public abstract Object getExample(); + +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java index f1bfb5c578..90b8503dd7 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java @@ -4,7 +4,9 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.models.media.Schema; +import java.math.BigDecimal; import java.util.Map; public abstract class SchemaMixin { @@ -20,4 +22,16 @@ public abstract class SchemaMixin { @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) public abstract Object getExample(); + + @JsonIgnore + public abstract Map getJsonSchema(); + + @JsonIgnore + public abstract BigDecimal getExclusiveMinimumValue(); + + @JsonIgnore + public abstract BigDecimal getExclusiveMaximumValue(); + + @JsonIgnore + public abstract Map getPatternProperties(); } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ApiResponses31Deserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ApiResponses31Deserializer.java new file mode 100644 index 0000000000..c1534dce31 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ApiResponses31Deserializer.java @@ -0,0 +1,9 @@ +package io.swagger.v3.core.util; + +public class ApiResponses31Deserializer extends ApiResponsesDeserializer { + + public ApiResponses31Deserializer() { + this.openapi31 = true; + } + +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ApiResponsesDeserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ApiResponsesDeserializer.java index 1fe6a2ef51..ee7d9012a8 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ApiResponsesDeserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ApiResponsesDeserializer.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.oas.models.responses.ApiResponses; @@ -14,9 +15,19 @@ import java.util.Map; public class ApiResponsesDeserializer extends JsonDeserializer { + + protected boolean openapi31; + @Override public ApiResponses deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + + final ObjectMapper mapper; + if (openapi31) { + mapper = Json31.mapper(); + } else { + mapper = Json.mapper(); + } ApiResponses result = new ApiResponses(); JsonNode node = jp.getCodec().readTree(jp); ObjectNode objectNode = (ObjectNode)node; @@ -26,9 +37,9 @@ public ApiResponses deserialize(JsonParser jp, DeserializationContext ctxt) JsonNode child = objectNode.get(childName); // if name start with `x-` consider it an extesion if (childName.startsWith("x-")) { - extensions.put(childName, Json.mapper().convertValue(child, Object.class)); + extensions.put(childName, mapper.convertValue(child, Object.class)); } else { - result.put(childName, Json.mapper().convertValue(child, ApiResponse.class)); + result.put(childName, mapper.convertValue(child, ApiResponse.class)); } } if (!extensions.isEmpty()) { diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/DeserializationModule31.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/DeserializationModule31.java new file mode 100644 index 0000000000..7177638c17 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/DeserializationModule31.java @@ -0,0 +1,30 @@ +package io.swagger.v3.core.util; + +import com.fasterxml.jackson.databind.module.SimpleModule; +import io.swagger.v3.oas.models.Paths; +import io.swagger.v3.oas.models.callbacks.Callback; +import io.swagger.v3.oas.models.headers.Header; +import io.swagger.v3.oas.models.media.Encoding; +import io.swagger.v3.oas.models.media.EncodingProperty; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.parameters.Parameter; +import io.swagger.v3.oas.models.responses.ApiResponses; +import io.swagger.v3.oas.models.security.SecurityScheme; + +public class DeserializationModule31 extends SimpleModule { + + public DeserializationModule31() { + + this.addDeserializer(Schema.class, new Model31Deserializer()); + this.addDeserializer(Parameter.class, new Parameter31Deserializer()); + this.addDeserializer(Header.StyleEnum.class, new HeaderStyleEnumDeserializer()); + this.addDeserializer(Encoding.StyleEnum.class, new EncodingStyleEnumDeserializer()); + this.addDeserializer(EncodingProperty.StyleEnum.class, new EncodingPropertyStyleEnumDeserializer()); + + this.addDeserializer(SecurityScheme.class, new SecuritySchemeDeserializer()); + + this.addDeserializer(ApiResponses.class, new ApiResponses31Deserializer()); + this.addDeserializer(Paths.class, new Paths31Deserializer()); + this.addDeserializer(Callback.class, new CallbackDeserializer()); + } +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Json31.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Json31.java new file mode 100644 index 0000000000..dad8eeea73 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Json31.java @@ -0,0 +1,72 @@ +package io.swagger.v3.core.util; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import io.swagger.v3.oas.models.media.Schema; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Map; + +public class Json31 { + + private static ObjectMapper mapper; + private static ObjectMapper converterMapper; + + static Logger LOGGER = LoggerFactory.getLogger(Json31.class); + + public static ObjectMapper mapper() { + if (mapper == null) { + mapper = ObjectMapperFactory.createJson31(); + } + return mapper; + } + + public static ObjectMapper converterMapper() { + if (converterMapper == null) { + converterMapper = ObjectMapperFactory.createJsonConverter(); + } + return converterMapper; + } + + public static ObjectWriter pretty() { + return mapper().writer(new DefaultPrettyPrinter()); + } + + public static String pretty(Object o) { + try { + return pretty().writeValueAsString(o); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + public static void prettyPrint(Object o) { + try { + System.out.println(pretty().writeValueAsString(o).replace("\r", "")); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static Map jsonSchemaAsMap(String jsonSchema) { + try { + return mapper().readValue(jsonSchema, Map.class); + } catch (JsonProcessingException e) { + LOGGER.error("Exception converting jsonSchema to Map", e); + return null; + } + } + + public static Map jsonSchemaAsMap(Schema schema) { + try { + return mapper().readValue(mapper().writeValueAsString(schema), Map.class); + } catch (JsonProcessingException e) { + LOGGER.error("Exception converting jsonSchema to Map", e); + return null; + } + } +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Model31Deserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Model31Deserializer.java new file mode 100644 index 0000000000..1caea3b374 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Model31Deserializer.java @@ -0,0 +1,22 @@ +package io.swagger.v3.core.util; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import io.swagger.v3.oas.models.media.Schema; + +import java.io.IOException; +import java.util.Map; + +public class Model31Deserializer extends JsonDeserializer { + @Override + public Schema deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + JsonNode node = jp.getCodec().readTree(jp); + Schema schema = new Schema(); + Map jsonSchema = Json31.mapper().convertValue(node, Map.class); + schema.jsonSchema(jsonSchema); + return schema; + } +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java index 561c8f70fd..ac1105292a 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java @@ -14,6 +14,7 @@ import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import io.swagger.v3.core.jackson.Schema31Serializer; import io.swagger.v3.core.jackson.MediaTypeSerializer; import io.swagger.v3.core.jackson.SchemaSerializer; import io.swagger.v3.core.jackson.mixin.ComponentsMixin; @@ -23,6 +24,8 @@ import io.swagger.v3.core.jackson.mixin.MediaTypeMixin; import io.swagger.v3.core.jackson.mixin.OpenAPIMixin; import io.swagger.v3.core.jackson.mixin.OperationMixin; +import io.swagger.v3.core.jackson.mixin.Schema31Mixin; +import io.swagger.v3.core.jackson.mixin.SchemaConverterMixin; import io.swagger.v3.core.jackson.mixin.SchemaMixin; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.ExternalDocumentation; @@ -63,41 +66,138 @@ public class ObjectMapperFactory { protected static ObjectMapper createJson() { - return create(null); + return create(null, false); } - protected static ObjectMapper createYaml() { + protected static ObjectMapper createYaml(boolean openapi31) { YAMLFactory factory = new YAMLFactory(); factory.disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER); factory.enable(YAMLGenerator.Feature.MINIMIZE_QUOTES); factory.enable(YAMLGenerator.Feature.SPLIT_LINES); factory.enable(YAMLGenerator.Feature.ALWAYS_QUOTE_NUMBERS_AS_STRINGS); - return create(factory); + return create(factory, openapi31); + } + + protected static ObjectMapper createYaml() { + return createYaml(false); + } + + protected static ObjectMapper createJson31() { + return create(null, true); + } + + + protected static ObjectMapper createYaml31() { + return createYaml(true); } - private static ObjectMapper create(JsonFactory jsonFactory) { + private static ObjectMapper create(JsonFactory jsonFactory, boolean openapi31) { ObjectMapper mapper = jsonFactory == null ? new ObjectMapper() : new ObjectMapper(jsonFactory); - // handle ref schema serialization skipping all other props - mapper.registerModule(new SimpleModule() { - @Override - public void setupModule(SetupContext context) { - super.setupModule(context); - context.addBeanSerializerModifier(new BeanSerializerModifier() { - @Override - public JsonSerializer modifySerializer( - SerializationConfig config, BeanDescription desc, JsonSerializer serializer) { - if (Schema.class.isAssignableFrom(desc.getBeanClass())) { - return new SchemaSerializer((JsonSerializer) serializer); - } else if (MediaType.class.isAssignableFrom(desc.getBeanClass())) { - return new MediaTypeSerializer((JsonSerializer) serializer); + if (!openapi31) { + // handle ref schema serialization skipping all other props + mapper.registerModule(new SimpleModule() { + @Override + public void setupModule(SetupContext context) { + super.setupModule(context); + context.addBeanSerializerModifier(new BeanSerializerModifier() { + @Override + public JsonSerializer modifySerializer( + SerializationConfig config, BeanDescription desc, JsonSerializer serializer) { + if (Schema.class.isAssignableFrom(desc.getBeanClass())) { + return new SchemaSerializer((JsonSerializer) serializer); + } + return serializer; + } + }); + } + }); + } else { + mapper.registerModule(new SimpleModule() { + @Override + public void setupModule(SetupContext context) { + super.setupModule(context); + context.addBeanSerializerModifier(new BeanSerializerModifier() { + @Override + public JsonSerializer modifySerializer( + SerializationConfig config, BeanDescription desc, JsonSerializer serializer) { + if (Schema.class.isAssignableFrom(desc.getBeanClass())) { + return new Schema31Serializer((JsonSerializer) serializer); + } else if (MediaType.class.isAssignableFrom(desc.getBeanClass())) { + return new MediaTypeSerializer((JsonSerializer) serializer); + } + return serializer; } - return serializer; - } - }); - } - }); + }); + } + }); + } + + if (!openapi31) { + Module deserializerModule = new DeserializationModule(); + mapper.registerModule(deserializerModule); + } else { + Module deserializerModule = new DeserializationModule31(); + mapper.registerModule(deserializerModule); + } + mapper.registerModule(new JavaTimeModule()); + + Map, Class> sourceMixins = new LinkedHashMap<>(); + + sourceMixins.put(ApiResponses.class, ExtensionsMixin.class); + sourceMixins.put(ApiResponse.class, ExtensionsMixin.class); + sourceMixins.put(Callback.class, ExtensionsMixin.class); + sourceMixins.put(Components.class, ComponentsMixin.class); + sourceMixins.put(Contact.class, ExtensionsMixin.class); + sourceMixins.put(Encoding.class, ExtensionsMixin.class); + sourceMixins.put(EncodingProperty.class, ExtensionsMixin.class); + sourceMixins.put(Example.class, ExtensionsMixin.class); + sourceMixins.put(ExternalDocumentation.class, ExtensionsMixin.class); + sourceMixins.put(Header.class, ExtensionsMixin.class); + sourceMixins.put(Info.class, ExtensionsMixin.class); + sourceMixins.put(License.class, ExtensionsMixin.class); + sourceMixins.put(Link.class, ExtensionsMixin.class); + sourceMixins.put(LinkParameter.class, ExtensionsMixin.class); + sourceMixins.put(MediaType.class, ExtensionsMixin.class); + sourceMixins.put(OAuthFlow.class, ExtensionsMixin.class); + sourceMixins.put(OAuthFlows.class, ExtensionsMixin.class); + sourceMixins.put(OpenAPI.class, OpenAPIMixin.class); + sourceMixins.put(Operation.class, OperationMixin.class); + sourceMixins.put(Parameter.class, ExtensionsMixin.class); + sourceMixins.put(PathItem.class, ExtensionsMixin.class); + sourceMixins.put(Paths.class, ExtensionsMixin.class); + sourceMixins.put(RequestBody.class, ExtensionsMixin.class); + sourceMixins.put(Scopes.class, ExtensionsMixin.class); + sourceMixins.put(SecurityScheme.class, ExtensionsMixin.class); + sourceMixins.put(Server.class, ExtensionsMixin.class); + sourceMixins.put(ServerVariable.class, ExtensionsMixin.class); + sourceMixins.put(ServerVariables.class, ExtensionsMixin.class); + sourceMixins.put(Tag.class, ExtensionsMixin.class); + sourceMixins.put(XML.class, ExtensionsMixin.class); + + if (!openapi31) { + sourceMixins.put(Schema.class, SchemaMixin.class); + sourceMixins.put(DateSchema.class, DateSchemaMixin.class); + } else { + sourceMixins.put(Schema.class, Schema31Mixin.class); + } + mapper.setMixIns(sourceMixins); + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + mapper.configure(SerializationFeature.WRITE_ENUMS_USING_TO_STRING, true); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); + mapper.configure(SerializationFeature.WRITE_BIGDECIMAL_AS_PLAIN, true); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + + return mapper; + } + + protected static ObjectMapper createJsonConverter() { + + ObjectMapper mapper = new ObjectMapper(); + Module deserializerModule = new DeserializationModule(); mapper.registerModule(deserializerModule); @@ -135,9 +235,8 @@ public JsonSerializer modifySerializer( sourceMixins.put(ServerVariables.class, ExtensionsMixin.class); sourceMixins.put(Tag.class, ExtensionsMixin.class); sourceMixins.put(XML.class, ExtensionsMixin.class); - sourceMixins.put(Schema.class, SchemaMixin.class); - sourceMixins.put(DateSchema.class, DateSchemaMixin.class); + sourceMixins.put(Schema.class, SchemaConverterMixin.class); mapper.setMixIns(sourceMixins); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); @@ -150,6 +249,7 @@ public JsonSerializer modifySerializer( return mapper; } + public static ObjectMapper buildStrictGenericObjectMapper() { ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/OpenAPISchema2JsonSchema.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/OpenAPISchema2JsonSchema.java new file mode 100644 index 0000000000..9d4f442d09 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/OpenAPISchema2JsonSchema.java @@ -0,0 +1,34 @@ +package io.swagger.v3.core.util; + +import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.v3.oas.models.media.Schema; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class OpenAPISchema2JsonSchema { + + protected final ObjectMapper converterMapper = Json31.converterMapper(); + + public void process(Schema schema) { + Map jsonSchema = converterMapper.convertValue(schema, Map.class); + + // handle nullable + if (Boolean.TRUE.equals(schema.getNullable())) { + String type = jsonSchema.get("type").toString(); + List newType = new ArrayList<>(); + if (StringUtils.isNotBlank(type)) { + newType.add(type); + } + newType.add("null"); + jsonSchema.put("type", newType); + jsonSchema.remove("nullable"); + } + + // TODO handle other differences + + schema.jsonSchema(jsonSchema); + } +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Parameter31Deserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Parameter31Deserializer.java new file mode 100644 index 0000000000..f14b74188d --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Parameter31Deserializer.java @@ -0,0 +1,32 @@ +package io.swagger.v3.core.util; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import io.swagger.v3.oas.models.parameters.Parameter; +import org.apache.commons.lang3.StringUtils; + +import java.io.IOException; + +public class Parameter31Deserializer extends ParameterDeserializer { + + public Parameter31Deserializer() { + this.openapi31 = true; + } + + @Override + public Parameter deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + + Parameter result = super.deserialize(jp, ctxt); + + if (result != null && StringUtils.isNotBlank(result.get$ref())) { + JsonNode node = jp.getCodec().readTree(jp); + JsonNode desc = node.get("description"); + if (desc != null) { + result.description(desc.asText()); + } + } + return result; + } +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java index 0b7a7dc9c6..387d54bb85 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java @@ -5,16 +5,21 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectReader; import io.swagger.v3.oas.models.parameters.CookieParameter; import io.swagger.v3.oas.models.parameters.HeaderParameter; import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.parameters.PathParameter; import io.swagger.v3.oas.models.parameters.QueryParameter; +import org.apache.commons.lang3.StringUtils; import java.io.IOException; public class ParameterDeserializer extends JsonDeserializer { + + protected boolean openapi31; + @Override public Parameter deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { @@ -23,22 +28,34 @@ public Parameter deserialize(JsonParser jp, DeserializationContext ctxt) JsonNode node = jp.getCodec().readTree(jp); JsonNode sub = node.get("$ref"); JsonNode inNode = node.get("in"); + JsonNode desc = node.get("description"); if (sub != null) { result = new Parameter().$ref(sub.asText()); + if (desc != null) { + result.description(desc.asText()); + } + } else if (inNode != null) { String in = inNode.asText(); ObjectReader reader = null; + ObjectMapper mapper = null; + if (openapi31) { + mapper = Json31.mapper(); + } else { + mapper = Json.mapper(); + } + if ("query".equals(in)) { - reader = Json.mapper().readerFor(QueryParameter.class); + reader = mapper.readerFor(QueryParameter.class); } else if ("header".equals(in)) { - reader = Json.mapper().readerFor(HeaderParameter.class); + reader = mapper.readerFor(HeaderParameter.class); } else if ("path".equals(in)) { - reader = Json.mapper().readerFor(PathParameter.class); + reader = mapper.readerFor(PathParameter.class); } else if ("cookie".equals(in)) { - reader = Json.mapper().readerFor(CookieParameter.class); + reader = mapper.readerFor(CookieParameter.class); } if (reader != null) { result = reader.with(DeserializationFeature.READ_ENUMS_USING_TO_STRING).readValue(node); diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Paths31Deserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Paths31Deserializer.java new file mode 100644 index 0000000000..5463b59e82 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Paths31Deserializer.java @@ -0,0 +1,8 @@ +package io.swagger.v3.core.util; + +public class Paths31Deserializer extends PathsDeserializer { + + public Paths31Deserializer() { + this.openapi31 = true; + } +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/PathsDeserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/PathsDeserializer.java index 7b8e70b3fd..f1738165e7 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/PathsDeserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/PathsDeserializer.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import io.swagger.v3.oas.models.PathItem; import io.swagger.v3.oas.models.Paths; @@ -14,9 +15,20 @@ import java.util.Map; public class PathsDeserializer extends JsonDeserializer { + + protected boolean openapi31; + @Override public Paths deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + + final ObjectMapper mapper; + if (openapi31) { + mapper = Json31.mapper(); + } else { + mapper = Json.mapper(); + } + Paths result = new Paths(); JsonNode node = jp.getCodec().readTree(jp); ObjectNode objectNode = (ObjectNode)node; @@ -26,9 +38,9 @@ public Paths deserialize(JsonParser jp, DeserializationContext ctxt) JsonNode child = objectNode.get(childName); // if name start with `x-` consider it an extesion if (childName.startsWith("x-")) { - extensions.put(childName, Json.mapper().convertValue(child, Object.class)); + extensions.put(childName, mapper.convertValue(child, Object.class)); } else { - result.put(childName, Json.mapper().convertValue(child, PathItem.class)); + result.put(childName, mapper.convertValue(child, PathItem.class)); } } if (!extensions.isEmpty()) { diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecuritySchemeDeserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecuritySchemeDeserializer.java index d773882adc..737dbfe9ed 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecuritySchemeDeserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecuritySchemeDeserializer.java @@ -48,7 +48,11 @@ public SecurityScheme deserialize(JsonParser jp, DeserializationContext ctxt) result .type(SecurityScheme.Type.OAUTH2) .flows(Json.mapper().convertValue(node.get("flows"), OAuthFlows.class)); + } else if ("mutualTLS".equals(type)) { + result + .type(SecurityScheme.Type.MUTUALTLS); } + } return result; diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Yaml31.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Yaml31.java new file mode 100644 index 0000000000..ba16433896 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Yaml31.java @@ -0,0 +1,62 @@ +package io.swagger.v3.core.util; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import io.swagger.v3.oas.models.media.Schema; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Map; + +public class Yaml31 { + static ObjectMapper mapper; + + static Logger LOGGER = LoggerFactory.getLogger(Yaml31.class); + + public static ObjectMapper mapper() { + if (mapper == null) { + mapper = ObjectMapperFactory.createYaml31(); + } + return mapper; + } + + public static ObjectWriter pretty() { + return mapper().writer(new DefaultPrettyPrinter()); + } + + public static String pretty(Object o) { + try { + return pretty().writeValueAsString(o); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + public static void prettyPrint(Object o) { + try { + System.out.println(pretty().writeValueAsString(o)); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static Map jsonSchemaAsMap(String jsonSchema) { + try { + return mapper().readValue(jsonSchema, Map.class); + } catch (JsonProcessingException e) { + LOGGER.error("Exception converting jsonSchema to Map", e); + return null; + } + } + + public static Map jsonSchemaAsMap(Schema schema) { + try { + return mapper().readValue(mapper().writeValueAsString(schema), Map.class); + } catch (JsonProcessingException e) { + LOGGER.error("Exception converting jsonSchema to Map", e); + return null; + } + }} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java new file mode 100644 index 0000000000..6984189c5e --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java @@ -0,0 +1,45 @@ +package io.swagger.v3.core.deserialization; + +import io.swagger.v3.core.matchers.SerializationMatchers; +import io.swagger.v3.core.util.ResourceUtils; +import io.swagger.v3.core.util.Yaml; +import io.swagger.v3.core.util.Yaml31; +import io.swagger.v3.oas.models.OpenAPI; +import org.testng.annotations.Test; + +import java.io.IOException; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; + +public class OpenAPI3_1DeserializationTest { + + @Test + public void deserializePetstore3_1() throws IOException { + + final String jsonString = ResourceUtils.loadClassResource(getClass(), "specFiles/3.1.0/petstore-3.1.yaml"); + final OpenAPI swagger = Yaml31.mapper().readValue(jsonString, OpenAPI.class); + assertNotNull(swagger); + assertEquals(swagger.getInfo().getLicense().getIdentifier(), "test"); + } + + @Test + public void deserializePetstore3_0() throws IOException { + + final String jsonString = ResourceUtils.loadClassResource(getClass(), "specFiles/petstore-3.0.yaml"); + final OpenAPI swagger = Yaml.mapper().readValue(jsonString, OpenAPI.class); + assertNotNull(swagger); + assertEquals(swagger.getInfo().getLicense().getIdentifier(), null); + } + + @Test + public void deserializeChangelog3_1() throws IOException { + + final String jsonString = ResourceUtils.loadClassResource(getClass(), "specFiles/3.1.0/changelog-3.1.yaml"); + final OpenAPI swagger = Yaml31.mapper().readValue(jsonString, OpenAPI.class); + assertNotNull(swagger); + assertEquals(swagger.getInfo().getLicense().getIdentifier(), "test"); + Yaml31.prettyPrint(swagger); + SerializationMatchers.assertEqualsToYaml31(swagger, jsonString); + } +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/matchers/SerializationMatchers.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/matchers/SerializationMatchers.java index 1ccb2f27b9..6d463a20d0 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/matchers/SerializationMatchers.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/matchers/SerializationMatchers.java @@ -5,7 +5,9 @@ import com.fasterxml.jackson.databind.node.NumericNode; import com.fasterxml.jackson.databind.node.ObjectNode; import io.swagger.v3.core.util.Json; +import io.swagger.v3.core.util.Json31; import io.swagger.v3.core.util.Yaml; +import io.swagger.v3.core.util.Yaml31; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,6 +27,14 @@ public static void assertEqualsToJson(Object objectToSerialize, String jsonStr) apply(objectToSerialize, jsonStr, Json.mapper()); } + public static void assertEqualsToYaml31(Object objectToSerialize, String yamlStr) { + apply31(objectToSerialize, yamlStr, Yaml31.mapper()); + } + + public static void assertEqualsToJson31(Object objectToSerialize, String jsonStr) { + apply31(objectToSerialize, jsonStr, Json31.mapper()); + } + private static void apply(Object objectToSerialize, String str, ObjectMapper mapper) { final ObjectNode lhs = mapper.convertValue(objectToSerialize, ObjectNode.class); ObjectNode rhs = null; @@ -39,6 +49,20 @@ private static void apply(Object objectToSerialize, String str, ObjectMapper map } } + private static void apply31(Object objectToSerialize, String str, ObjectMapper mapper) { + final ObjectNode lhs = mapper.convertValue(objectToSerialize, ObjectNode.class); + ObjectNode rhs = null; + try { + rhs = mapper.readValue(str, ObjectNode.class); + } catch (IOException e) { + LOGGER.error("Failed to read value", e); + } + if (!lhs.equals(new ObjectNodeComparator(), rhs)) { + assertEquals(Yaml31.pretty(lhs), Yaml31.pretty(rhs)); + //fail(String.format("Serialized object:\n%s\ndoes not equal to expected serialized string:\n%s", lhs, rhs)); + } + } + static final class ObjectNodeComparator implements Comparator { @Override public int compare(JsonNode o1, JsonNode o2) { @@ -57,4 +81,4 @@ public int compare(JsonNode o1, JsonNode o2) { return comp; } } -} \ No newline at end of file +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/PatternAndSchemaPropertiesTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/PatternAndSchemaPropertiesTest.java new file mode 100644 index 0000000000..9df84b8588 --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/PatternAndSchemaPropertiesTest.java @@ -0,0 +1,181 @@ +package io.swagger.v3.core.resolving.v31; + +import io.swagger.v3.core.converter.AnnotatedType; +import io.swagger.v3.core.converter.ModelConverterContextImpl; +import io.swagger.v3.core.jackson.ModelResolver; +import io.swagger.v3.core.matchers.SerializationMatchers; +import io.swagger.v3.core.resolving.SwaggerTestBase; +import io.swagger.v3.core.resolving.v31.model.AnnotatedPet; +import io.swagger.v3.core.resolving.v31.model.AnnotatedPetSinglePatternProperty; +import io.swagger.v3.oas.models.media.Schema; +import org.testng.annotations.Test; + + +import static org.testng.Assert.assertEquals; + +public class PatternAndSchemaPropertiesTest extends SwaggerTestBase { + + @Test + public void testPatternAndSchemaProperties() throws Exception { + + final ModelResolver modelResolver = new ModelResolver(mapper()); + + ModelConverterContextImpl context = new ModelConverterContextImpl(modelResolver); + + Schema model = context + .resolve(new AnnotatedType(AnnotatedPet.class)); + + assertEquals(((Schema)model.getPatternProperties().get("what.*ever")).getFormat(), "int32"); + assertEquals(((Schema)model.getPatternProperties().get("it.*takes")).get$ref(), "#/components/schemas/Category"); + + assertEquals(((Schema)model.getProperties().get("anotherCategory")).get$ref(), "#/components/schemas/Category"); + assertEquals(((Schema)model.getProperties().get("anotherInteger")).getFormat(), "int32"); + + SerializationMatchers.assertEqualsToYaml(context.getDefinedModels(), "AnnotatedPet:\n" + + " type: object\n" + + " properties:\n" + + " id:\n" + + " type: integer\n" + + " format: int64\n" + + " category:\n" + + " $ref: '#/components/schemas/Category'\n" + + " name:\n" + + " type: string\n" + + " photoUrls:\n" + + " type: array\n" + + " xml:\n" + + " wrapped: true\n" + + " items:\n" + + " type: string\n" + + " xml:\n" + + " name: photoUrl\n" + + " tags:\n" + + " type: array\n" + + " xml:\n" + + " wrapped: true\n" + + " items:\n" + + " $ref: '#/components/schemas/Tag'\n" + + " status:\n" + + " type: string\n" + + " description: pet status in the store\n" + + " enum:\n" + + " - available\n" + + " - pending\n" + + " - sold\n" + + " anotherCategory:\n" + + " $ref: '#/components/schemas/Category'\n" + + " anotherInteger:\n" + + " maximum: 10\n" + + " type: integer\n" + + " description: prop schema 1\n" + + " format: int32\n" + + " description: Annotated Pet\n" + + " nullable: true\n" + + "Category:\n" + + " type: object\n" + + " properties:\n" + + " id:\n" + + " type: integer\n" + + " format: int64\n" + + " name:\n" + + " type: string\n" + + " description: prop schema 2\n" + + " xml:\n" + + " name: Category\n" + + "Tag:\n" + + " type: object\n" + + " properties:\n" + + " id:\n" + + " type: integer\n" + + " format: int64\n" + + " name:\n" + + " type: string\n" + + " xml:\n" + + " name: Tag"); + SerializationMatchers.assertEqualsToYaml31(context.getDefinedModels(), "AnnotatedPet:\n" + + " type:\n" + + " - object\n" + + " - \"null\"\n" + + " properties:\n" + + " id:\n" + + " type: integer\n" + + " format: int64\n" + + " category:\n" + + " $ref: '#/components/schemas/Category'\n" + + " name:\n" + + " type: string\n" + + " photoUrls:\n" + + " type: array\n" + + " xml:\n" + + " wrapped: true\n" + + " items:\n" + + " type: string\n" + + " xml:\n" + + " name: photoUrl\n" + + " tags:\n" + + " type: array\n" + + " xml:\n" + + " wrapped: true\n" + + " items:\n" + + " $ref: '#/components/schemas/Tag'\n" + + " status:\n" + + " type: string\n" + + " description: pet status in the store\n" + + " enum:\n" + + " - available\n" + + " - pending\n" + + " - sold\n" + + " anotherCategory:\n" + + " $ref: '#/components/schemas/Category'\n" + + " anotherInteger:\n" + + " maximum: 10\n" + + " type: integer\n" + + " description: prop schema 1\n" + + " format: int32\n" + + " patternProperties:\n" + + " what.*ever:\n" + + " maximum: 10\n" + + " type: integer\n" + + " description: prop schema 1\n" + + " format: int32\n" + + " it.*takes:\n" + + " $ref: '#/components/schemas/Category'\n" + + " description: Annotated Pet\n" + + "Category:\n" + + " type: object\n" + + " properties:\n" + + " id:\n" + + " type: integer\n" + + " format: int64\n" + + " name:\n" + + " type: string\n" + + " description: prop schema 2\n" + + " xml:\n" + + " name: Category\n" + + "Tag:\n" + + " type: object\n" + + " properties:\n" + + " id:\n" + + " type: integer\n" + + " format: int64\n" + + " name:\n" + + " type: string\n" + + " xml:\n" + + " name: Tag\n"); + } + + @Test + public void testSinglePatternAndSchemaProperties() throws Exception { + + final ModelResolver modelResolver = new ModelResolver(mapper()); + + ModelConverterContextImpl context = new ModelConverterContextImpl(modelResolver); + + Schema model = context + .resolve(new AnnotatedType(AnnotatedPetSinglePatternProperty.class)); + + assertEquals(((Schema)model.getPatternProperties().get("what.*ever")).getFormat(), "int32"); + assertEquals(((Schema)model.getProperties().get("anotherCategory")).get$ref(), "#/components/schemas/Category"); + } + +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/AnnotatedPet.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/AnnotatedPet.java new file mode 100644 index 0000000000..ac6f4e7e8f --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/AnnotatedPet.java @@ -0,0 +1,109 @@ +package io.swagger.v3.core.resolving.v31.model; + +import io.swagger.v3.oas.annotations.media.PatternProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.SchemaProperty; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import java.util.ArrayList; +import java.util.List; + +@Schema(description = "Annotated Pet", nullable = true) +@PatternProperty( + regex = "what.*ever", + schema = @Schema( + type = "integer", + description = "prop schema 1", + format = "int32", + maximum = "10" + ) +) +@PatternProperty( + regex = "it.*takes", + schema = @Schema( + implementation = Category.class, + description = "prop schema 2" + ) +) +@SchemaProperty( + name = "anotherCategory", + schema = @Schema( + implementation = Category.class, + description = "prop schema 2" + ) +) +@SchemaProperty( + name = "anotherInteger", + schema = @Schema( + type = "integer", + description = "prop schema 1", + format = "int32", + maximum = "10" + ) +) +public class AnnotatedPet { + private long id; + private Category category; + private String name; + private List photoUrls = new ArrayList(); + private List tags = new ArrayList(); + private String status; + + @XmlElement(name = "id") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @XmlElement(name = "category") + public Category getCategory() { + return category; + } + + public void setCategory(Category category) { + this.category = category; + } + + @XmlElement(name = "name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @XmlElementWrapper(name = "photoUrls") + @XmlElement(name = "photoUrl") + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + @XmlElementWrapper(name = "tags") + @XmlElement(name = "tag") + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + @XmlElement(name = "status") + @Schema(description = "pet status in the store", allowableValues = {"available", "pending", "sold"}) + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/AnnotatedPetSinglePatternProperty.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/AnnotatedPetSinglePatternProperty.java new file mode 100644 index 0000000000..8e47b5586c --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/AnnotatedPetSinglePatternProperty.java @@ -0,0 +1,93 @@ +package io.swagger.v3.core.resolving.v31.model; + +import io.swagger.v3.oas.annotations.media.PatternProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.SchemaProperty; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import java.util.ArrayList; +import java.util.List; + +@Schema(description = "Annotated Pet", nullable = true) +@PatternProperty( + regex = "what.*ever", + schema = @Schema( + type = "integer", + description = "prop schema 1", + format = "int32", + maximum = "10" + ) +) +@SchemaProperty( + name = "anotherCategory", + schema = @Schema( + implementation = Category.class, + description = "prop schema 2" + ) +) +public class AnnotatedPetSinglePatternProperty { + private long id; + private Category category; + private String name; + private List photoUrls = new ArrayList(); + private List tags = new ArrayList(); + private String status; + + @XmlElement(name = "id") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @XmlElement(name = "category") + public Category getCategory() { + return category; + } + + public void setCategory(Category category) { + this.category = category; + } + + @XmlElement(name = "name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @XmlElementWrapper(name = "photoUrls") + @XmlElement(name = "photoUrl") + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + @XmlElementWrapper(name = "tags") + @XmlElement(name = "tag") + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + @XmlElement(name = "status") + @Schema(description = "pet status in the store", allowableValues = {"available", "pending", "sold"}) + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Category.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Category.java new file mode 100644 index 0000000000..df3c2a5ac0 --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Category.java @@ -0,0 +1,51 @@ +/** + * Copyright 2016 SmartBear Software + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.swagger.v3.core.resolving.v31.model; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "Category") +public class Category { + private long id; + private String name; + + @XmlElement(name = "id") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @XmlElement(name = "name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Category() { + } + + public Category(String name) { + this.name = name; + } +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/CustomGenerator.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/CustomGenerator.java new file mode 100644 index 0000000000..240cc539de --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/CustomGenerator.java @@ -0,0 +1,32 @@ +package io.swagger.v3.core.resolving.v31.model; + +import com.fasterxml.jackson.annotation.ObjectIdGenerator; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + +public class CustomGenerator extends ObjectIdGenerators.PropertyGenerator { + private static final long serialVersionUID = 1L; + + protected CustomGenerator(Class scope) { + super(scope); + } + + @Override + public ObjectIdGenerator forScope(Class scope) { + return null; + } + + @Override + public ObjectIdGenerator newForSerialization(Object context) { + return null; + } + + @Override + public IdKey key(Object key) { + return null; + } + + @Override + public Object generateId(Object forPojo) { + return null; + } +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ExtensionUser.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ExtensionUser.java new file mode 100644 index 0000000000..24647d7e82 --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ExtensionUser.java @@ -0,0 +1,128 @@ +/** + * Copyright 2016 SmartBear Software + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.swagger.v3.core.resolving.v31.model; + +import io.swagger.v3.oas.annotations.extensions.Extension; +import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "User") +@Schema( + description = "User", + extensions = { + @Extension(name = "x-user", properties = { + @ExtensionProperty(name = "name", value = "Josh")}), + @Extension(name = "user-extensions", properties = { + @ExtensionProperty(name = "lastName", value = "Hart"), + @ExtensionProperty(name = "address", value = "House")}) + } +) +public class ExtensionUser { + private long id; + private String username; + private String firstName; + private String lastName; + private String email; + private String password; + private String phone; + private int userStatus; + + @XmlElement(name = "id") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @XmlElement(name = "firstName") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + @XmlElement(name = "username") + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + @XmlElement(name = "lastName") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + @XmlElement(name = "email") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @XmlElement(name = "password") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @XmlElement(name = "phone") + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + @XmlElement(name = "userStatus") + @Schema( + description = "User Status", + extensions = { + @Extension(name = "x-userStatus", properties = { + @ExtensionProperty(name = "name", value = "Josh")}), + @Extension(name = "userStatus-extensions", properties = { + @ExtensionProperty(name = "lastName", value = "Hart"), + @ExtensionProperty(name = "address", value = "House")}) + } + ) + public int getUserStatus() { + return userStatus; + } + + public void setUserStatus(int userStatus) { + this.userStatus = userStatus; + } +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/JacksonBean.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/JacksonBean.java new file mode 100644 index 0000000000..fe8b341124 --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/JacksonBean.java @@ -0,0 +1,76 @@ +package io.swagger.v3.core.resolving.v31.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; + +public class JacksonBean { + + private String id; + private String ignored; + private StringValueBean bean; + private NotFoundModel model; + private NotFoundModel model2; + + @JsonIgnore + public String getIgnored() { + return ignored; + } + + public void setIgnored(String ignored) { + this.ignored = ignored; + } + + public void setId(String id) { + this.id = id; + } + + public void setModel(NotFoundModel model) { + this.model = model; + } + + public StringValueBean getBean() { + return bean; + } + + public void setBean(StringValueBean bean) { + this.bean = bean; + } + + @JsonProperty("identity") + public String getId() { + return id; + } + + @JsonUnwrapped + public NotFoundModel getModel() { + return model; + } + + @JsonUnwrapped(prefix = "pre", suffix = "suf") + public NotFoundModel getModel2() { + return model2; + } + + public void setModel2(NotFoundModel model2) { + this.model2 = model2; + } + + public static class StringValueBean { + + private final String value; + + @JsonCreator + public StringValueBean(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + } + +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ListOfStringsBeanParam.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ListOfStringsBeanParam.java new file mode 100644 index 0000000000..a5a8eb5fc5 --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ListOfStringsBeanParam.java @@ -0,0 +1,17 @@ +package io.swagger.v3.core.resolving.v31.model; + +import javax.ws.rs.QueryParam; +import java.util.List; + +public class ListOfStringsBeanParam { + @QueryParam(value = "listOfStrings") + private List list; + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ModelWithJsonIdentity.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ModelWithJsonIdentity.java new file mode 100644 index 0000000000..ff00051313 --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ModelWithJsonIdentity.java @@ -0,0 +1,145 @@ +package io.swagger.v3.core.resolving.v31.model; + +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.JsonIdentityReference; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + +public class ModelWithJsonIdentity { + + @JsonIdentityReference(alwaysAsId = true) + @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "name") + @JsonProperty("PropertyGeneratorAsId") + public SourceDefinition1 testPropertyGeneratorAsId; + + @JsonIdentityReference(alwaysAsId = false) + @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "name") + @JsonProperty("PropertyGeneratorAsProperty") + public SourceDefinition1 testPropertyGeneratorAsProperty; + + public class SourceDefinition1 { + public String driver; + public String name; + } + + @JsonIdentityReference(alwaysAsId = true) + @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "driverId") + @JsonProperty("ChangedPropertyName") + public SourceDefinition2 testChangedPropertyName; + + @JsonIdentityReference(alwaysAsId = true) + @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "driverId") + @JsonProperty("ChangedPropertyName2") + public SourceDefinition2 testChangedPropertyName2; + + static public class SourceDefinition2 { + @JsonProperty("driverId") + public String driver; + public String name; + } + + @JsonIdentityReference(alwaysAsId = true) + @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class) + @JsonProperty("SourceWithoutPropertyAsId") + public SourceDefinition3 testWithoutPropertyAsId; + + @JsonIdentityReference(alwaysAsId = false) + @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class) + @JsonProperty("SourceWithoutPropertyAsProperty") + public SourceDefinition3 testWithoutPropertyAsProperty; + + public class SourceDefinition3 { + @JsonProperty("driverId") + public String driver; + public String name; + + @JsonProperty("@id") + public String id; + } + + @JsonIdentityReference(alwaysAsId = true) + @JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class, property = "testName1") + @JsonProperty("IntSequenceGeneratorAsId") + public SourceDefinition4 testIntSequenceGeneratorAsId; + + @JsonIdentityReference(alwaysAsId = false) + @JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class, property = "testName2") + @JsonProperty("IntSequenceGeneratorAsProperty") + public SourceDefinition4 testIntSequenceGeneratorAsProperty; + + public class SourceDefinition4 { + public String name; + } + + @JsonIdentityReference(alwaysAsId = true) + @JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class) + @JsonProperty("IntSequenceWithoutPropertyAsId") + public SourceDefinition5 testIntSequenceWithoutPropertyAsId; + + @JsonIdentityReference(alwaysAsId = false) + @JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class) + @JsonProperty("IntSequenceWithoutPropertyAsProperty") + public SourceDefinition5 testIntSequenceWithoutPropertyAsProperty; + + public class SourceDefinition5 { + public String name; + } + + @JsonIdentityReference(alwaysAsId = true) + @JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "UUID1") + @JsonProperty("UUIDGeneratorAsId") + public SourceDefinition6 testUUIDGeneratorAsId; + + @JsonIdentityReference(alwaysAsId = false) + @JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property = "UUID2") + @JsonProperty("UUIDGeneratorAsProperty") + public SourceDefinition6 testUUIDGeneratorAsProperty; + + public class SourceDefinition6 { + public String name; + } + + @JsonIdentityReference(alwaysAsId = true) + @JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class) + @JsonProperty("UUIDGeneratorWithoutPropertyAsId") + public SourceDefinition7 testUUIDGeneratorWithoutPropertyAsId; + + @JsonIdentityReference(alwaysAsId = false) + @JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class) + @JsonProperty("UUIDGeneratorWithoutPropertyAsProperty") + public SourceDefinition7 testUUIDGeneratorWithoutPropertyAsProperty; + + public class SourceDefinition7 { + public String name; + } + + @JsonIdentityReference(alwaysAsId = true) + @JsonIdentityInfo(generator = ObjectIdGenerators.None.class, property = "testGeneratorsNone") + @JsonProperty("GeneratorsNone") + public SourceDefinition8 testGeneratorsNone; + + public class SourceDefinition8 { + @JsonProperty("driverId") + public String driver; + public String name; + } + + @JsonIdentityReference(alwaysAsId = true) + @JsonIdentityInfo(generator = CustomGenerator.class, property = "name") + @JsonProperty("CustomGenerator") + public SourceDefinition9 testCustomGenerator; + + public class SourceDefinition9 { + public String driver; + public String name; + } + + @JsonIdentityInfo(generator = CustomGenerator.class, property = "name") + @JsonProperty("WithoutJsonIdentityReference") + public SourceDefinition10 testWithoutJsonIdentityReference; + + public class SourceDefinition10 { + public String driver; + public String name; + } +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ModelWithJsonIdentityCyclic.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ModelWithJsonIdentityCyclic.java new file mode 100644 index 0000000000..381c2716f7 --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ModelWithJsonIdentityCyclic.java @@ -0,0 +1,29 @@ +package io.swagger.v3.core.resolving.v31.model; + +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.JsonIdentityReference; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + +import java.util.List; + +public class ModelWithJsonIdentityCyclic { + + public Long id; + + public List sourceDefinitions; + + @JsonIdentityInfo( + generator = ObjectIdGenerators.PropertyGenerator.class, + property = "name") + public static class SourceDefinition { + public String driver; + public String name; + + @JsonIdentityReference(alwaysAsId=true) + @JsonIdentityInfo( + generator = ObjectIdGenerators.PropertyGenerator.class, + property = "id") + public ModelWithJsonIdentityCyclic model; + } + +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/MultipleBaseBean.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/MultipleBaseBean.java new file mode 100644 index 0000000000..8d79b293e5 --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/MultipleBaseBean.java @@ -0,0 +1,11 @@ +package io.swagger.v3.core.resolving.v31.model; + +@io.swagger.v3.oas.annotations.media.Schema( + description = "MultipleBaseBean", + subTypes = { MultipleSub1Bean.class, MultipleSub2Bean.class } +) +public class MultipleBaseBean { + public String beanType; + public int a; + public String b; +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/MultipleSub1Bean.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/MultipleSub1Bean.java new file mode 100644 index 0000000000..7637d22609 --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/MultipleSub1Bean.java @@ -0,0 +1,8 @@ +package io.swagger.v3.core.resolving.v31.model; + +@io.swagger.v3.oas.annotations.media.Schema( + description = "MultipleSub1Bean" +) +public class MultipleSub1Bean extends MultipleBaseBean { + public int c; +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/MultipleSub2Bean.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/MultipleSub2Bean.java new file mode 100644 index 0000000000..044320bde9 --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/MultipleSub2Bean.java @@ -0,0 +1,8 @@ +package io.swagger.v3.core.resolving.v31.model; + +@io.swagger.v3.oas.annotations.media.Schema( + description = "MultipleSub2Bean" +) +public class MultipleSub2Bean extends MultipleBaseBean { + public int d; +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/NotFoundModel.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/NotFoundModel.java new file mode 100644 index 0000000000..27619e95f4 --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/NotFoundModel.java @@ -0,0 +1,30 @@ +package io.swagger.v3.core.resolving.v31.model; + +public class NotFoundModel { + int code; + String message; + + public NotFoundModel() { + } + + public NotFoundModel(int code, String message) { + this.code = code; + this.message = message; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Pet.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Pet.java new file mode 100644 index 0000000000..1554a00ddb --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Pet.java @@ -0,0 +1,76 @@ +package io.swagger.v3.core.resolving.v31.model; + +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.ArrayList; +import java.util.List; + +@XmlRootElement(name = "Pet") +public class Pet { + private long id; + private Category category; + private String name; + private List photoUrls = new ArrayList(); + private List tags = new ArrayList(); + private String status; + + @XmlElement(name = "id") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @XmlElement(name = "category") + public Category getCategory() { + return category; + } + + public void setCategory(Category category) { + this.category = category; + } + + @XmlElement(name = "name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @XmlElementWrapper(name = "photoUrls") + @XmlElement(name = "photoUrl") + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + @XmlElementWrapper(name = "tags") + @XmlElement(name = "tag") + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + @XmlElement(name = "status") + @Schema(description = "pet status in the store", allowableValues = {"available", "pending", "sold"}) + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Tag.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Tag.java new file mode 100644 index 0000000000..1d24a79c67 --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Tag.java @@ -0,0 +1,44 @@ +/** + * Copyright 2016 SmartBear Software + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.swagger.v3.core.resolving.v31.model; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "Tag") +public class Tag { + private long id; + private String name; + + @XmlElement(name = "id") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @XmlElement(name = "name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/User.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/User.java new file mode 100644 index 0000000000..27ce93f0d6 --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/User.java @@ -0,0 +1,107 @@ +/** + * Copyright 2016 SmartBear Software + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.swagger.v3.core.resolving.v31.model; + +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "User") +public class User { + private long id; + private String username; + private String firstName; + private String lastName; + private String email; + private String password; + private String phone; + private int userStatus; + + @XmlElement(name = "id") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @XmlElement(name = "firstName") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + @XmlElement(name = "username") + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + @XmlElement(name = "lastName") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + @XmlElement(name = "email") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @XmlElement(name = "password") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @XmlElement(name = "phone") + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + @XmlElement(name = "userStatus") + @Schema(description = "User Status") //, allowableValues = {"1","2","3"}) + public int getUserStatus() { + return userStatus; + } + + public void setUserStatus(int userStatus) { + this.userStatus = userStatus; + } +} 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 new file mode 100644 index 0000000000..40ee7ca1e5 --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/OpenAPI3_1SerializationTest.java @@ -0,0 +1,335 @@ +package io.swagger.v3.core.serialization; + +import io.swagger.v3.core.matchers.SerializationMatchers; +import io.swagger.v3.core.util.Json; +import io.swagger.v3.core.util.ResourceUtils; +import io.swagger.v3.core.util.Yaml; +import io.swagger.v3.oas.models.OpenAPI; +import org.testng.annotations.Test; + +import java.util.Map; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; + +public class OpenAPI3_1SerializationTest { + + @Test + public void testSerializePetstore() throws Exception { + + final String jsonString = ResourceUtils.loadClassResource(getClass(), "specFiles/3.1.0/petstore-3.1.yaml"); + final OpenAPI swagger = Yaml.mapper().readValue(jsonString, OpenAPI.class); + assertNotNull(swagger); + assertEquals(swagger.getInfo().getLicense().getIdentifier(), "test"); + Yaml.prettyPrint(swagger); + Json.prettyPrint(swagger); + + SerializationMatchers.assertEqualsToYaml(swagger, "openapi: 3.1.0\n" + + "info:\n" + + " title: Swagger Petstore\n" + + " license:\n" + + " name: MIT\n" + + " identifier: test\n" + + " version: 1.0.0\n" + + "servers:\n" + + "- url: http://petstore.swagger.io/v1\n" + + "paths:\n" + + " /pets:\n" + + " get:\n" + + " tags:\n" + + " - pets\n" + + " summary: List all pets\n" + + " operationId: listPets\n" + + " parameters:\n" + + " - name: limit\n" + + " in: query\n" + + " description: How many items to return at one time (max 100)\n" + + " required: false\n" + + " schema:\n" + + " type: integer\n" + + " format: int32\n" + + " responses:\n" + + " \"200\":\n" + + " description: An paged array of pets\n" + + " headers:\n" + + " x-next:\n" + + " description: A link to the next page of responses\n" + + " schema:\n" + + " type: string\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " $ref: '#/components/schemas/Pets'\n" + + " default:\n" + + " description: unexpected error\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " $ref: '#/components/schemas/Error'\n" + + " post:\n" + + " tags:\n" + + " - pets\n" + + " summary: Create a pet\n" + + " operationId: createPets\n" + + " responses:\n" + + " \"201\":\n" + + " description: Null response\n" + + " default:\n" + + " description: unexpected error\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " $ref: '#/components/schemas/Error'\n" + + " /pets/{petId}:\n" + + " get:\n" + + " tags:\n" + + " - pets\n" + + " summary: Info for a specific pet\n" + + " operationId: showPetById\n" + + " parameters:\n" + + " - name: petId\n" + + " in: path\n" + + " description: The id of the pet to retrieve\n" + + " required: true\n" + + " schema:\n" + + " type: string\n" + + " responses:\n" + + " \"200\":\n" + + " description: Expected response to a valid request\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " $ref: '#/components/schemas/Pets'\n" + + " default:\n" + + " description: unexpected error\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " $ref: '#/components/schemas/Error'\n" + + "components:\n" + + " schemas:\n" + + " Pet:\n" + + " required:\n" + + " - id\n" + + " - name\n" + + " type: object\n" + + " properties:\n" + + " id:\n" + + " type: integer\n" + + " format: int64\n" + + " name:\n" + + " type: string\n" + + " tag:\n" + + " type: string\n" + + " Pets:\n" + + " type: array\n" + + " items:\n" + + " $ref: '#/components/schemas/Pet'\n" + + " Error:\n" + + " required:\n" + + " - code\n" + + " - message\n" + + " type: object\n" + + " properties:\n" + + " code:\n" + + " type: integer\n" + + " format: int32\n" + + " message:\n" + + " type: string\n" + + "webhooks:\n" + + " newPet:\n" + + " post:\n" + + " requestBody:\n" + + " description: Information about a new pet in the system\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " $ref: '#/components/schemas/Pet'\n" + + " responses:\n" + + " \"200\":\n" + + " description: Return a 200 status to indicate that the data was received\n" + + " successfully"); + SerializationMatchers.assertEqualsToJson(swagger, "{\n" + + " \"openapi\" : \"3.1.0\",\n" + + " \"info\" : {\n" + + " \"title\" : \"Swagger Petstore\",\n" + + " \"license\" : {\n" + + " \"name\" : \"MIT\",\n" + + " \"identifier\" : \"test\"\n" + + " },\n" + + " \"version\" : \"1.0.0\"\n" + + " },\n" + + " \"servers\" : [ {\n" + + " \"url\" : \"http://petstore.swagger.io/v1\"\n" + + " } ],\n" + + " \"paths\" : {\n" + + " \"/pets\" : {\n" + + " \"get\" : {\n" + + " \"tags\" : [ \"pets\" ],\n" + + " \"summary\" : \"List all pets\",\n" + + " \"operationId\" : \"listPets\",\n" + + " \"parameters\" : [ {\n" + + " \"name\" : \"limit\",\n" + + " \"in\" : \"query\",\n" + + " \"description\" : \"How many items to return at one time (max 100)\",\n" + + " \"required\" : false,\n" + + " \"schema\" : {\n" + + " \"type\" : \"integer\",\n" + + " \"format\" : \"int32\"\n" + + " }\n" + + " } ],\n" + + " \"responses\" : {\n" + + " \"200\" : {\n" + + " \"description\" : \"An paged array of pets\",\n" + + " \"headers\" : {\n" + + " \"x-next\" : {\n" + + " \"description\" : \"A link to the next page of responses\",\n" + + " \"schema\" : {\n" + + " \"type\" : \"string\"\n" + + " }\n" + + " }\n" + + " },\n" + + " \"content\" : {\n" + + " \"application/json\" : {\n" + + " \"schema\" : {\n" + + " \"$ref\" : \"#/components/schemas/Pets\"\n" + + " }\n" + + " }\n" + + " }\n" + + " },\n" + + " \"default\" : {\n" + + " \"description\" : \"unexpected error\",\n" + + " \"content\" : {\n" + + " \"application/json\" : {\n" + + " \"schema\" : {\n" + + " \"$ref\" : \"#/components/schemas/Error\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " },\n" + + " \"post\" : {\n" + + " \"tags\" : [ \"pets\" ],\n" + + " \"summary\" : \"Create a pet\",\n" + + " \"operationId\" : \"createPets\",\n" + + " \"responses\" : {\n" + + " \"201\" : {\n" + + " \"description\" : \"Null response\"\n" + + " },\n" + + " \"default\" : {\n" + + " \"description\" : \"unexpected error\",\n" + + " \"content\" : {\n" + + " \"application/json\" : {\n" + + " \"schema\" : {\n" + + " \"$ref\" : \"#/components/schemas/Error\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " },\n" + + " \"/pets/{petId}\" : {\n" + + " \"get\" : {\n" + + " \"tags\" : [ \"pets\" ],\n" + + " \"summary\" : \"Info for a specific pet\",\n" + + " \"operationId\" : \"showPetById\",\n" + + " \"parameters\" : [ {\n" + + " \"name\" : \"petId\",\n" + + " \"in\" : \"path\",\n" + + " \"description\" : \"The id of the pet to retrieve\",\n" + + " \"required\" : true,\n" + + " \"schema\" : {\n" + + " \"type\" : \"string\"\n" + + " }\n" + + " } ],\n" + + " \"responses\" : {\n" + + " \"200\" : {\n" + + " \"description\" : \"Expected response to a valid request\",\n" + + " \"content\" : {\n" + + " \"application/json\" : {\n" + + " \"schema\" : {\n" + + " \"$ref\" : \"#/components/schemas/Pets\"\n" + + " }\n" + + " }\n" + + " }\n" + + " },\n" + + " \"default\" : {\n" + + " \"description\" : \"unexpected error\",\n" + + " \"content\" : {\n" + + " \"application/json\" : {\n" + + " \"schema\" : {\n" + + " \"$ref\" : \"#/components/schemas/Error\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " },\n" + + " \"components\" : {\n" + + " \"schemas\" : {\n" + + " \"Pet\" : {\n" + + " \"required\" : [ \"id\", \"name\" ],\n" + + " \"type\" : \"object\",\n" + + " \"properties\" : {\n" + + " \"id\" : {\n" + + " \"type\" : \"integer\",\n" + + " \"format\" : \"int64\"\n" + + " },\n" + + " \"name\" : {\n" + + " \"type\" : \"string\"\n" + + " },\n" + + " \"tag\" : {\n" + + " \"type\" : \"string\"\n" + + " }\n" + + " }\n" + + " },\n" + + " \"Pets\" : {\n" + + " \"type\" : \"array\",\n" + + " \"items\" : {\n" + + " \"$ref\" : \"#/components/schemas/Pet\"\n" + + " }\n" + + " },\n" + + " \"Error\" : {\n" + + " \"required\" : [ \"code\", \"message\" ],\n" + + " \"type\" : \"object\",\n" + + " \"properties\" : {\n" + + " \"code\" : {\n" + + " \"type\" : \"integer\",\n" + + " \"format\" : \"int32\"\n" + + " },\n" + + " \"message\" : {\n" + + " \"type\" : \"string\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " },\n" + + " \"webhooks\" : {\n" + + " \"newPet\" : {\n" + + " \"post\" : {\n" + + " \"requestBody\" : {\n" + + " \"description\" : \"Information about a new pet in the system\",\n" + + " \"content\" : {\n" + + " \"application/json\" : {\n" + + " \"schema\" : {\n" + + " \"$ref\" : \"#/components/schemas/Pet\"\n" + + " }\n" + + " }\n" + + " }\n" + + " },\n" + + " \"responses\" : {\n" + + " \"200\" : {\n" + + " \"description\" : \"Return a 200 status to indicate that the data was received successfully\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + "}"); + + } +} diff --git a/modules/swagger-core/src/test/resources/specFiles/3.1.0/changelog-3.1.yaml b/modules/swagger-core/src/test/resources/specFiles/3.1.0/changelog-3.1.yaml new file mode 100644 index 0000000000..b241894e96 --- /dev/null +++ b/modules/swagger-core/src/test/resources/specFiles/3.1.0/changelog-3.1.yaml @@ -0,0 +1,137 @@ +openapi: "3.1.0" +info: + version: 1.0.0 + title: Swagger Petstore + license: + name: MIT + identifier: test +servers: + - url: http://petstore.swagger.io/v1 +webhooks: + # Each webhook needs a name + newPet: + # This is a Path Item Object, the only difference is that the request is initiated by the API provider + post: + requestBody: + description: Information about a new pet in the system + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + responses: + "200": + description: Return a 200 status to indicate that the data was received successfully +paths: + /pets: + get: + summary: List all pets + operationId: listPets + tags: + - pets + parameters: + - name: limit + in: query + description: How many items to return at one time (max 100) + required: false + schema: + type: integer + format: int32 + responses: + "200": + description: An paged array of pets + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + content: + application/json: + schema: + $ref: "#/components/schemas/Pets" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + post: + summary: Create a pet + operationId: createPets + tags: + - pets + responses: + "201": + description: Null response + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + /pets/{petId}: + get: + summary: Info for a specific pet + operationId: showPetById + tags: + - pets + parameters: + - name: petId + in: path + required: true + description: The id of the pet to retrieve + schema: + type: string + responses: + "200": + description: Expected response to a valid request + content: + application/json: + schema: + $ref: "#/components/schemas/Pets" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" +components: + schemas: + Pet: + type: + - object + - string + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + testenum: + type: string + enum: + - available + - pending + - sold + default: available + testconst: + type: string + const: pending + tag: + type: string + Pets: + type: array + items: + $ref: "#/components/schemas/Pet" + Error: + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string diff --git a/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1.yaml b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1.yaml new file mode 100644 index 0000000000..3873c550ac --- /dev/null +++ b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1.yaml @@ -0,0 +1,124 @@ +openapi: "3.1.0" +info: + version: 1.0.0 + title: Swagger Petstore + license: + name: MIT + identifier: test +servers: + - url: http://petstore.swagger.io/v1 +webhooks: + # Each webhook needs a name + newPet: + # This is a Path Item Object, the only difference is that the request is initiated by the API provider + post: + requestBody: + description: Information about a new pet in the system + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + responses: + "200": + description: Return a 200 status to indicate that the data was received successfully +paths: + /pets: + get: + summary: List all pets + operationId: listPets + tags: + - pets + parameters: + - name: limit + in: query + description: How many items to return at one time (max 100) + required: false + schema: + type: integer + format: int32 + responses: + "200": + description: An paged array of pets + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + content: + application/json: + schema: + $ref: "#/components/schemas/Pets" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + post: + summary: Create a pet + operationId: createPets + tags: + - pets + responses: + "201": + description: Null response + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + /pets/{petId}: + get: + summary: Info for a specific pet + operationId: showPetById + tags: + - pets + parameters: + - name: petId + in: path + required: true + description: The id of the pet to retrieve + schema: + type: string + responses: + "200": + description: Expected response to a valid request + content: + application/json: + schema: + $ref: "#/components/schemas/Pets" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" +components: + schemas: + Pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string + Pets: + type: array + items: + $ref: "#/components/schemas/Pet" + Error: + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string diff --git a/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/GenericOpenApiContext.java b/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/GenericOpenApiContext.java index 1147189d62..fe9fd6aa8f 100644 --- a/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/GenericOpenApiContext.java +++ b/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/GenericOpenApiContext.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -14,7 +15,9 @@ import io.swagger.v3.core.jackson.ModelResolver; import io.swagger.v3.core.jackson.PathsSerializer; import io.swagger.v3.core.util.Json; +import io.swagger.v3.core.util.Json31; import io.swagger.v3.core.util.Yaml; +import io.swagger.v3.core.util.Yaml31; import io.swagger.v3.oas.integration.api.ObjectMapperProcessor; import io.swagger.v3.oas.integration.api.OpenAPIConfiguration; import io.swagger.v3.oas.integration.api.OpenApiConfigurationLoader; @@ -30,6 +33,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; +import java.math.BigDecimal; import java.util.Arrays; import java.util.HashMap; import java.util.LinkedHashSet; @@ -65,6 +69,8 @@ public class GenericOpenApiContext implements O // -1 perpetual private long cacheTTL = -1; + private Boolean openAPI31; + public long getCacheTTL() { return cacheTTL; } @@ -272,6 +278,28 @@ public final T outputYamlMapper(ObjectMapper outputYamlMapper) { return (T) this; } + /** + * @since 2.1.8 + */ + public Boolean isOpenAPI31() { + return openAPI31; + } + + /** + * @since 2.1.8 + */ + public void setOpenAPI31(Boolean v) { + this.openAPI31 = openAPI31; + } + + /** + * @since 2.1.8 + */ + public T openAPI31(Boolean openAPI31) { + this.openAPI31 = openAPI31; + return (T) this; + } + protected void register() { OpenApiContextLocator.getInstance().putOpenApiContext(id, this); @@ -408,6 +436,7 @@ public T init() throws OpenApiConfigurationException { if (openApiConfiguration == null) { openApiConfiguration = new SwaggerConfiguration().resourcePackages(resourcePackages).resourceClasses(resourceClasses); ((SwaggerConfiguration) openApiConfiguration).setId(id); + ((SwaggerConfiguration) openApiConfiguration).setOpenAPI31(openAPI31); } openApiConfiguration = mergeParentConfiguration(openApiConfiguration, parent); @@ -426,20 +455,35 @@ public T init() throws OpenApiConfigurationException { modelConverters = buildModelConverters(ContextUtils.deepCopy(openApiConfiguration)); } if (outputJsonMapper == null) { - outputJsonMapper = Json.mapper().copy(); + if (Boolean.TRUE.equals(openApiConfiguration.isOpenAPI31())) { + outputJsonMapper = Json31.mapper().copy(); + } else { + outputJsonMapper = Json.mapper().copy(); + } } if (outputYamlMapper == null) { - outputYamlMapper = Yaml.mapper().copy(); + if (Boolean.TRUE.equals(openApiConfiguration.isOpenAPI31())) { + outputYamlMapper = Yaml31.mapper().copy(); + } else { + outputYamlMapper = Yaml.mapper().copy(); + } } if (openApiConfiguration.isSortOutput() != null && openApiConfiguration.isSortOutput()) { outputJsonMapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); outputJsonMapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true); outputYamlMapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); outputYamlMapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true); - outputJsonMapper.addMixIn(OpenAPI.class, SortedOpenAPIMixin.class); - outputJsonMapper.addMixIn(Schema.class, SortedSchemaMixin.class); - outputYamlMapper.addMixIn(OpenAPI.class, SortedOpenAPIMixin.class); - outputYamlMapper.addMixIn(Schema.class, SortedSchemaMixin.class); + if (Boolean.TRUE.equals(openApiConfiguration.isOpenAPI31())) { + outputJsonMapper.addMixIn(OpenAPI.class, SortedOpenAPIMixin31.class); + outputJsonMapper.addMixIn(Schema.class, SortedSchemaMixin31.class); + outputYamlMapper.addMixIn(OpenAPI.class, SortedOpenAPIMixin31.class); + outputYamlMapper.addMixIn(Schema.class, SortedSchemaMixin31.class); + } else { + outputJsonMapper.addMixIn(OpenAPI.class, SortedOpenAPIMixin.class); + outputJsonMapper.addMixIn(Schema.class, SortedSchemaMixin.class); + outputYamlMapper.addMixIn(OpenAPI.class, SortedOpenAPIMixin.class); + outputYamlMapper.addMixIn(Schema.class, SortedSchemaMixin.class); + } } } catch (Exception e) { LOGGER.error("error initializing context: " + e.getMessage(), e); @@ -539,6 +583,9 @@ private OpenAPIConfiguration mergeParentConfiguration(OpenAPIConfiguration confi if (merged.getModelConverterClasses() == null) { merged.setModelConverterClassess(parentConfig.getModelConverterClasses()); } + if (merged.isOpenAPI31() == null) { + merged.setOpenAPI31(parentConfig.isOpenAPI31()); + } return merged; } @@ -611,6 +658,62 @@ static abstract class SortedSchemaMixin { @JsonInclude(JsonInclude.Include.CUSTOM) public abstract Object getExample(); + @JsonIgnore + public abstract Map getJsonSchema(); + + @JsonIgnore + public abstract BigDecimal getExclusiveMinimumValue(); + + @JsonIgnore + public abstract BigDecimal getExclusiveMaximumValue(); + + @JsonIgnore + public abstract Map getPatternProperties(); + + } + + @JsonPropertyOrder(value = {"openapi", "info", "externalDocs", "servers", "security", "tags", "paths", "components", "webhooks"}, alphabetic = true) + static abstract class SortedOpenAPIMixin31 { + + @JsonAnyGetter + @JsonPropertyOrder(alphabetic = true) + public abstract Map getExtensions(); + + @JsonAnySetter + public abstract void addExtension(String name, Object value); + + @JsonSerialize(using = PathsSerializer.class) + public abstract Paths getPaths(); + } + + @JsonPropertyOrder(value = {"type", "format"}, alphabetic = true) + static abstract class SortedSchemaMixin31 { + + @JsonAnyGetter + @JsonPropertyOrder(alphabetic = true) + public abstract Map getExtensions(); + + @JsonAnySetter + public abstract void addExtension(String name, Object value); + + @JsonIgnore + public abstract boolean getExampleSetFlag(); + + @JsonInclude(JsonInclude.Include.CUSTOM) + public abstract Object getExample(); + + @JsonValue + public abstract Map getJsonSchema(); + + @JsonIgnore + public abstract Boolean getNullable(); + + @JsonIgnore + public abstract Boolean getExclusiveMinimum(); + + @JsonIgnore + public abstract Boolean getExclusiveMaximum(); + } } diff --git a/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/IntegrationObjectMapperFactory.java b/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/IntegrationObjectMapperFactory.java index c3ea9d516f..b4a481b911 100644 --- a/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/IntegrationObjectMapperFactory.java +++ b/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/IntegrationObjectMapperFactory.java @@ -8,4 +8,8 @@ public class IntegrationObjectMapperFactory extends ObjectMapperFactory { public static ObjectMapper createJson() { return ObjectMapperFactory.createJson(); } + + public static ObjectMapper createJson31() { + return ObjectMapperFactory.createJson31(); + } } diff --git a/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/SwaggerConfiguration.java b/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/SwaggerConfiguration.java index 7091574270..ce48045b82 100644 --- a/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/SwaggerConfiguration.java +++ b/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/SwaggerConfiguration.java @@ -34,6 +34,8 @@ public class SwaggerConfiguration implements OpenAPIConfiguration { private Boolean alwaysResolveAppPath; + private Boolean openAPI31; + public Long getCacheTTL() { return cacheTTL; } @@ -281,4 +283,26 @@ public SwaggerConfiguration alwaysResolveAppPath(Boolean alwaysResolveAppPath) { setAlwaysResolveAppPath(alwaysResolveAppPath); return this; } + + /** + * @since 2.1.9 + */ + public Boolean isOpenAPI31() { + return openAPI31; + } + + /** + * @since 2.1.9 + */ + public void setOpenAPI31(Boolean v) { + this.openAPI31 = openAPI31; + } + + /** + * @since 2.1.9 + */ + public SwaggerConfiguration openAPI31(Boolean openAPI31) { + this.openAPI31 = openAPI31; + return this; + } } diff --git a/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/api/OpenAPIConfiguration.java b/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/api/OpenAPIConfiguration.java index 8b88cb0541..3c068c0a48 100644 --- a/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/api/OpenAPIConfiguration.java +++ b/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/api/OpenAPIConfiguration.java @@ -49,4 +49,8 @@ public interface OpenAPIConfiguration { */ Boolean isAlwaysResolveAppPath(); + /** + * @since 2.1.9 + */ + Boolean isOpenAPI31(); } diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/integration/SortedOutputTest.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/integration/SortedOutputTest.java index 2bf08c51dd..40b4cc3ac8 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/integration/SortedOutputTest.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/integration/SortedOutputTest.java @@ -27,6 +27,7 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Application; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collections; import java.util.Map; @@ -118,6 +119,18 @@ public static abstract class SortedSchemaMixin { @JsonInclude(JsonInclude.Include.CUSTOM) public abstract Object getExample(); + @JsonIgnore + public abstract Map getJsonSchema(); + + @JsonIgnore + public abstract BigDecimal getExclusiveMinimumValue(); + + @JsonIgnore + public abstract BigDecimal getExclusiveMaximumValue(); + + @JsonIgnore + public abstract Map getPatternProperties(); + } public static class SortedProcessor implements ObjectMapperProcessor { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/OpenAPI30.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/OpenAPI30.java new file mode 100644 index 0000000000..4f952e5f2c --- /dev/null +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/OpenAPI30.java @@ -0,0 +1,23 @@ +/** + * Copyright 2017 SmartBear Software + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.swagger.v3.oas; + +import java.lang.annotation.Inherited; + +@Inherited +public @interface OpenAPI30 { +} diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/OpenAPI31.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/OpenAPI31.java new file mode 100644 index 0000000000..a741f1bd62 --- /dev/null +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/OpenAPI31.java @@ -0,0 +1,23 @@ +/** + * Copyright 2017 SmartBear Software + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.swagger.v3.oas; + +import java.lang.annotation.Inherited; + +@Inherited +public @interface OpenAPI31 { +} diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java index 97355fe914..f989c3e460 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java @@ -336,6 +336,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java index 21054ba4d9..dd4b5d8186 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java @@ -24,7 +24,9 @@ import io.swagger.v3.oas.models.tags.Tag; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.Objects; /** @@ -44,6 +46,11 @@ public class OpenAPI { private Components components = null; private java.util.Map extensions = null; + /** + * @since 2.1.8 (OpenAPI 3.1.0) + */ + private java.util.Map webhooks = null; + /** * returns the openapi property from a OpenAPI instance. * @@ -249,6 +256,35 @@ public OpenAPI schemaRequirement(String name, SecurityScheme securityScheme) { return this; } + /** + * returns the webhooks property from a OpenAPI instance. + * + * @since 2.1.8 (OpenAPI 3.1.0) + * @return Map<String, PathItem> webhooks + **/ + + public Map getWebhooks() { + return webhooks; + } + + public void setWebhooks(Map webhooks) { + this.webhooks = webhooks; + } + + public OpenAPI webhooks(Map webhooks) { + this.webhooks = webhooks; + return this; + } + + public OpenAPI addWebhooks(String key, PathItem pathItem) { + if (this.webhooks == null) { + this.webhooks = new LinkedHashMap<>(); + } + this.webhooks.put(key, pathItem); + return this; + } + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -266,12 +302,13 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.tags, openAPI.tags) && Objects.equals(this.paths, openAPI.paths) && Objects.equals(this.components, openAPI.components) && + Objects.equals(this.webhooks, openAPI.webhooks) && Objects.equals(this.extensions, openAPI.extensions); } @Override public int hashCode() { - return Objects.hash(openapi, info, externalDocs, servers, security, tags, paths, components, extensions); + return Objects.hash(openapi, info, externalDocs, servers, security, tags, paths, components, webhooks, extensions); } public java.util.Map getExtensions() { @@ -310,6 +347,7 @@ public String toString() { sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" paths: ").append(toIndentedString(paths)).append("\n"); sb.append(" components: ").append(toIndentedString(components)).append("\n"); + sb.append(" webhooks: ").append(toIndentedString(webhooks)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java index 0bc59fc0f2..cf62b780a6 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java @@ -16,17 +16,26 @@ package io.swagger.v3.oas.models.info; +import io.swagger.v3.oas.OpenAPI31; + import java.util.Objects; /** * License * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#licenseObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#licenseObject" */ public class License { private String name = null; private String url = null; + + /** + * @since 2.1.8 + */ + @OpenAPI31 + private String identifier = null; private java.util.Map extensions = null; /** @@ -67,8 +76,28 @@ public License url(String url) { return this; } + /** + * returns the identifier property from a License instance. + * + * @since 2.1.8 + * @return String identifier + **/ + @OpenAPI31 + public String getIdentifier() { + return identifier; + } + @OpenAPI31 + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + @OpenAPI31 + public License identifier(String identifier) { + this.identifier = identifier; + return this; + } + @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { if (this == o) { return true; } @@ -78,12 +107,13 @@ public boolean equals(java.lang.Object o) { License license = (License) o; return Objects.equals(this.name, license.name) && Objects.equals(this.url, license.url) && + Objects.equals(this.identifier, license.identifier) && Objects.equals(this.extensions, license.extensions); } @Override public int hashCode() { - return Objects.hash(name, url, extensions); + return Objects.hash(name, url, identifier, extensions); } public java.util.Map getExtensions() { @@ -116,6 +146,7 @@ public String toString() { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); sb.append("}"); return sb.toString(); } 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 e3d9097578..bba0dc4a7a 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 @@ -17,6 +17,8 @@ package io.swagger.v3.oas.models.media; import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.v3.oas.OpenAPI30; +import io.swagger.v3.oas.OpenAPI31; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.ExternalDocumentation; @@ -41,9 +43,15 @@ public class Schema { private String title = null; private BigDecimal multipleOf = null; private BigDecimal maximum = null; + @OpenAPI30 private Boolean exclusiveMaximum = null; + @OpenAPI31 + private BigDecimal exclusiveMaximumValue = null; private BigDecimal minimum = null; + @OpenAPI30 private Boolean exclusiveMinimum = null; + @OpenAPI31 + private BigDecimal exclusiveMinimumValue = null; private Integer maxLength = null; private Integer minLength = null; private String pattern = null; @@ -56,10 +64,13 @@ public class Schema { private String type = null; private Schema not = null; private Map properties = null; + @OpenAPI31 + private Map patternProperties = null; private Object additionalProperties = null; private String description = null; private String format = null; private String $ref = null; + @OpenAPI30 private Boolean nullable = null; private Boolean readOnly = null; private Boolean writeOnly = null; @@ -73,6 +84,25 @@ public class Schema { private boolean exampleSetFlag; + @OpenAPI31 + protected Map jsonSchema = null; + + @OpenAPI31 + public Map getJsonSchema() { + return jsonSchema; + } + + @OpenAPI31 + public void setJsonSchema(Map jsonSchema) { + this.jsonSchema = jsonSchema; + } + + @OpenAPI31 + public Schema jsonSchema(Map jsonSchema) { + this.jsonSchema = jsonSchema; + return this; + } + public Schema() { } @@ -213,24 +243,49 @@ public Schema maximum(BigDecimal maximum) { } /** - * returns the exclusiveMaximum property from a Schema instance. + * returns the exclusiveMaximum property from a Schema instance for OpenAPI 3.0.x * * @return Boolean exclusiveMaximum **/ - + @OpenAPI30 public Boolean getExclusiveMaximum() { return exclusiveMaximum; } + @OpenAPI30 public void setExclusiveMaximum(Boolean exclusiveMaximum) { this.exclusiveMaximum = exclusiveMaximum; } + @OpenAPI30 public Schema exclusiveMaximum(Boolean exclusiveMaximum) { this.exclusiveMaximum = exclusiveMaximum; return this; } + /** + * returns the exclusiveMaximumValue property from a Schema instance for OpenAPI 3.1.x + * + * @since 2.1.8 + * @return BigDecimal exclusiveMaximumValue + * + **/ + @OpenAPI31 + public BigDecimal getExclusiveMaximumValue() { + return exclusiveMaximumValue; + } + + @OpenAPI31 + public void setExclusiveMaximumValue(BigDecimal exclusiveMaximumValue) { + this.exclusiveMaximumValue = exclusiveMaximumValue; + } + + @OpenAPI31 + public Schema exclusiveMaximumValue(BigDecimal exclusiveMaximumValue) { + this.exclusiveMaximumValue = exclusiveMaximumValue; + return this; + } + /** * returns the minimum property from a Schema instance. * @@ -251,7 +306,7 @@ public Schema minimum(BigDecimal minimum) { } /** - * returns the exclusiveMinimum property from a Schema instance. + * returns the exclusiveMinimum property from a Schema instance for OpenAPI 3.0.x * * @return Boolean exclusiveMinimum **/ @@ -269,6 +324,27 @@ public Schema exclusiveMinimum(Boolean exclusiveMinimum) { return this; } + /** + * returns the exclusiveMinimumValue property from a Schema instance for OpenAPI 3.1.x + * + * @since 2.1.8 + * @return BigDecimal exclusiveMinimumValue + * + **/ + @OpenAPI31 + public BigDecimal getExclusiveMinimumValue() { + return exclusiveMinimumValue; + } + @OpenAPI31 + public void setExclusiveMinimumValue(BigDecimal exclusiveMinimumValue) { + this.exclusiveMinimumValue = exclusiveMinimumValue; + } + @OpenAPI31 + public Schema exclusiveMinimumValue(BigDecimal exclusiveMinimumValue) { + this.exclusiveMinimumValue = exclusiveMinimumValue; + return this; + } + /** * returns the maxLength property from a Schema instance. *

@@ -538,6 +614,34 @@ public Schema addProperties(String key, Schema propertiesItem) { return this; } + /** + * returns the patternProperties property from a Schema instance. + * + * @since 2.1.8 + * @return Map<String, Schema> patternProperties + **/ + + public Map getPatternProperties() { + return patternProperties; + } + + public void setPatternProperties(Map patternProperties) { + this.patternProperties = patternProperties; + } + + public Schema patternProperties(Map patternProperties) { + this.patternProperties = patternProperties; + return this; + } + + public Schema addPatternProperty(String key, Schema patternPropertiesItem) { + if (this.patternProperties == null) { + this.patternProperties = new LinkedHashMap<>(); + } + this.patternProperties.put(key, patternPropertiesItem); + return this; + } + /** * returns the additionalProperties property from a Schema instance. Can be either a Boolean or a Schema * @@ -625,15 +729,17 @@ public Schema format(String format) { * * @return Boolean nullable **/ - + @OpenAPI30 public Boolean getNullable() { return nullable; } + @OpenAPI30 public void setNullable(Boolean nullable) { this.nullable = nullable; } + @OpenAPI30 public Schema nullable(Boolean nullable) { this.nullable = nullable; return this; @@ -784,8 +890,10 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.multipleOf, schema.multipleOf) && Objects.equals(this.maximum, schema.maximum) && Objects.equals(this.exclusiveMaximum, schema.exclusiveMaximum) && + Objects.equals(this.exclusiveMaximumValue, schema.exclusiveMaximumValue) && Objects.equals(this.minimum, schema.minimum) && Objects.equals(this.exclusiveMinimum, schema.exclusiveMinimum) && + Objects.equals(this.exclusiveMinimumValue, schema.exclusiveMinimumValue) && Objects.equals(this.maxLength, schema.maxLength) && Objects.equals(this.minLength, schema.minLength) && Objects.equals(this.pattern, schema.pattern) && @@ -817,9 +925,11 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(title, multipleOf, maximum, exclusiveMaximum, minimum, exclusiveMinimum, maxLength, minLength, pattern, maxItems, - minItems, uniqueItems, maxProperties, minProperties, required, type, not, properties, additionalProperties, description, format, $ref, - nullable, readOnly, writeOnly, example, externalDocs, deprecated, xml, extensions, discriminator, _enum, _default); + return Objects.hash(title, multipleOf, maximum, exclusiveMaximum, exclusiveMaximumValue, minimum, + exclusiveMinimum, exclusiveMinimumValue, maxLength, minLength, pattern, maxItems, minItems, uniqueItems, + maxProperties, minProperties, required, type, not, properties, additionalProperties, description, + format, $ref, nullable, readOnly, writeOnly, example, externalDocs, deprecated, xml, extensions, + discriminator, _enum, _default); } public java.util.Map getExtensions() { @@ -857,8 +967,10 @@ public String toString() { sb.append(" multipleOf: ").append(toIndentedString(multipleOf)).append("\n"); sb.append(" maximum: ").append(toIndentedString(maximum)).append("\n"); sb.append(" exclusiveMaximum: ").append(toIndentedString(exclusiveMaximum)).append("\n"); + sb.append(" exclusiveMaximumValue: ").append(toIndentedString(exclusiveMaximumValue)).append("\n"); sb.append(" minimum: ").append(toIndentedString(minimum)).append("\n"); sb.append(" exclusiveMinimum: ").append(toIndentedString(exclusiveMinimum)).append("\n"); + sb.append(" exclusiveMinimumValue: ").append(toIndentedString(exclusiveMinimumValue)).append("\n"); sb.append(" maxLength: ").append(toIndentedString(maxLength)).append("\n"); sb.append(" minLength: ").append(toIndentedString(minLength)).append("\n"); sb.append(" pattern: ").append(toIndentedString(pattern)).append("\n"); diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java index 184ce97ba4..26cd646790 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java @@ -30,7 +30,8 @@ public enum Type { APIKEY("apiKey"), HTTP("http"), OAUTH2("oauth2"), - OPENIDCONNECT("openIdConnect"); + OPENIDCONNECT("openIdConnect"), + MUTUALTLS("mutualTLS"); private String value; From a99259549eb73800c29cf1b72d537d0efb30282b Mon Sep 17 00:00:00 2001 From: frantuma Date: Tue, 8 Jun 2021 11:14:31 +0200 Subject: [PATCH 25/79] OpenAPI 3.1 - hidden Schema Member for schema implementation --- .../core/jackson/mixin/DateSchemaMixin.java | 9 +++++++++ .../v3/core/jackson/mixin/Schema31Mixin.java | 3 +++ .../jackson/mixin/SchemaConverterMixin.java | 3 +++ .../v3/core/jackson/mixin/SchemaMixin.java | 3 +++ .../io/swagger/v3/oas/models/OpenAPI.java | 2 +- .../swagger/v3/oas/models/media/Schema.java | 19 +++++++++++++++++++ 6 files changed, 38 insertions(+), 1 deletion(-) diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/DateSchemaMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/DateSchemaMixin.java index 86cf5ed899..ba044ad74d 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/DateSchemaMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/DateSchemaMixin.java @@ -1,9 +1,18 @@ package io.swagger.v3.core.jackson.mixin; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; + +import java.util.Map; public abstract class DateSchemaMixin { @JsonFormat (shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") public abstract Object getExample(); + + @JsonIgnore + public abstract Object getJsonSchemaImpl(); + + @JsonIgnore + public abstract Map getJsonSchema(); } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java index ceb77aaf63..ec9957671d 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java @@ -34,4 +34,7 @@ public abstract class Schema31Mixin { @JsonInclude(JsonInclude.Include.CUSTOM) public abstract Object getExample(); + @JsonIgnore + public abstract Object getJsonSchemaImpl(); + } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java index cf7a876e2c..f9a1367eee 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java @@ -33,4 +33,7 @@ public abstract class SchemaConverterMixin { @JsonInclude(JsonInclude.Include.CUSTOM) public abstract Object getExample(); + @JsonIgnore + public abstract Object getJsonSchemaImpl(); + } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java index 90b8503dd7..bc2915b5be 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java @@ -34,4 +34,7 @@ public abstract class SchemaMixin { @JsonIgnore public abstract Map getPatternProperties(); + + @JsonIgnore + public abstract Object getJsonSchemaImpl(); } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java index dd4b5d8186..2dde2cbe4e 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java @@ -259,7 +259,7 @@ public OpenAPI schemaRequirement(String name, SecurityScheme securityScheme) { /** * returns the webhooks property from a OpenAPI instance. * - * @since 2.1.8 (OpenAPI 3.1.0) + * @since 2.1.10 (OpenAPI 3.1.0) * @return Map<String, PathItem> webhooks **/ 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 bba0dc4a7a..263ba5ad4b 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 @@ -103,6 +103,25 @@ public Schema jsonSchema(Map jsonSchema) { return this; } + @OpenAPI31 + protected transient Object jsonSchemaImpl = null; + + @OpenAPI31 + public Object getJsonSchemaImpl() { + return jsonSchemaImpl; + } + + @OpenAPI31 + public void setJsonSchemaImpl(Object jsonSchemaImpl) { + this.jsonSchemaImpl = jsonSchemaImpl; + } + + @OpenAPI31 + public Schema jsonSchemaImpl(Object jsonSchemaImpl) { + setJsonSchemaImpl(jsonSchemaImpl); + return this; + } + public Schema() { } From 3dbe689691eaebb378f5e7e03fe222ba5571c08a Mon Sep 17 00:00:00 2001 From: frantuma Date: Mon, 21 Jun 2021 15:42:45 +0200 Subject: [PATCH 26/79] OpenAPI 3.1 - initial full semantic serialization --- .../v3/core/jackson/ModelResolver.java | 1 - .../v3/core/jackson/Schema31Serializer.java | 4 + .../v3/core/jackson/mixin/Schema31Mixin.java | 40 +- .../jackson/mixin/SchemaConverterMixin.java | 2 + .../v3/core/jackson/mixin/SchemaMixin.java | 12 + .../v3/core/util/Model31Deserializer.java | 20 +- .../v3/core/util/ModelDeserializer.java | 146 ++++-- .../v3/core/util/ObjectMapperFactory.java | 1 + .../core/util/OpenAPISchema2JsonSchema.java | 24 +- .../OpenAPI3_1DeserializationTest.java | 10 + .../specFiles/3.1.0/petstore-3.1.yaml | 4 +- .../specFiles/3.1.0/petstore-3.1_more.yaml | 130 +++++ .../src/test/resources/specFiles/oas3.yaml | 1 - .../src/test/resources/specFiles/oas3_2.yaml | 30 +- .../integration/GenericOpenApiContext.java | 50 +- .../integration/api/OpenAPIConfiguration.java | 2 +- .../jaxrs2/integration/SortedOutputTest.java | 15 + .../v3/oas/{ => annotations}/OpenAPI30.java | 2 +- .../v3/oas/{ => annotations}/OpenAPI31.java | 2 +- .../io/swagger/v3/oas/models/OpenAPI.java | 27 +- .../io/swagger/v3/oas/models/SpecVersion.java | 6 + .../swagger/v3/oas/models/info/License.java | 2 +- .../v3/oas/models/media/ArraySchema.java | 41 +- .../v3/oas/models/media/BooleanSchema.java | 8 + .../v3/oas/models/media/ComposedSchema.java | 110 ---- .../v3/oas/models/media/JsonSchema.java | 39 ++ .../swagger/v3/oas/models/media/Schema.java | 475 ++++++++++++++---- 27 files changed, 859 insertions(+), 345 deletions(-) create mode 100644 modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_more.yaml rename modules/swagger-models/src/main/java/io/swagger/v3/oas/{ => annotations}/OpenAPI30.java (94%) rename modules/swagger-models/src/main/java/io/swagger/v3/oas/{ => annotations}/OpenAPI31.java (94%) create mode 100644 modules/swagger-models/src/main/java/io/swagger/v3/oas/models/SpecVersion.java create mode 100644 modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/JsonSchema.java diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java index 9c10c21676..a4b305f709 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java @@ -33,7 +33,6 @@ import io.swagger.v3.core.util.AnnotationsUtils; import io.swagger.v3.core.util.Constants; import io.swagger.v3.core.util.Json; -import io.swagger.v3.core.util.Json31; import io.swagger.v3.core.util.ObjectMapperFactory; import io.swagger.v3.core.util.OpenAPISchema2JsonSchema; import io.swagger.v3.core.util.OptionalUtils; diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java index dcac551620..2e07bb864d 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java @@ -30,9 +30,13 @@ public void serialize( Schema value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + defaultSerializer.serialize(value, jgen, provider); + +/* // handle ref schema serialization skipping all other props if (value.getJsonSchema() != null) { jgen.writeObject(value.getJsonSchema()); } +*/ } } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java index ec9957671d..03e1b679df 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java @@ -4,13 +4,22 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.io.IOException; +import java.math.BigDecimal; import java.util.Map; +import java.util.Set; public abstract class Schema31Mixin { - @JsonValue + //@JsonValue + @JsonIgnore public abstract Map getJsonSchema(); @JsonIgnore @@ -22,6 +31,19 @@ public abstract class Schema31Mixin { @JsonIgnore public abstract Boolean getExclusiveMaximum(); + @JsonProperty("exclusiveMinimum") + public abstract BigDecimal getExclusiveMinimumValue(); + + @JsonProperty("exclusiveMaximum") + public abstract BigDecimal getExclusiveMaximumValue(); + + @JsonIgnore + public abstract String getType(); + + @JsonProperty("type") + @JsonSerialize(using = TypeSerializer.class) + public abstract Set getTypes(); + @JsonAnyGetter public abstract Map getExtensions(); @@ -37,4 +59,20 @@ public abstract class Schema31Mixin { @JsonIgnore public abstract Object getJsonSchemaImpl(); + public static class TypeSerializer extends JsonSerializer> { + + @Override + public void serialize(Set types, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (types != null && types.size() == 1) { + jsonGenerator.writeString((String)types.toArray()[0]); + } else if (types != null && types.size() > 1){ + jsonGenerator.writeStartArray(); + for (String t: types) { + jsonGenerator.writeString(t); + } + jsonGenerator.writeEndArray(); + } + } + } + } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java index f9a1367eee..b026c3490c 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java @@ -12,6 +12,7 @@ public abstract class SchemaConverterMixin { @JsonIgnore public abstract Map getJsonSchema(); +/* @JsonIgnore public abstract Boolean getNullable(); @@ -20,6 +21,7 @@ public abstract class SchemaConverterMixin { @JsonIgnore public abstract Boolean getExclusiveMaximum(); +*/ @JsonAnyGetter public abstract Map getExtensions(); diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java index bc2915b5be..2940fb3691 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java @@ -8,6 +8,7 @@ import java.math.BigDecimal; import java.util.Map; +import java.util.Set; public abstract class SchemaMixin { @@ -32,6 +33,17 @@ public abstract class SchemaMixin { @JsonIgnore public abstract BigDecimal getExclusiveMaximumValue(); + @JsonIgnore + public abstract Schema getContains(); + @JsonIgnore + public abstract String get$id(); + @JsonIgnore + public abstract String get$anchor(); + @JsonIgnore + public abstract String get$schema(); + @JsonIgnore + public abstract Set getTypes(); + @JsonIgnore public abstract Map getPatternProperties(); diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Model31Deserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Model31Deserializer.java index 1caea3b374..67cfa66799 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Model31Deserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Model31Deserializer.java @@ -1,22 +1,6 @@ package io.swagger.v3.core.util; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.databind.JsonNode; -import io.swagger.v3.oas.models.media.Schema; +public class Model31Deserializer extends ModelDeserializer { -import java.io.IOException; -import java.util.Map; - -public class Model31Deserializer extends JsonDeserializer { - @Override - public Schema deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException { - JsonNode node = jp.getCodec().readTree(jp); - Schema schema = new Schema(); - Map jsonSchema = Json31.mapper().convertValue(node, Map.class); - schema.jsonSchema(jsonSchema); - return schema; - } + public Model31Deserializer() {this.openapi31 = true;} } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ModelDeserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ModelDeserializer.java index 9c8941a936..51015bf3ee 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ModelDeserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ModelDeserializer.java @@ -4,6 +4,8 @@ import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; import io.swagger.v3.oas.models.media.ArraySchema; @@ -13,6 +15,7 @@ import io.swagger.v3.oas.models.media.DateTimeSchema; import io.swagger.v3.oas.models.media.EmailSchema; import io.swagger.v3.oas.models.media.IntegerSchema; +import io.swagger.v3.oas.models.media.JsonSchema; import io.swagger.v3.oas.models.media.MapSchema; import io.swagger.v3.oas.models.media.NumberSchema; import io.swagger.v3.oas.models.media.ObjectSchema; @@ -23,67 +26,89 @@ import org.apache.commons.lang3.StringUtils; import java.io.IOException; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; public class ModelDeserializer extends JsonDeserializer { + + protected boolean openapi31 = false; @Override public Schema deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { JsonNode node = jp.getCodec().readTree(jp); - JsonNode allOf = node.get("allOf"); - JsonNode anyOf = node.get("anyOf"); - JsonNode oneOf = node.get("oneOf"); Schema schema = null; - if (allOf != null || anyOf != null || oneOf != null) { +/* + final ObjectMapper mapper; + if (openapi31) { + mapper = Json31.mapper(); + } else { + mapper = Json.mapper(); + } +*/ + + if (openapi31) { + schema = deserializeJsonSchema(node); + return schema; + } - return Json.mapper().convertValue(node, ComposedSchema.class); - } else { + List composed = Arrays.asList("allOf", "anyOf", "oneOf"); + for (String field: composed) { + if (node.get(field) != null) { + return Json.mapper().convertValue(node, ComposedSchema.class); + } + } - JsonNode type = node.get("type"); - String format = node.get("format") == null ? "" : node.get("format").textValue(); - - if (type != null && "array".equals(((TextNode) type).textValue())) { - schema = Json.mapper().convertValue(node, ArraySchema.class); - } else if (type != null) { - if (type.textValue().equals("integer")) { - schema = Json.mapper().convertValue(node, IntegerSchema.class); - if (StringUtils.isBlank(format)) { - schema.setFormat(null); - } - } else if (type.textValue().equals("number")) { - schema = Json.mapper().convertValue(node, NumberSchema.class); - } else if (type.textValue().equals("boolean")) { - schema = Json.mapper().convertValue(node, BooleanSchema.class); - } else if (type.textValue().equals("string")) { - if ("date".equals(format)) { - schema = Json.mapper().convertValue(node, DateSchema.class); - } else if ("date-time".equals(format)) { - schema = Json.mapper().convertValue(node, DateTimeSchema.class); - } else if ("email".equals(format)) { - schema = Json.mapper().convertValue(node, EmailSchema.class); - } else if ("password".equals(format)) { - schema = Json.mapper().convertValue(node, PasswordSchema.class); - } else if ("uuid".equals(format)) { - schema = Json.mapper().convertValue(node, UUIDSchema.class); - } else { - schema = Json.mapper().convertValue(node, StringSchema.class); - } - } else if (type.textValue().equals("object")) { - schema = deserializeObjectSchema(node); + JsonNode type = node.get("type"); + String format = node.get("format") == null ? "" : node.get("format").textValue(); + + if (type != null && "array".equals(((TextNode) type).textValue())) { + schema = Json.mapper().convertValue(node, ArraySchema.class); + } else if (type != null) { + if (type.textValue().equals("integer")) { + schema = Json.mapper().convertValue(node, IntegerSchema.class); + if (StringUtils.isBlank(format)) { + schema.setFormat(null); + } + } else if (type.textValue().equals("number")) { + schema = Json.mapper().convertValue(node, NumberSchema.class); + } else if (type.textValue().equals("boolean")) { + schema = Json.mapper().convertValue(node, BooleanSchema.class); + } else if (type.textValue().equals("string")) { + if ("date".equals(format)) { + schema = Json.mapper().convertValue(node, DateSchema.class); + } else if ("date-time".equals(format)) { + schema = Json.mapper().convertValue(node, DateTimeSchema.class); + } else if ("email".equals(format)) { + schema = Json.mapper().convertValue(node, EmailSchema.class); + } else if ("password".equals(format)) { + schema = Json.mapper().convertValue(node, PasswordSchema.class); + } else if ("uuid".equals(format)) { + schema = Json.mapper().convertValue(node, UUIDSchema.class); + } else { + schema = Json.mapper().convertValue(node, StringSchema.class); } - } else if (node.get("$ref") != null) { - schema = new Schema().$ref(node.get("$ref").asText()); - } else { // assume object + } else if (type.textValue().equals("object")) { schema = deserializeObjectSchema(node); } + } else if (node.get("$ref") != null) { + schema = new Schema().$ref(node.get("$ref").asText()); + } else { // assume object + schema = deserializeObjectSchema(node); } return schema; } private Schema deserializeObjectSchema(JsonNode node) { + Map jsonSchema = Json31.mapper().convertValue(node, Map.class); + + JsonNode additionalProperties = node.get("additionalProperties"); Schema schema = null; if (additionalProperties != null) { @@ -107,6 +132,47 @@ private Schema deserializeObjectSchema(JsonNode node) { } else { schema = Json.mapper().convertValue(node, ObjectSchema.class); } + if (schema != null) { + schema.jsonSchema(jsonSchema); + } + return schema; + } + + private Schema deserializeJsonSchema(JsonNode node) { + JsonNode additionalProperties = node.get("additionalProperties"); + JsonNode type = node.get("type"); + Schema schema = null; + + if (type != null || additionalProperties != null) { + if (type != null) { + ((ObjectNode)node).remove("type"); + } + if (additionalProperties != null) { + ((ObjectNode)node).remove("additionalProperties"); + } + schema = Json31.mapper().convertValue(node, JsonSchema.class); + if (type instanceof TextNode) { + schema.types(new LinkedHashSet<>(Arrays.asList(type.textValue()))); + } else if (type instanceof ArrayNode){ + Set types = new LinkedHashSet<>(); + ((ArrayNode)type).elements().forEachRemaining( n -> { + types.add(n.textValue()); + }); + schema.types(types); + } + if (additionalProperties != null) { + try { + Schema innerSchema = Json31.mapper().convertValue(additionalProperties, JsonSchema.class); + schema.setAdditionalProperties(innerSchema); + } catch (Exception e) { + Boolean additionalPropsBoolean = Json31.mapper().convertValue(additionalProperties, Boolean.class); + schema.setAdditionalProperties(additionalPropsBoolean); + } + } + + } else { + schema = Json31.mapper().convertValue(node, JsonSchema.class); + } return schema; } } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java index ac1105292a..ae1d062ee5 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java @@ -181,6 +181,7 @@ public JsonSerializer modifySerializer( sourceMixins.put(DateSchema.class, DateSchemaMixin.class); } else { sourceMixins.put(Schema.class, Schema31Mixin.class); + sourceMixins.put(DateSchema.class, DateSchemaMixin.class); } mapper.setMixIns(sourceMixins); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/OpenAPISchema2JsonSchema.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/OpenAPISchema2JsonSchema.java index 9d4f442d09..a28ffe0ee9 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/OpenAPISchema2JsonSchema.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/OpenAPISchema2JsonSchema.java @@ -1,10 +1,14 @@ package io.swagger.v3.core.util; import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.v3.oas.models.SpecVersion; import io.swagger.v3.oas.models.media.Schema; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; @@ -13,18 +17,22 @@ public class OpenAPISchema2JsonSchema { protected final ObjectMapper converterMapper = Json31.converterMapper(); public void process(Schema schema) { + if (schema.getSpecVersion() == SpecVersion.V30) { + return; + } Map jsonSchema = converterMapper.convertValue(schema, Map.class); // handle nullable + if (schema.getType() != null || Boolean.TRUE.equals(schema.getNullable())) { + schema.types(new LinkedHashSet<>()); + } + if (schema.getType() != null) { + schema.getTypes().add(schema.getType()); + } + schema.type(null); if (Boolean.TRUE.equals(schema.getNullable())) { - String type = jsonSchema.get("type").toString(); - List newType = new ArrayList<>(); - if (StringUtils.isNotBlank(type)) { - newType.add(type); - } - newType.add("null"); - jsonSchema.put("type", newType); - jsonSchema.remove("nullable"); + schema.nullable(null); + schema.getTypes().add("null"); } // TODO handle other differences diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java index 6984189c5e..4b851034ff 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java @@ -23,6 +23,16 @@ public void deserializePetstore3_1() throws IOException { assertEquals(swagger.getInfo().getLicense().getIdentifier(), "test"); } + @Test + public void deserializePetstore3_1More() throws IOException { + + final String jsonString = ResourceUtils.loadClassResource(getClass(), "specFiles/3.1.0/petstore-3.1_more.yaml"); + final OpenAPI swagger = Yaml31.mapper().readValue(jsonString, OpenAPI.class); + assertNotNull(swagger); + assertEquals(swagger.getInfo().getLicense().getIdentifier(), "test"); + } + + @Test public void deserializePetstore3_0() throws IOException { diff --git a/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1.yaml b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1.yaml index 3873c550ac..e09ccbf97a 100644 --- a/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1.yaml +++ b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1.yaml @@ -105,7 +105,9 @@ components: type: integer format: int64 name: - type: string + type: + - string + - integer tag: type: string Pets: diff --git a/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_more.yaml b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_more.yaml new file mode 100644 index 0000000000..73bbdd7e2a --- /dev/null +++ b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_more.yaml @@ -0,0 +1,130 @@ +openapi: "3.1.0" +info: + version: 1.0.0 + title: Swagger Petstore + license: + name: MIT + identifier: test +servers: + - url: http://petstore.swagger.io/v1 +webhooks: + # Each webhook needs a name + newPet: + # This is a Path Item Object, the only difference is that the request is initiated by the API provider + post: + requestBody: + description: Information about a new pet in the system + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + responses: + "200": + description: Return a 200 status to indicate that the data was received successfully +paths: + /pets: + get: + summary: List all pets + operationId: listPets + tags: + - pets + parameters: + - name: limit + in: query + description: How many items to return at one time (max 100) + required: false + schema: + type: integer + format: int32 + responses: + "200": + description: An paged array of pets + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + content: + application/json: + schema: + $ref: "#/components/schemas/Pets" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + post: + summary: Create a pet + operationId: createPets + tags: + - pets + responses: + "201": + description: Null response + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + /pets/{petId}: + get: + summary: Info for a specific pet + operationId: showPetById + tags: + - pets + parameters: + - name: petId + in: path + required: true + description: The id of the pet to retrieve + schema: + type: string + responses: + "200": + description: Expected response to a valid request + content: + application/json: + schema: + $ref: "#/components/schemas/Pets" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" +components: + schemas: + Pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: + - string + - integer + tag: + type: string + Pets: + $id: test + $anchor: test + type: array + items: + $ref: "#/components/schemas/Pet" + description: desc + format: int32 + Error: + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string diff --git a/modules/swagger-core/src/test/resources/specFiles/oas3.yaml b/modules/swagger-core/src/test/resources/specFiles/oas3.yaml index 06496ed488..5dad635db6 100644 --- a/modules/swagger-core/src/test/resources/specFiles/oas3.yaml +++ b/modules/swagger-core/src/test/resources/specFiles/oas3.yaml @@ -37,7 +37,6 @@ security: - tokenAuth: [] info: description: 'This is a sample server Petstore' - version: 1.0.0 title: Sample Pet Store App termsOfService: http://swagger.io/terms/ x-info: info extension diff --git a/modules/swagger-core/src/test/resources/specFiles/oas3_2.yaml b/modules/swagger-core/src/test/resources/specFiles/oas3_2.yaml index 14e8040dc5..26812c6681 100644 --- a/modules/swagger-core/src/test/resources/specFiles/oas3_2.yaml +++ b/modules/swagger-core/src/test/resources/specFiles/oas3_2.yaml @@ -1,4 +1,4 @@ -openapi: 3.0 +openapi: 3.0.0 servers: - url: http://petstore.swagger.io/api - url: https://development.gigantic-server.com/api @@ -49,7 +49,6 @@ info: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html x-license: license extension - version: 1.0.1 tags: - name: pet description: Everything about your Pets @@ -1112,31 +1111,6 @@ components: default: false xml: name: Order - properties: - id: - type: integer - format: int64 - petId: - type: integer - format: int64 - quantity: - type: integer - format: int32 - shipDate: - type: string - format: date-time - status: - type: string - description: Order Status - enum: - - placed - - approved - - delivered - complete: - type: boolean - default: false - xml: - name: Order Category: type: object properties: @@ -1386,4 +1360,4 @@ components: converter: url: https://github.com/mermade/oas3 version: 1.2.3 - x-api-title: pet store test api in components \ No newline at end of file + x-api-title: pet store test api in components diff --git a/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/GenericOpenApiContext.java b/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/GenericOpenApiContext.java index fe9fd6aa8f..a62b20c3e7 100644 --- a/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/GenericOpenApiContext.java +++ b/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/GenericOpenApiContext.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.databind.MapperFeature; @@ -670,6 +671,21 @@ static abstract class SortedSchemaMixin { @JsonIgnore public abstract Map getPatternProperties(); + @JsonIgnore + public abstract Schema getContains(); + @JsonIgnore + public abstract String get$id(); + @JsonIgnore + public abstract String get$anchor(); + @JsonIgnore + public abstract String get$schema(); + @JsonIgnore + public abstract Set getTypes(); + + @JsonIgnore + public abstract Object getJsonSchemaImpl(); + + } @JsonPropertyOrder(value = {"openapi", "info", "externalDocs", "servers", "security", "tags", "paths", "components", "webhooks"}, alphabetic = true) @@ -693,16 +709,8 @@ static abstract class SortedSchemaMixin31 { @JsonPropertyOrder(alphabetic = true) public abstract Map getExtensions(); - @JsonAnySetter - public abstract void addExtension(String name, Object value); - + //@JsonValue @JsonIgnore - public abstract boolean getExampleSetFlag(); - - @JsonInclude(JsonInclude.Include.CUSTOM) - public abstract Object getExample(); - - @JsonValue public abstract Map getJsonSchema(); @JsonIgnore @@ -714,6 +722,30 @@ static abstract class SortedSchemaMixin31 { @JsonIgnore public abstract Boolean getExclusiveMaximum(); + @JsonProperty("exclusiveMinimum") + public abstract BigDecimal getExclusiveMinimumValue(); + + @JsonProperty("exclusiveMaximum") + public abstract BigDecimal getExclusiveMaximumValue(); + + @JsonIgnore + public abstract String getType(); + + @JsonProperty("type") + public abstract Set getTypes(); + + @JsonAnySetter + public abstract void addExtension(String name, Object value); + + @JsonIgnore + public abstract boolean getExampleSetFlag(); + + @JsonInclude(JsonInclude.Include.CUSTOM) + public abstract Object getExample(); + + @JsonIgnore + public abstract Object getJsonSchemaImpl(); + } } diff --git a/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/api/OpenAPIConfiguration.java b/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/api/OpenAPIConfiguration.java index 3c068c0a48..780923280f 100644 --- a/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/api/OpenAPIConfiguration.java +++ b/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/api/OpenAPIConfiguration.java @@ -50,7 +50,7 @@ public interface OpenAPIConfiguration { Boolean isAlwaysResolveAppPath(); /** - * @since 2.1.9 + * @since 3.0.0 */ Boolean isOpenAPI31(); } diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/integration/SortedOutputTest.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/integration/SortedOutputTest.java index 40b4cc3ac8..7c8074e5f7 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/integration/SortedOutputTest.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/integration/SortedOutputTest.java @@ -131,6 +131,21 @@ public static abstract class SortedSchemaMixin { @JsonIgnore public abstract Map getPatternProperties(); + @JsonIgnore + public abstract Schema getContains(); + @JsonIgnore + public abstract String get$id(); + @JsonIgnore + public abstract String get$anchor(); + @JsonIgnore + public abstract String get$schema(); + @JsonIgnore + public abstract Set getTypes(); + + @JsonIgnore + public abstract Object getJsonSchemaImpl(); + + } public static class SortedProcessor implements ObjectMapperProcessor { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/OpenAPI30.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/annotations/OpenAPI30.java similarity index 94% rename from modules/swagger-models/src/main/java/io/swagger/v3/oas/OpenAPI30.java rename to modules/swagger-models/src/main/java/io/swagger/v3/oas/annotations/OpenAPI30.java index 4f952e5f2c..e1c7d63e98 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/OpenAPI30.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/annotations/OpenAPI30.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.swagger.v3.oas; +package io.swagger.v3.oas.annotations; import java.lang.annotation.Inherited; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/OpenAPI31.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/annotations/OpenAPI31.java similarity index 94% rename from modules/swagger-models/src/main/java/io/swagger/v3/oas/OpenAPI31.java rename to modules/swagger-models/src/main/java/io/swagger/v3/oas/annotations/OpenAPI31.java index a741f1bd62..35cec47814 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/OpenAPI31.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/annotations/OpenAPI31.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.swagger.v3.oas; +package io.swagger.v3.oas.annotations; import java.lang.annotation.Inherited; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java index 2dde2cbe4e..c76d97e873 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java @@ -16,6 +16,8 @@ package io.swagger.v3.oas.models; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.security.SecurityRequirement; @@ -46,9 +48,28 @@ public class OpenAPI { private Components components = null; private java.util.Map extensions = null; + public OpenAPI() {} + public OpenAPI(SpecVersion specVersion) { this.specVersion = specVersion;} + private SpecVersion specVersion = SpecVersion.V30; + + @JsonIgnore + public SpecVersion getSpecVersion() { + return this.specVersion; + } + + public void setSpecVersion(SpecVersion specVersion) { + this.specVersion = specVersion; + } + + public OpenAPI specVersion(SpecVersion specVersion) { + this.setSpecVersion(specVersion); + return this; + } + /** * @since 2.1.8 (OpenAPI 3.1.0) */ + @OpenAPI31 private java.util.Map webhooks = null; /** @@ -263,19 +284,23 @@ public OpenAPI schemaRequirement(String name, SecurityScheme securityScheme) { * @return Map<String, PathItem> webhooks **/ + @OpenAPI31 public Map getWebhooks() { return webhooks; } + @OpenAPI31 public void setWebhooks(Map webhooks) { this.webhooks = webhooks; } + @OpenAPI31 public OpenAPI webhooks(Map webhooks) { this.webhooks = webhooks; return this; } + @OpenAPI31 public OpenAPI addWebhooks(String key, PathItem pathItem) { if (this.webhooks == null) { this.webhooks = new LinkedHashMap<>(); @@ -347,7 +372,7 @@ public String toString() { sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" paths: ").append(toIndentedString(paths)).append("\n"); sb.append(" components: ").append(toIndentedString(components)).append("\n"); - sb.append(" webhooks: ").append(toIndentedString(webhooks)).append("\n"); + if (specVersion == SpecVersion.V31) sb.append(" webhooks: ").append(toIndentedString(webhooks)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/SpecVersion.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/SpecVersion.java new file mode 100644 index 0000000000..cea82fd5ce --- /dev/null +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/SpecVersion.java @@ -0,0 +1,6 @@ +package io.swagger.v3.oas.models; + +public enum SpecVersion { + V30, + V31 +} diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java index cf62b780a6..e7fef66606 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java @@ -16,7 +16,7 @@ package io.swagger.v3.oas.models.info; -import io.swagger.v3.oas.OpenAPI31; +import io.swagger.v3.oas.annotations.OpenAPI31; import java.util.Objects; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ArraySchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ArraySchema.java index 5dacdb04a7..9ef004bee7 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ArraySchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ArraySchema.java @@ -16,14 +16,11 @@ package io.swagger.v3.oas.models.media; -import java.util.Objects; - /** * ArraySchema */ public class ArraySchema extends Schema { - private Schema items = null; public ArraySchema() { super("array", null); @@ -35,41 +32,10 @@ public ArraySchema type(String type) { return this; } - /** - * returns the items property from a ArraySchema instance. - * - * @return Schema items - **/ - - public Schema getItems() { - return items; - } - - public void setItems(Schema items) { - this.items = items; - } - - public ArraySchema items(Schema items) { - this.items = items; - return this; - } - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ArraySchema arraySchema = (ArraySchema) o; - return Objects.equals(this.items, arraySchema.items) && - super.equals(o); - } - @Override - public int hashCode() { - return Objects.hash(items, super.hashCode()); + public ArraySchema items(Schema items) { + super.setItems(items); + return this; } @Override @@ -77,7 +43,6 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ArraySchema {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" items: ").append(toIndentedString(items)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BooleanSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BooleanSchema.java index 6aa319a557..9d226b6cee 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BooleanSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BooleanSchema.java @@ -19,6 +19,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.Set; /** * BooleanSchema @@ -36,6 +37,13 @@ public BooleanSchema type(String type) { return this; } + @Override + public BooleanSchema types(Set types) { + super.setTypes(types); + return this; + } + + public BooleanSchema _default(Boolean _default) { super.setDefault(_default); return this; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ComposedSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ComposedSchema.java index 530a7700d3..164a90866a 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ComposedSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ComposedSchema.java @@ -16,128 +16,18 @@ package io.swagger.v3.oas.models.media; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - /** * ComposedSchema */ public class ComposedSchema extends Schema { - private List allOf = null; - private List anyOf = null; - private List oneOf = null; - - /** - * returns the allOf property from a ComposedSchema instance. - * - * @return List<Schema> allOf - **/ - - public List getAllOf() { - return allOf; - } - - public void setAllOf(List allOf) { - this.allOf = allOf; - } - - public ComposedSchema allOf(List allOf) { - this.allOf = allOf; - return this; - } - - public ComposedSchema addAllOfItem(Schema allOfItem) { - if (this.allOf == null) { - this.allOf = new ArrayList<>(); - } - this.allOf.add(allOfItem); - return this; - } - - /** - * returns the anyOf property from a ComposedSchema instance. - * - * @return List<Schema> anyOf - **/ - - public List getAnyOf() { - return anyOf; - } - - public void setAnyOf(List anyOf) { - this.anyOf = anyOf; - } - - public ComposedSchema anyOf(List anyOf) { - this.anyOf = anyOf; - return this; - } - public ComposedSchema addAnyOfItem(Schema anyOfItem) { - if (this.anyOf == null) { - this.anyOf = new ArrayList<>(); - } - this.anyOf.add(anyOfItem); - return this; - } - - /** - * returns the oneOf property from a ComposedSchema instance. - * - * @return List<Schema> oneOf - **/ - - public List getOneOf() { - return oneOf; - } - - public void setOneOf(List oneOf) { - this.oneOf = oneOf; - } - - public ComposedSchema oneOf(List oneOf) { - this.oneOf = oneOf; - return this; - } - - public ComposedSchema addOneOfItem(Schema oneOfItem) { - if (this.oneOf == null) { - this.oneOf = new ArrayList<>(); - } - this.oneOf.add(oneOfItem); - return this; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ComposedSchema allOfSchema = (ComposedSchema) o; - return Objects.equals(this.allOf, allOfSchema.allOf) && - Objects.equals(this.anyOf, allOfSchema.anyOf) && - Objects.equals(this.oneOf, allOfSchema.oneOf) && - super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(allOf, anyOf, oneOf, super.hashCode()); - } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ComposedSchema {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" allOf: ").append(toIndentedString(allOf)).append("\n"); - sb.append(" anyOf: ").append(toIndentedString(anyOf)).append("\n"); - sb.append(" oneOf: ").append(toIndentedString(oneOf)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/JsonSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/JsonSchema.java new file mode 100644 index 0000000000..065a3becdb --- /dev/null +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/JsonSchema.java @@ -0,0 +1,39 @@ +/** + * Copyright 2017 SmartBear Software + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.swagger.v3.oas.models.media; + +import io.swagger.v3.oas.models.SpecVersion; + +/** + * JsonSchema + */ + +public class JsonSchema extends Schema { + + public JsonSchema (){ + specVersion(SpecVersion.V31); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class JsonSchema {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } +} 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 263ba5ad4b..624b44d64d 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 @@ -17,10 +17,11 @@ package io.swagger.v3.oas.models.media; import com.fasterxml.jackson.annotation.JsonIgnore; -import io.swagger.v3.oas.OpenAPI30; -import io.swagger.v3.oas.OpenAPI31; +import io.swagger.v3.oas.annotations.OpenAPI30; +import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.ExternalDocumentation; +import io.swagger.v3.oas.models.SpecVersion; import java.math.BigDecimal; import java.util.ArrayList; @@ -29,6 +30,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Set; /** * Schema @@ -45,13 +47,9 @@ public class Schema { private BigDecimal maximum = null; @OpenAPI30 private Boolean exclusiveMaximum = null; - @OpenAPI31 - private BigDecimal exclusiveMaximumValue = null; private BigDecimal minimum = null; @OpenAPI30 private Boolean exclusiveMinimum = null; - @OpenAPI31 - private BigDecimal exclusiveMinimumValue = null; private Integer maxLength = null; private Integer minLength = null; private String pattern = null; @@ -64,8 +62,6 @@ public class Schema { private String type = null; private Schema not = null; private Map properties = null; - @OpenAPI31 - private Map patternProperties = null; private Object additionalProperties = null; private String description = null; private String format = null; @@ -84,6 +80,216 @@ public class Schema { private boolean exampleSetFlag; + private List allOf = null; + private List anyOf = null; + private List oneOf = null; + + private Schema items = null; + + protected T _const; + + private SpecVersion specVersion = SpecVersion.V30; + + @JsonIgnore + public SpecVersion getSpecVersion() { + return this.specVersion; + } + + public void setSpecVersion(SpecVersion specVersion) { + this.specVersion = specVersion; + } + + public Schema specVersion(SpecVersion specVersion) { + this.setSpecVersion(specVersion); + return this; + } + + + /* + @OpenAPI31 fields and accessors + */ + + + @OpenAPI31 + private Set types; + + @OpenAPI31 + private Map patternProperties = null; + @OpenAPI31 + private BigDecimal exclusiveMaximumValue = null; + @OpenAPI31 + private BigDecimal exclusiveMinimumValue = null; + + + @OpenAPI31 + private Schema contains = null; + @OpenAPI31 + private String $id; + @OpenAPI31 + private String $schema; + @OpenAPI31 + private String $anchor; + + @OpenAPI31 + public Schema getContains() { + return contains; + } + + @OpenAPI31 + public void setContains(Schema contains) { + this.contains = contains; + } + + @OpenAPI31 + public String get$id() { + return $id; + } + + @OpenAPI31 + public void set$id(String $id) { + this.$id = $id; + } + + @OpenAPI31 + public String get$schema() { + return $schema; + } + + @OpenAPI31 + public void set$schema(String $schema) { + this.$schema = $schema; + } + + @OpenAPI31 + public String get$anchor() { + return $anchor; + } + + @OpenAPI31 + public void set$anchor(String $anchor) { + this.$anchor = $anchor; + } + + /** + * returns the exclusiveMaximumValue property from a Schema instance for OpenAPI 3.1.x + * + * @since 2.1.8 + * @return BigDecimal exclusiveMaximumValue + * + **/ + @OpenAPI31 + public BigDecimal getExclusiveMaximumValue() { + return exclusiveMaximumValue; + } + + @OpenAPI31 + public void setExclusiveMaximumValue(BigDecimal exclusiveMaximumValue) { + this.exclusiveMaximumValue = exclusiveMaximumValue; + } + + @OpenAPI31 + public Schema exclusiveMaximumValue(BigDecimal exclusiveMaximumValue) { + this.exclusiveMaximumValue = exclusiveMaximumValue; + return this; + } + + /** + * returns the exclusiveMinimumValue property from a Schema instance for OpenAPI 3.1.x + * + * @since 2.1.8 + * @return BigDecimal exclusiveMinimumValue + * + **/ + @OpenAPI31 + public BigDecimal getExclusiveMinimumValue() { + return exclusiveMinimumValue; + } + @OpenAPI31 + public void setExclusiveMinimumValue(BigDecimal exclusiveMinimumValue) { + this.exclusiveMinimumValue = exclusiveMinimumValue; + } + @OpenAPI31 + public Schema exclusiveMinimumValue(BigDecimal exclusiveMinimumValue) { + this.exclusiveMinimumValue = exclusiveMinimumValue; + return this; + } + + /** + * returns the patternProperties property from a Schema instance. + * + * @since 2.1.8 + * @return Map<String, Schema> patternProperties + **/ + + @OpenAPI31 + public Map getPatternProperties() { + return patternProperties; + } + + public void setPatternProperties(Map patternProperties) { + this.patternProperties = patternProperties; + } + + @OpenAPI31 + public Schema patternProperties(Map patternProperties) { + this.patternProperties = patternProperties; + return this; + } + + @OpenAPI31 + public Schema addPatternProperty(String key, Schema patternPropertiesItem) { + if (this.patternProperties == null) { + this.patternProperties = new LinkedHashMap<>(); + } + this.patternProperties.put(key, patternPropertiesItem); + return this; + } + + + @OpenAPI31 + public Schema contains(Schema contains) { + this.contains = contains; + return this; + } + + @OpenAPI31 + public Schema $id(String $id) { + this.$id = $id; + return this; + } + + @OpenAPI31 + public Set getTypes() { + return types; + } + + @OpenAPI31 + public void setTypes(Set types) { + this.types = types; + } + + @OpenAPI31 + public Schema $schema(String $schema) { + this.$schema = $schema; + return this; + } + + @OpenAPI31 + public Schema $anchor(String $anchor) { + this.$anchor = $anchor; + return this; + } + + @OpenAPI31 + public Schema types(Set types) { + this.types = types; + return this; + } + + /* + INTERNAL MEMBERS @OpenAPI31 + */ + @OpenAPI31 protected Map jsonSchema = null; @@ -122,6 +328,11 @@ public Schema jsonSchemaImpl(Object jsonSchemaImpl) { return this; } + /* + CONSTRUCTORS + */ + + public Schema() { } @@ -130,6 +341,122 @@ protected Schema(String type, String format) { this.format = format; } + public Schema(SpecVersion specVersion) { + this.specVersion = specVersion; + } + + protected Schema(String type, String format, SpecVersion specVersion) { + this.type = type; + this.format = format; + this.specVersion = specVersion; + } + + /* + ACCESSORS + */ + + /** + * returns the allOf property from a ComposedSchema instance. + * + * @return List<Schema> allOf + **/ + + public List getAllOf() { + return allOf; + } + + public void setAllOf(List allOf) { + this.allOf = allOf; + } + + public Schema allOf(List allOf) { + this.allOf = allOf; + return this; + } + + public Schema addAllOfItem(Schema allOfItem) { + if (this.allOf == null) { + this.allOf = new ArrayList<>(); + } + this.allOf.add(allOfItem); + return this; + } + + /** + * returns the anyOf property from a ComposedSchema instance. + * + * @return List<Schema> anyOf + **/ + + public List getAnyOf() { + return anyOf; + } + + public void setAnyOf(List anyOf) { + this.anyOf = anyOf; + } + + public Schema anyOf(List anyOf) { + this.anyOf = anyOf; + return this; + } + + public Schema addAnyOfItem(Schema anyOfItem) { + if (this.anyOf == null) { + this.anyOf = new ArrayList<>(); + } + this.anyOf.add(anyOfItem); + return this; + } + + /** + * returns the oneOf property from a ComposedSchema instance. + * + * @return List<Schema> oneOf + **/ + + public List getOneOf() { + return oneOf; + } + + public void setOneOf(List oneOf) { + this.oneOf = oneOf; + } + + public Schema oneOf(List oneOf) { + this.oneOf = oneOf; + return this; + } + + public Schema addOneOfItem(Schema oneOfItem) { + if (this.oneOf == null) { + this.oneOf = new ArrayList<>(); + } + this.oneOf.add(oneOfItem); + return this; + } + + + /** + * returns the items property from a ArraySchema instance. + * + * @return Schema items + **/ + + public Schema getItems() { + return items; + } + + public void setItems(Schema items) { + this.items = items; + } + + public Schema items(Schema items) { + this.items = items; + return this; + } + + /** * returns the name property from a from a Schema instance. Ignored in serialization. * @@ -282,29 +609,6 @@ public Schema exclusiveMaximum(Boolean exclusiveMaximum) { return this; } - /** - * returns the exclusiveMaximumValue property from a Schema instance for OpenAPI 3.1.x - * - * @since 2.1.8 - * @return BigDecimal exclusiveMaximumValue - * - **/ - @OpenAPI31 - public BigDecimal getExclusiveMaximumValue() { - return exclusiveMaximumValue; - } - - @OpenAPI31 - public void setExclusiveMaximumValue(BigDecimal exclusiveMaximumValue) { - this.exclusiveMaximumValue = exclusiveMaximumValue; - } - - @OpenAPI31 - public Schema exclusiveMaximumValue(BigDecimal exclusiveMaximumValue) { - this.exclusiveMaximumValue = exclusiveMaximumValue; - return this; - } - /** * returns the minimum property from a Schema instance. * @@ -324,6 +628,7 @@ public Schema minimum(BigDecimal minimum) { return this; } + /** * returns the exclusiveMinimum property from a Schema instance for OpenAPI 3.0.x * @@ -343,26 +648,6 @@ public Schema exclusiveMinimum(Boolean exclusiveMinimum) { return this; } - /** - * returns the exclusiveMinimumValue property from a Schema instance for OpenAPI 3.1.x - * - * @since 2.1.8 - * @return BigDecimal exclusiveMinimumValue - * - **/ - @OpenAPI31 - public BigDecimal getExclusiveMinimumValue() { - return exclusiveMinimumValue; - } - @OpenAPI31 - public void setExclusiveMinimumValue(BigDecimal exclusiveMinimumValue) { - this.exclusiveMinimumValue = exclusiveMinimumValue; - } - @OpenAPI31 - public Schema exclusiveMinimumValue(BigDecimal exclusiveMinimumValue) { - this.exclusiveMinimumValue = exclusiveMinimumValue; - return this; - } /** * returns the maxLength property from a Schema instance. @@ -633,34 +918,6 @@ public Schema addProperties(String key, Schema propertiesItem) { return this; } - /** - * returns the patternProperties property from a Schema instance. - * - * @since 2.1.8 - * @return Map<String, Schema> patternProperties - **/ - - public Map getPatternProperties() { - return patternProperties; - } - - public void setPatternProperties(Map patternProperties) { - this.patternProperties = patternProperties; - } - - public Schema patternProperties(Map patternProperties) { - this.patternProperties = patternProperties; - return this; - } - - public Schema addPatternProperty(String key, Schema patternPropertiesItem) { - if (this.patternProperties == null) { - this.patternProperties = new LinkedHashMap<>(); - } - this.patternProperties.put(key, patternPropertiesItem); - return this; - } - /** * returns the additionalProperties property from a Schema instance. Can be either a Boolean or a Schema * @@ -939,6 +1196,16 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.extensions, schema.extensions) && Objects.equals(this.discriminator, schema.discriminator) && Objects.equals(this._enum, schema._enum) && + Objects.equals(this.contains, schema.contains) && + Objects.equals(this.patternProperties, schema.patternProperties) && + Objects.equals(this.$id, schema.$id) && + Objects.equals(this.$anchor, schema.$anchor) && + Objects.equals(this.$schema, schema.$schema) && + Objects.equals(this.types, schema.types) && + Objects.equals(this.allOf, schema.allOf) && + Objects.equals(this.anyOf, schema.anyOf) && + Objects.equals(this.oneOf, schema.oneOf) && + Objects.equals(this._const, schema._const) && Objects.equals(this._default, schema._default); } @@ -948,7 +1215,7 @@ public int hashCode() { exclusiveMinimum, exclusiveMinimumValue, maxLength, minLength, pattern, maxItems, minItems, uniqueItems, maxProperties, minProperties, required, type, not, properties, additionalProperties, description, format, $ref, nullable, readOnly, writeOnly, example, externalDocs, deprecated, xml, extensions, - discriminator, _enum, _default); + discriminator, _enum, _default, patternProperties, $id, $anchor, $schema, types, allOf, anyOf, oneOf, _const); } public java.util.Map getExtensions() { @@ -978,18 +1245,19 @@ public Schema extensions(java.util.Map extensions) { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Schema {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); + Object typeStr = specVersion == SpecVersion.V30 ? type : types; + sb.append(" type: ").append(toIndentedString(typeStr)).append("\n"); sb.append(" format: ").append(toIndentedString(format)).append("\n"); sb.append(" $ref: ").append(toIndentedString($ref)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" multipleOf: ").append(toIndentedString(multipleOf)).append("\n"); sb.append(" maximum: ").append(toIndentedString(maximum)).append("\n"); - sb.append(" exclusiveMaximum: ").append(toIndentedString(exclusiveMaximum)).append("\n"); - sb.append(" exclusiveMaximumValue: ").append(toIndentedString(exclusiveMaximumValue)).append("\n"); + Object exclusiveMaximumStr = specVersion == SpecVersion.V30 ? exclusiveMaximum : exclusiveMaximumValue; + sb.append(" exclusiveMaximum: ").append(toIndentedString(exclusiveMaximumStr)).append("\n"); sb.append(" minimum: ").append(toIndentedString(minimum)).append("\n"); - sb.append(" exclusiveMinimum: ").append(toIndentedString(exclusiveMinimum)).append("\n"); - sb.append(" exclusiveMinimumValue: ").append(toIndentedString(exclusiveMinimumValue)).append("\n"); + Object exclusiveMinimumStr = specVersion == SpecVersion.V30 ? exclusiveMinimum : exclusiveMinimumValue; + sb.append(" exclusiveMinimum: ").append(toIndentedString(exclusiveMinimumStr)).append("\n"); sb.append(" maxLength: ").append(toIndentedString(maxLength)).append("\n"); sb.append(" minLength: ").append(toIndentedString(minLength)).append("\n"); sb.append(" pattern: ").append(toIndentedString(pattern)).append("\n"); @@ -1010,6 +1278,14 @@ public String toString() { sb.append(" deprecated: ").append(toIndentedString(deprecated)).append("\n"); sb.append(" discriminator: ").append(toIndentedString(discriminator)).append("\n"); sb.append(" xml: ").append(toIndentedString(xml)).append("\n"); + if (specVersion == SpecVersion.V31) { + sb.append(" patternProperties: ").append(toIndentedString(patternProperties)).append("\n"); + sb.append(" contains: ").append(toIndentedString(contains)).append("\n"); + sb.append(" $id: ").append(toIndentedString($id)).append("\n"); + sb.append(" $anchor: ").append(toIndentedString($anchor)).append("\n"); + sb.append(" $schema: ").append(toIndentedString($schema)).append("\n"); + sb.append(" const: ").append(toIndentedString(_const)).append("\n"); + } sb.append("}"); return sb.toString(); } @@ -1025,5 +1301,34 @@ protected String toIndentedString(java.lang.Object o) { return o.toString().replace("\n", "\n "); } + public Schema _default(T _default) { + this._default = _default; + return this; + } + + public Schema _enum(List _enum) { + this._enum = _enum; + return this; + } + + public Schema exampleSetFlag(boolean exampleSetFlag) { + this.exampleSetFlag = exampleSetFlag; + return this; + } + + public T getConst() { + return _const; + } + + public void setConst(Object _const) { + this._const = cast(_const); + } + + public Schema _const(Object _const) { + this._const = cast(_const); + return this; + } + + } From beca8b7ae301584208b886ad6d4cc5c2a5d88267 Mon Sep 17 00:00:00 2001 From: frantuma Date: Tue, 14 Sep 2021 23:19:41 +0200 Subject: [PATCH 27/79] OpenAPI 3.1 - initial models, (de)serializers, mixins, annotations --- .../annotations/media/PatternProperties.java | 2 - .../annotations/media/PatternProperty.java | 1 - .../v3/core/jackson/ModelResolver.java | 37 +------------------ .../v3/core/jackson/Schema31Serializer.java | 1 - .../v3/core/jackson/mixin/Schema31Mixin.java | 1 - .../java/io/swagger/v3/core/util/Json31.java | 10 +++++ .../v3/core/util/ModelDeserializer.java | 16 +------- .../v3/core/util/ObjectMapperFactory.java | 4 +- .../core/util/OpenAPISchema2JsonSchema.java | 24 +++++++----- .../v3/core/util/ParameterDeserializer.java | 3 +- .../core/matchers/SerializationMatchers.java | 1 + .../v31/PatternAndSchemaPropertiesTest.java | 3 ++ .../OpenAPI3_1SerializationTest.java | 21 +++++------ .../swagger/v3/oas/models/media/Schema.java | 9 +++++ 14 files changed, 53 insertions(+), 80 deletions(-) diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperties.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperties.java index d002806315..4b93a3cb12 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperties.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperties.java @@ -16,8 +16,6 @@ package io.swagger.v3.oas.annotations.media; -import io.swagger.v3.oas.annotations.responses.ApiResponse; - import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperty.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperty.java index c791ad02a4..10ee8f1adf 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperty.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperty.java @@ -16,7 +16,6 @@ package io.swagger.v3.oas.annotations.media; -import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java index a4b305f709..3137167397 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java @@ -34,7 +34,6 @@ import io.swagger.v3.core.util.Constants; import io.swagger.v3.core.util.Json; import io.swagger.v3.core.util.ObjectMapperFactory; -import io.swagger.v3.core.util.OpenAPISchema2JsonSchema; import io.swagger.v3.core.util.OptionalUtils; import io.swagger.v3.core.util.PrimitiveType; import io.swagger.v3.core.util.ReflectionUtils; @@ -114,11 +113,6 @@ public class ModelResolver extends AbstractModelConverter implements ModelConver */ public static boolean enumsAsRef = System.getProperty(SET_PROPERTY_OF_ENUMS_AS_REF) != null; - /** - * @since 2.1.8 - */ - protected OpenAPISchema2JsonSchema jsonSchemaProcessor = new OpenAPISchema2JsonSchema(); - public ModelResolver(ObjectMapper mapper) { super(mapper); } @@ -203,15 +197,11 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context if (resolvedSchemaAnnotation != null && StringUtils.isNotEmpty(resolvedSchemaAnnotation.ref())) { if (resolvedArrayAnnotation == null) { - Schema result = new Schema().$ref(resolvedSchemaAnnotation.ref()).name(name); - jsonSchemaProcessor.process(result); return new Schema().$ref(resolvedSchemaAnnotation.ref()).name(name); } else { ArraySchema schema = new ArraySchema(); resolveArraySchema(annotatedType, schema, resolvedArrayAnnotation); - schema.items(new Schema().$ref(resolvedSchemaAnnotation.ref()).name(name)); - jsonSchemaProcessor.process(schema); - return schema; + return schema.items(new Schema().$ref(resolvedSchemaAnnotation.ref()).name(name)); } } @@ -263,7 +253,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context } } schema.setItems(innerSchema); - jsonSchemaProcessor.process(schema); return schema; } else { Schema implSchema = context.resolve(aType); @@ -275,9 +264,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context } else if (implSchema != null && implSchema.get$ref() != null) { implSchema = new Schema().$ref(StringUtils.isNotEmpty(implSchema.get$ref()) ? implSchema.get$ref() : implSchema.getName()); } - if (implSchema != null) { - jsonSchemaProcessor.process(implSchema); - } return implSchema; } } @@ -325,7 +311,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context } model = new GeneratorWrapper().processJsonIdentity(annotatedType, context, _mapper, jsonIdentityInfo, jsonIdentityReference); if (model != null) { - jsonSchemaProcessor.process(model); return model; } } @@ -356,19 +341,14 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context ArraySchema schema = new ArraySchema(); resolveArraySchema(annotatedType, schema, resolvedArrayAnnotation); schema.setItems(model); - jsonSchemaProcessor.process(schema); return schema; } if (type.isEnumType() && shouldResolveEnumAsRef(resolvedSchemaAnnotation)) { // Store off the ref and add the enum as a top-level model - jsonSchemaProcessor.process(model); context.defineModel(name, model, annotatedType, null); // Return the model as a ref only property model = new Schema().$ref(Components.COMPONENTS_SCHEMAS_REF + name); } - if (model != null) { - jsonSchemaProcessor.process(model); - } return model; } @@ -387,7 +367,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context Schema resolvedModel = context.resolve(annotatedType); if (resolvedModel != null) { if (name != null && name.equals(resolvedModel.getName())) { - jsonSchemaProcessor.process(resolvedModel); return resolvedModel; } } @@ -405,11 +384,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context .propertyName(annotatedType.getPropertyName()) .ctxAnnotations(annotatedType.getCtxAnnotations()) .skipOverride(true); - Schema result = context.resolve(aType); - if (result != null) { - jsonSchemaProcessor.process(result); - } - return result; + return context.resolve(aType); } List> composedSchemaReferencedClasses = getComposedSchemaReferencedClasses(type.getRawClass(), annotatedType.getCtxAnnotations(), resolvedSchemaAnnotation); @@ -525,9 +500,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context AnnotatedType aType = OptionalUtils.unwrapOptional(annotatedType); if (aType != null) { model = context.resolve(aType); - if (model != null) { - jsonSchemaProcessor.process(model); - } return model; } else { model = new Schema() @@ -538,7 +510,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context if (!type.isContainerType() && StringUtils.isNotBlank(name)) { // define the model here to support self/cyclic referencing of models - jsonSchemaProcessor.process(model); context.defineModel(name, model, annotatedType, null); } @@ -765,7 +736,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context * available for modification by resolveSubtypes, when their parents are created. */ if (!type.isContainerType() && StringUtils.isNotBlank(name)) { - jsonSchemaProcessor.process(model); context.defineModel(name, model, annotatedType, null); } @@ -896,7 +866,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context if (!type.isContainerType() && StringUtils.isNotBlank(name)) { // define the model here to support self/cyclic referencing of models - jsonSchemaProcessor.process(model); context.defineModel(name, model, annotatedType, null); } @@ -916,7 +885,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context ArraySchema schema = new ArraySchema(); schema.setItems(model); resolveArraySchema(annotatedType, schema, resolvedArrayAnnotation); - jsonSchemaProcessor.process(schema); return schema; } else { if (model instanceof ArraySchema) { @@ -1481,7 +1449,6 @@ private boolean resolveSubtypes(Schema model, BeanDescription bean, ModelConvert // replace previous schema.. Class currentType = subtype.getType(); if (StringUtils.isNotBlank(composedSchema.getName())) { - jsonSchemaProcessor.process(composedSchema); context.defineModel(composedSchema.getName(), composedSchema, new AnnotatedType().type(currentType), null); } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java index 2e07bb864d..3f477c6592 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.ResolvableSerializer; import io.swagger.v3.oas.models.media.Schema; -import org.apache.commons.lang3.StringUtils; import java.io.IOException; diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java index 03e1b679df..7dc9d8bd59 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Json31.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Json31.java index dad8eeea73..16a883c090 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Json31.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Json31.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; +import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import io.swagger.v3.oas.models.media.Schema; @@ -69,4 +70,13 @@ public static Map jsonSchemaAsMap(Schema schema) { return null; } } + + public static Map jsonSchemaAsMap(JsonNode schema) { + try { + return mapper().readValue(mapper().writeValueAsString(schema), Map.class); + } catch (JsonProcessingException e) { + LOGGER.error("Exception converting jsonSchema to Map", e); + return null; + } + } } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ModelDeserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ModelDeserializer.java index 51015bf3ee..7037a32bfe 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ModelDeserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ModelDeserializer.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; @@ -29,7 +28,6 @@ import java.util.Arrays; import java.util.LinkedHashSet; import java.util.List; -import java.util.Map; import java.util.Set; public class ModelDeserializer extends JsonDeserializer { @@ -42,15 +40,6 @@ public Schema deserialize(JsonParser jp, DeserializationContext ctxt) Schema schema = null; -/* - final ObjectMapper mapper; - if (openapi31) { - mapper = Json31.mapper(); - } else { - mapper = Json.mapper(); - } -*/ - if (openapi31) { schema = deserializeJsonSchema(node); return schema; @@ -106,9 +95,6 @@ public Schema deserialize(JsonParser jp, DeserializationContext ctxt) } private Schema deserializeObjectSchema(JsonNode node) { - Map jsonSchema = Json31.mapper().convertValue(node, Map.class); - - JsonNode additionalProperties = node.get("additionalProperties"); Schema schema = null; if (additionalProperties != null) { @@ -133,7 +119,7 @@ private Schema deserializeObjectSchema(JsonNode node) { schema = Json.mapper().convertValue(node, ObjectSchema.class); } if (schema != null) { - schema.jsonSchema(jsonSchema); + schema.jsonSchema(Json31.jsonSchemaAsMap(node)); } return schema; } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java index ae1d062ee5..7d54a4b69f 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java @@ -152,14 +152,14 @@ public JsonSerializer modifySerializer( sourceMixins.put(Contact.class, ExtensionsMixin.class); sourceMixins.put(Encoding.class, ExtensionsMixin.class); sourceMixins.put(EncodingProperty.class, ExtensionsMixin.class); - sourceMixins.put(Example.class, ExtensionsMixin.class); + sourceMixins.put(Example.class, ExampleMixin.class); sourceMixins.put(ExternalDocumentation.class, ExtensionsMixin.class); sourceMixins.put(Header.class, ExtensionsMixin.class); sourceMixins.put(Info.class, ExtensionsMixin.class); sourceMixins.put(License.class, ExtensionsMixin.class); sourceMixins.put(Link.class, ExtensionsMixin.class); sourceMixins.put(LinkParameter.class, ExtensionsMixin.class); - sourceMixins.put(MediaType.class, ExtensionsMixin.class); + sourceMixins.put(MediaType.class, MediaTypeMixin.class); sourceMixins.put(OAuthFlow.class, ExtensionsMixin.class); sourceMixins.put(OAuthFlows.class, ExtensionsMixin.class); sourceMixins.put(OpenAPI.class, OpenAPIMixin.class); diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/OpenAPISchema2JsonSchema.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/OpenAPISchema2JsonSchema.java index a28ffe0ee9..1d7405d7ec 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/OpenAPISchema2JsonSchema.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/OpenAPISchema2JsonSchema.java @@ -3,13 +3,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.swagger.v3.oas.models.SpecVersion; import io.swagger.v3.oas.models.media.Schema; -import org.apache.commons.lang3.StringUtils; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; import java.util.LinkedHashSet; -import java.util.List; import java.util.Map; public class OpenAPISchema2JsonSchema { @@ -17,9 +11,7 @@ public class OpenAPISchema2JsonSchema { protected final ObjectMapper converterMapper = Json31.converterMapper(); public void process(Schema schema) { - if (schema.getSpecVersion() == SpecVersion.V30) { - return; - } + schema.specVersion(SpecVersion.V31); Map jsonSchema = converterMapper.convertValue(schema, Map.class); // handle nullable @@ -38,5 +30,19 @@ public void process(Schema schema) { // TODO handle other differences schema.jsonSchema(jsonSchema); + + // TODO handle all nested schemas + if (schema.getAdditionalProperties() instanceof Schema) { + process((Schema) schema.getAdditionalProperties()); + } + if (schema.getAllOf() != null) { + schema.getAllOf().forEach(this::process); + } + if (schema.getProperties() != null) { + schema.getProperties().values().forEach(this::process); + } + if (schema.getItems() != null) { + process(schema.getItems()); + } } } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java index 387d54bb85..14918e8858 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java @@ -12,7 +12,6 @@ import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.parameters.PathParameter; import io.swagger.v3.oas.models.parameters.QueryParameter; -import org.apache.commons.lang3.StringUtils; import java.io.IOException; @@ -32,7 +31,7 @@ public Parameter deserialize(JsonParser jp, DeserializationContext ctxt) if (sub != null) { result = new Parameter().$ref(sub.asText()); - if (desc != null) { + if (desc != null && openapi31) { result.description(desc.asText()); } diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/matchers/SerializationMatchers.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/matchers/SerializationMatchers.java index 6d463a20d0..75771ba588 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/matchers/SerializationMatchers.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/matchers/SerializationMatchers.java @@ -1,5 +1,6 @@ package io.swagger.v3.core.matchers; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.NumericNode; diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/PatternAndSchemaPropertiesTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/PatternAndSchemaPropertiesTest.java index 9df84b8588..09a7195a94 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/PatternAndSchemaPropertiesTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/PatternAndSchemaPropertiesTest.java @@ -7,6 +7,7 @@ import io.swagger.v3.core.resolving.SwaggerTestBase; import io.swagger.v3.core.resolving.v31.model.AnnotatedPet; import io.swagger.v3.core.resolving.v31.model.AnnotatedPetSinglePatternProperty; +import io.swagger.v3.core.util.OpenAPISchema2JsonSchema; import io.swagger.v3.oas.models.media.Schema; import org.testng.annotations.Test; @@ -92,6 +93,8 @@ public void testPatternAndSchemaProperties() throws Exception { " type: string\n" + " xml:\n" + " name: Tag"); + context.getDefinedModels().values().forEach(s -> new OpenAPISchema2JsonSchema().process(s)); + SerializationMatchers.assertEqualsToYaml31(context.getDefinedModels(), "AnnotatedPet:\n" + " type:\n" + " - object\n" + 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 40ee7ca1e5..018f4ee147 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 @@ -2,8 +2,10 @@ import io.swagger.v3.core.matchers.SerializationMatchers; import io.swagger.v3.core.util.Json; +import io.swagger.v3.core.util.Json31; import io.swagger.v3.core.util.ResourceUtils; import io.swagger.v3.core.util.Yaml; +import io.swagger.v3.core.util.Yaml31; import io.swagger.v3.oas.models.OpenAPI; import org.testng.annotations.Test; @@ -18,13 +20,10 @@ public class OpenAPI3_1SerializationTest { public void testSerializePetstore() throws Exception { final String jsonString = ResourceUtils.loadClassResource(getClass(), "specFiles/3.1.0/petstore-3.1.yaml"); - final OpenAPI swagger = Yaml.mapper().readValue(jsonString, OpenAPI.class); + final OpenAPI swagger = Yaml31.mapper().readValue(jsonString, OpenAPI.class); assertNotNull(swagger); assertEquals(swagger.getInfo().getLicense().getIdentifier(), "test"); - Yaml.prettyPrint(swagger); - Json.prettyPrint(swagger); - - SerializationMatchers.assertEqualsToYaml(swagger, "openapi: 3.1.0\n" + + SerializationMatchers.assertEqualsToYaml31(swagger, "openapi: 3.1.0\n" + "info:\n" + " title: Swagger Petstore\n" + " license:\n" + @@ -112,13 +111,14 @@ public void testSerializePetstore() throws Exception { " required:\n" + " - id\n" + " - name\n" + - " type: object\n" + " properties:\n" + " id:\n" + " type: integer\n" + " format: int64\n" + " name:\n" + - " type: string\n" + + " type:\n" + + " - string\n" + + " - integer\n" + " tag:\n" + " type: string\n" + " Pets:\n" + @@ -129,7 +129,6 @@ public void testSerializePetstore() throws Exception { " required:\n" + " - code\n" + " - message\n" + - " type: object\n" + " properties:\n" + " code:\n" + " type: integer\n" + @@ -149,7 +148,7 @@ public void testSerializePetstore() throws Exception { " \"200\":\n" + " description: Return a 200 status to indicate that the data was received\n" + " successfully"); - SerializationMatchers.assertEqualsToJson(swagger, "{\n" + + SerializationMatchers.assertEqualsToJson31(swagger, "{\n" + " \"openapi\" : \"3.1.0\",\n" + " \"info\" : {\n" + " \"title\" : \"Swagger Petstore\",\n" + @@ -273,14 +272,13 @@ public void testSerializePetstore() throws Exception { " \"schemas\" : {\n" + " \"Pet\" : {\n" + " \"required\" : [ \"id\", \"name\" ],\n" + - " \"type\" : \"object\",\n" + " \"properties\" : {\n" + " \"id\" : {\n" + " \"type\" : \"integer\",\n" + " \"format\" : \"int64\"\n" + " },\n" + " \"name\" : {\n" + - " \"type\" : \"string\"\n" + + " \"type\" : [\"string\", \"integer\"]\n" + " },\n" + " \"tag\" : {\n" + " \"type\" : \"string\"\n" + @@ -295,7 +293,6 @@ public void testSerializePetstore() throws Exception { " },\n" + " \"Error\" : {\n" + " \"required\" : [ \"code\", \"message\" ],\n" + - " \"type\" : \"object\",\n" + " \"properties\" : {\n" + " \"code\" : {\n" + " \"type\" : \"integer\",\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 624b44d64d..3adb26f870 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 @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Objects; @@ -268,6 +269,14 @@ public void setTypes(Set types) { this.types = types; } + @OpenAPI31 + public boolean addType(String type) { + if (types == null) { + types = new LinkedHashSet<>(); + } + return types.add(type); + } + @OpenAPI31 public Schema $schema(String $schema) { this.$schema = $schema; From cbf6e8a427037b0ce23ea866b1f6fd7daba44994 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Thu, 23 Sep 2021 07:50:20 -0500 Subject: [PATCH 28/79] added path items to components object --- .../io/swagger/v3/oas/models/Components.java | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java index f989c3e460..c1e1d3c888 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java @@ -16,6 +16,7 @@ package io.swagger.v3.oas.models; +import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.callbacks.Callback; import io.swagger.v3.oas.models.examples.Example; import io.swagger.v3.oas.models.headers.Header; @@ -53,6 +54,12 @@ public class Components { private Map callbacks = null; private java.util.Map extensions = null; + /** + * @since 2.1.11 (OpenAPI 3.1.0) + */ + @OpenAPI31 + private Map pathItems; + /** * returns the schemas property from a Components instance. * @@ -296,6 +303,37 @@ public Components addCallbacks(String key, Callback callbacksItem) { return this; } + /** + * returns the path items property from a Components instance. + * + * @since 2.1.11 (OpenAPI 3.1.0) + * @return Map<String, PathItem> pathItems + **/ + @OpenAPI31 + public Map getPathItems() { + return pathItems; + } + + @OpenAPI31 + public void setPathItems(Map pathItems) { + this.pathItems = pathItems; + } + + @OpenAPI31 + public Components pathItems(Map pathItems) { + this.pathItems = pathItems; + return this; + } + + @OpenAPI31 + public Components addPathItems(String key, PathItem pathItem) { + if (this.pathItems == null) { + this.pathItems = new LinkedHashMap<>(); + } + this.pathItems.put(key, pathItem); + return this; + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -314,12 +352,13 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.securitySchemes, components.securitySchemes) && Objects.equals(this.links, components.links) && Objects.equals(this.callbacks, components.callbacks) && - Objects.equals(this.extensions, components.extensions); + Objects.equals(this.extensions, components.extensions) && + Objects.equals(this.pathItems, components.pathItems); } @Override public int hashCode() { - return Objects.hash(schemas, responses, parameters, examples, requestBodies, headers, securitySchemes, links, callbacks, extensions); + return Objects.hash(schemas, responses, parameters, examples, requestBodies, headers, securitySchemes, links, callbacks, extensions, pathItems); } public java.util.Map getExtensions() { @@ -367,6 +406,7 @@ public String toString() { sb.append(" securitySchemes: ").append(toIndentedString(securitySchemes)).append("\n"); sb.append(" links: ").append(toIndentedString(links)).append("\n"); sb.append(" callbacks: ").append(toIndentedString(callbacks)).append("\n"); + sb.append(" pathItems: ").append(toIndentedString(pathItems)).append("\n"); sb.append("}"); return sb.toString(); } From ed9d017511f20de434a012360ccd9390e577b535 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Thu, 23 Sep 2021 07:51:51 -0500 Subject: [PATCH 29/79] added summary field on Info object --- .../io/swagger/v3/oas/models/info/Info.java | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java index 9c6f5e3021..2c08601f93 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java @@ -16,6 +16,8 @@ package io.swagger.v3.oas.models.info; +import io.swagger.v3.oas.annotations.OpenAPI31; + import java.util.Objects; /** @@ -31,6 +33,12 @@ public class Info { private String version = null; private java.util.Map extensions = null; + /** + * @since 2.1.11 (OpenAPI 3.1.0) + */ + @OpenAPI31 + private String summary = null; + /** * returns the title property from a Info instance. * @@ -145,6 +153,28 @@ public Info version(String version) { return this; } + /** + * returns the summary property from a Info instance. + * + * @since 2.1.11 (OpenAPI 3.1.0) + * @return String + **/ + @OpenAPI31 + public String getSummary() { + return summary; + } + + @OpenAPI31 + public void setSummary(String summary) { + this.summary = summary; + } + + @OpenAPI31 + public Info summary(String summary) { + this.summary = summary; + return this; + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -160,12 +190,13 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.contact, info.contact) && Objects.equals(this.license, info.license) && Objects.equals(this.version, info.version) && - Objects.equals(this.extensions, info.extensions); + Objects.equals(this.extensions, info.extensions) && + Objects.equals(this.summary, info.summary); } @Override public int hashCode() { - return Objects.hash(title, description, termsOfService, contact, license, version, extensions); + return Objects.hash(title, description, termsOfService, contact, license, version, extensions, summary); } public java.util.Map getExtensions() { @@ -198,6 +229,7 @@ public String toString() { sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); sb.append(" termsOfService: ").append(toIndentedString(termsOfService)).append("\n"); sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); sb.append(" license: ").append(toIndentedString(license)).append("\n"); From 60501156da202209faff844cfb6fc212f8293a8a Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Thu, 23 Sep 2021 18:17:04 -0500 Subject: [PATCH 30/79] added specfic extensions for Discriminator object --- .../v3/oas/models/media/Discriminator.java | 44 +++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Discriminator.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Discriminator.java index cda3f65f2c..d0e1e4cc08 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Discriminator.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Discriminator.java @@ -1,12 +1,21 @@ package io.swagger.v3.oas.models.media; +import io.swagger.v3.oas.annotations.OpenAPI31; + import java.util.LinkedHashMap; import java.util.Map; +import java.util.Objects; public class Discriminator { private String propertyName; private Map mapping; + /** + * @since 2.1.11 (OpenAPI 3.1.0) + */ + @OpenAPI31 + private Map extensions; + public Discriminator propertyName(String propertyName) { this.propertyName = propertyName; return this; @@ -41,6 +50,36 @@ public void setMapping(Map mapping) { this.mapping = mapping; } + /** + * returns the specific extensions from a Discriminator instance. + * + * @since 2.1.11 (OpenAPI 3.1.0) + * @return Map<String, Object> extensions + **/ + @OpenAPI31 + public Map getExtensions() { + return extensions; + } + + @OpenAPI31 + public void setExtensions(Map extensions) { + this.extensions = extensions; + } + + @OpenAPI31 + public void addExtension(String name, Object value) { + if (name == null || name.isEmpty() || !name.startsWith("x-")) { + return; + } + if (name.startsWith("x-oas-") || name.startsWith("x-oai-")) { + return; + } + if (this.extensions == null) { + this.extensions = new java.util.LinkedHashMap<>(); + } + this.extensions.put(name, value); + } + @Override public boolean equals(Object o) { if (this == o) { @@ -61,9 +100,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - int result = propertyName != null ? propertyName.hashCode() : 0; - result = 31 * result + (mapping != null ? mapping.hashCode() : 0); - return result; + return Objects.hash(propertyName, mapping, extensions); } @Override @@ -71,6 +108,7 @@ public String toString() { return "Discriminator{" + "propertyName='" + propertyName + '\'' + ", mapping=" + mapping + + ", extensions=" + extensions + '}'; } } From 012c2a6ca79f7ffd3569c6c50e9fa811f3993034 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Fri, 24 Sep 2021 07:24:44 -0500 Subject: [PATCH 31/79] added set collection to allow roles for non oauth2 nor openIdConnect security schemas. --- .../oas/models/security/SecurityScheme.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java index 26cd646790..dc3fb6df42 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java @@ -16,6 +16,11 @@ package io.swagger.v3.oas.models.security; +import io.swagger.v3.oas.annotations.OpenAPI31; + +import java.util.HashSet; +import java.util.Set; + /** * SecurityScheme * @@ -78,6 +83,11 @@ public String toString() { private OAuthFlows flows = null; private String openIdConnectUrl = null; private java.util.Map extensions = null; + /** + * @since 2.1.11 (OpenAPI 3.1.0) + */ + @OpenAPI31 + private Set roles = null; /** * returns the type property from a SecurityScheme instance. @@ -275,6 +285,34 @@ public SecurityScheme extensions(java.util.Map extensions) { return this; } + /** + * returns a list of roles from a non "oauth2" nor "openIdConnect" SecuritySchema instance. + * + * @since 2.1.11 (OpenAPI 3.1.0) + * @return Set<String> roles + **/ + @OpenAPI31 + public Set getRoles() { + return roles; + } + + public void setRoles(Set roles) { + this.roles = roles; + } + + public SecurityScheme roles(Set roles) { + this.roles = roles; + return this; + } + + public SecurityScheme addRoles(String role) { + if (this.roles == null) { + this.roles = new HashSet<>(); + } + roles.add(role); + return this; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -313,6 +351,9 @@ public boolean equals(Object o) { if (openIdConnectUrl != null ? !openIdConnectUrl.equals(that.openIdConnectUrl) : that.openIdConnectUrl != null) { return false; } + if (roles != null ? !roles.equals(that.roles) : that.roles != null) { + return false; + } return extensions != null ? extensions.equals(that.extensions) : that.extensions == null; } @@ -328,6 +369,7 @@ public int hashCode() { result = 31 * result + (flows != null ? flows.hashCode() : 0); result = 31 * result + (openIdConnectUrl != null ? openIdConnectUrl.hashCode() : 0); result = 31 * result + (extensions != null ? extensions.hashCode() : 0); + result = 31 * result + (roles != null ? roles.hashCode() : 0); return result; } @@ -345,6 +387,7 @@ public String toString() { sb.append(" flows: ").append(toIndentedString(flows)).append("\n"); sb.append(" openIdConnectUrl: ").append(toIndentedString(openIdConnectUrl)).append("\n"); sb.append(" $ref: ").append(toIndentedString($ref)).append("\n"); + sb.append(" roles: ").append(toIndentedString(roles)).append("\n"); sb.append("}"); return sb.toString(); } From b36acc4f9f237a18e21184166c8a2f1e7072a564 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Fri, 24 Sep 2021 09:15:40 -0500 Subject: [PATCH 32/79] handled 'x-oai-' and 'x-oas-' prefixes for oas 3.1 extensions. --- .../io/swagger/v3/oas/models/ExternalDocumentation.java | 8 ++++++++ .../src/main/java/io/swagger/v3/oas/models/OpenAPI.java | 8 ++++++++ .../src/main/java/io/swagger/v3/oas/models/Operation.java | 8 ++++++++ .../src/main/java/io/swagger/v3/oas/models/PathItem.java | 8 ++++++++ .../src/main/java/io/swagger/v3/oas/models/Paths.java | 8 ++++++++ .../java/io/swagger/v3/oas/models/callbacks/Callback.java | 8 ++++++++ .../java/io/swagger/v3/oas/models/examples/Example.java | 8 ++++++++ .../main/java/io/swagger/v3/oas/models/info/Contact.java | 8 ++++++++ .../src/main/java/io/swagger/v3/oas/models/info/Info.java | 8 ++++++++ .../main/java/io/swagger/v3/oas/models/info/License.java | 8 ++++++++ .../main/java/io/swagger/v3/oas/models/links/Link.java | 8 ++++++++ .../io/swagger/v3/oas/models/links/LinkParameter.java | 8 ++++++++ .../java/io/swagger/v3/oas/models/media/Encoding.java | 8 ++++++++ .../io/swagger/v3/oas/models/media/EncodingProperty.java | 8 ++++++++ .../java/io/swagger/v3/oas/models/media/MediaType.java | 8 ++++++++ .../main/java/io/swagger/v3/oas/models/media/Schema.java | 8 ++++++++ .../src/main/java/io/swagger/v3/oas/models/media/XML.java | 8 ++++++++ .../io/swagger/v3/oas/models/parameters/Parameter.java | 8 ++++++++ .../io/swagger/v3/oas/models/parameters/RequestBody.java | 8 ++++++++ .../io/swagger/v3/oas/models/responses/ApiResponse.java | 8 ++++++++ .../io/swagger/v3/oas/models/responses/ApiResponses.java | 8 ++++++++ .../java/io/swagger/v3/oas/models/security/OAuthFlow.java | 8 ++++++++ .../io/swagger/v3/oas/models/security/OAuthFlows.java | 8 ++++++++ .../io/swagger/v3/oas/models/security/SecurityScheme.java | 8 ++++++++ .../java/io/swagger/v3/oas/models/servers/Server.java | 8 ++++++++ .../io/swagger/v3/oas/models/servers/ServerVariable.java | 8 ++++++++ .../src/main/java/io/swagger/v3/oas/models/tags/Tag.java | 8 ++++++++ 27 files changed, 216 insertions(+) diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java index 24a0fbfecf..4f6a6113d2 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java @@ -100,6 +100,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java index c76d97e873..54f0342327 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java @@ -350,6 +350,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java index fbcce358c0..45044351e6 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java @@ -352,6 +352,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java index 799d2dfc3d..bf819837ac 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java @@ -406,6 +406,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java index df58dc90a3..a588c761e4 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java @@ -68,6 +68,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java index 53e6e0e076..d20dd8cf33 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java @@ -100,6 +100,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java index d6c5765cb4..971732cade 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java @@ -137,6 +137,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java index bc20f57d66..16fdfbd42d 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java @@ -121,6 +121,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java index 2c08601f93..e0c29ed41a 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java @@ -213,6 +213,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java index e7fef66606..bc4719b57a 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java @@ -130,6 +130,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java index 15287b7d3f..9f925f1e01 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java @@ -261,6 +261,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/LinkParameter.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/LinkParameter.java index 1689386a29..db244dfb83 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/LinkParameter.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/LinkParameter.java @@ -77,6 +77,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java index 110b169f1c..1c69c89dfb 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java @@ -144,6 +144,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EncodingProperty.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EncodingProperty.java index ba7fd89c89..35f3281f20 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EncodingProperty.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EncodingProperty.java @@ -200,6 +200,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MediaType.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MediaType.java index 3d7b8aa1b1..6699f08bac 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MediaType.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MediaType.java @@ -180,6 +180,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } 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 3adb26f870..30376d4246 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 @@ -1241,6 +1241,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/XML.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/XML.java index a9c646b793..8df18abcf0 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/XML.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/XML.java @@ -163,6 +163,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java index 1f62a98c66..23d101ba1f 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java @@ -391,6 +391,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java index 03ea392fdd..6c0c661605 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java @@ -102,6 +102,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java index 072820b7c0..ee46d41971 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java @@ -182,6 +182,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java index 4a4a807e13..bc5e2917ac 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java @@ -69,6 +69,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java index 30802c6b7d..09aa50519a 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java @@ -142,6 +142,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java index a9d5b9470b..06659a0b00 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java @@ -142,6 +142,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java index dc3fb6df42..dcf041da46 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java @@ -255,6 +255,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java index c6bc0da7a8..232c6efa9f 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java @@ -121,6 +121,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java index 53772d3f2d..97645ee9d8 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java @@ -131,6 +131,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java index f727c1c305..738c6e352c 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java @@ -123,6 +123,14 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + public void addExtension31(String name, Object value) { + // TODO silently fail? + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } From 1ce9bc1334d2231a3f932a8192574a5424e85e0c Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Fri, 24 Sep 2021 18:04:08 -0500 Subject: [PATCH 33/79] added jsonSchemaDialect field. --- .../swagger/v3/oas/models/media/Schema.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) 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 30376d4246..c9e08750da 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 @@ -130,6 +130,8 @@ public Schema specVersion(SpecVersion specVersion) { private String $schema; @OpenAPI31 private String $anchor; + @OpenAPI31 + private String jsonSchemaDialect; @OpenAPI31 public Schema getContains() { @@ -337,6 +339,22 @@ public Schema jsonSchemaImpl(Object jsonSchemaImpl) { return this; } + @OpenAPI31 + public String getJsonSchemaDialect() { + return jsonSchemaDialect; + } + + @OpenAPI31 + public void setJsonSchemaDialect(String jsonSchemaDialect) { + this.jsonSchemaDialect = jsonSchemaDialect; + } + + @OpenAPI31 + public Schema jsonSchemaDialect(String jsonSchemaDialect) { + this.jsonSchemaDialect = jsonSchemaDialect; + return this; + } + /* CONSTRUCTORS */ @@ -1215,7 +1233,8 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.anyOf, schema.anyOf) && Objects.equals(this.oneOf, schema.oneOf) && Objects.equals(this._const, schema._const) && - Objects.equals(this._default, schema._default); + Objects.equals(this._default, schema._default) && + Objects.equals(this.jsonSchemaDialect, schema.jsonSchemaDialect); } @Override @@ -1224,7 +1243,8 @@ public int hashCode() { exclusiveMinimum, exclusiveMinimumValue, maxLength, minLength, pattern, maxItems, minItems, uniqueItems, maxProperties, minProperties, required, type, not, properties, additionalProperties, description, format, $ref, nullable, readOnly, writeOnly, example, externalDocs, deprecated, xml, extensions, - discriminator, _enum, _default, patternProperties, $id, $anchor, $schema, types, allOf, anyOf, oneOf, _const); + discriminator, _enum, _default, patternProperties, $id, $anchor, $schema, types, allOf, anyOf, oneOf, _const, + jsonSchemaDialect); } public java.util.Map getExtensions() { @@ -1302,6 +1322,7 @@ public String toString() { sb.append(" $anchor: ").append(toIndentedString($anchor)).append("\n"); sb.append(" $schema: ").append(toIndentedString($schema)).append("\n"); sb.append(" const: ").append(toIndentedString(_const)).append("\n"); + sb.append(" jsonSchemaDialect: ").append(toIndentedString(jsonSchemaDialect)).append("\n"); } sb.append("}"); return sb.toString(); From efbc0b80b9855268f3fdb6c7b79e4bb5b6b97c36 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Thu, 30 Sep 2021 16:24:06 -0500 Subject: [PATCH 34/79] reverted roles changes on security schema class. --- .../oas/models/security/SecurityScheme.java | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java index dcf041da46..004ed79d68 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java @@ -83,11 +83,6 @@ public String toString() { private OAuthFlows flows = null; private String openIdConnectUrl = null; private java.util.Map extensions = null; - /** - * @since 2.1.11 (OpenAPI 3.1.0) - */ - @OpenAPI31 - private Set roles = null; /** * returns the type property from a SecurityScheme instance. @@ -293,34 +288,6 @@ public SecurityScheme extensions(java.util.Map extensions) { return this; } - /** - * returns a list of roles from a non "oauth2" nor "openIdConnect" SecuritySchema instance. - * - * @since 2.1.11 (OpenAPI 3.1.0) - * @return Set<String> roles - **/ - @OpenAPI31 - public Set getRoles() { - return roles; - } - - public void setRoles(Set roles) { - this.roles = roles; - } - - public SecurityScheme roles(Set roles) { - this.roles = roles; - return this; - } - - public SecurityScheme addRoles(String role) { - if (this.roles == null) { - this.roles = new HashSet<>(); - } - roles.add(role); - return this; - } - @Override public boolean equals(Object o) { if (this == o) { @@ -359,9 +326,6 @@ public boolean equals(Object o) { if (openIdConnectUrl != null ? !openIdConnectUrl.equals(that.openIdConnectUrl) : that.openIdConnectUrl != null) { return false; } - if (roles != null ? !roles.equals(that.roles) : that.roles != null) { - return false; - } return extensions != null ? extensions.equals(that.extensions) : that.extensions == null; } @@ -377,7 +341,6 @@ public int hashCode() { result = 31 * result + (flows != null ? flows.hashCode() : 0); result = 31 * result + (openIdConnectUrl != null ? openIdConnectUrl.hashCode() : 0); result = 31 * result + (extensions != null ? extensions.hashCode() : 0); - result = 31 * result + (roles != null ? roles.hashCode() : 0); return result; } @@ -395,7 +358,6 @@ public String toString() { sb.append(" flows: ").append(toIndentedString(flows)).append("\n"); sb.append(" openIdConnectUrl: ").append(toIndentedString(openIdConnectUrl)).append("\n"); sb.append(" $ref: ").append(toIndentedString($ref)).append("\n"); - sb.append(" roles: ").append(toIndentedString(roles)).append("\n"); sb.append("}"); return sb.toString(); } From af9d2c2c125a4e428edf2f913b2a80d5580b8cc6 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Thu, 30 Sep 2021 17:37:41 -0500 Subject: [PATCH 35/79] added oas 3.1 annotation to `addExtension31` method and removed TODO comment. --- .../io/swagger/v3/oas/models/Components.java | 2 +- .../v3/oas/models/ExternalDocumentation.java | 4 +++- .../java/io/swagger/v3/oas/models/OpenAPI.java | 2 +- .../java/io/swagger/v3/oas/models/Operation.java | 3 ++- .../java/io/swagger/v3/oas/models/PathItem.java | 3 ++- .../java/io/swagger/v3/oas/models/Paths.java | 4 +++- .../v3/oas/models/callbacks/Callback.java | 3 ++- .../swagger/v3/oas/models/examples/Example.java | 4 +++- .../io/swagger/v3/oas/models/info/Contact.java | 4 +++- .../java/io/swagger/v3/oas/models/info/Info.java | 2 +- .../io/swagger/v3/oas/models/info/License.java | 2 +- .../io/swagger/v3/oas/models/links/Link.java | 3 ++- .../v3/oas/models/links/LinkParameter.java | 4 +++- .../io/swagger/v3/oas/models/media/Encoding.java | 3 ++- .../v3/oas/models/media/EncodingProperty.java | 3 ++- .../swagger/v3/oas/models/media/MediaType.java | 3 ++- .../io/swagger/v3/oas/models/media/Schema.java | 2 +- .../java/io/swagger/v3/oas/models/media/XML.java | 4 +++- .../v3/oas/models/parameters/Parameter.java | 3 ++- .../v3/oas/models/parameters/RequestBody.java | 3 ++- .../v3/oas/models/responses/ApiResponse.java | 3 ++- .../v3/oas/models/responses/ApiResponses.java | 4 +++- .../v3/oas/models/security/OAuthFlow.java | 4 +++- .../v3/oas/models/security/OAuthFlows.java | 4 +++- .../v3/oas/models/security/SecurityScheme.java | 16 ++++++++-------- .../io/swagger/v3/oas/models/servers/Server.java | 4 +++- .../v3/oas/models/servers/ServerVariable.java | 4 +++- .../java/io/swagger/v3/oas/models/tags/Tag.java | 3 ++- 28 files changed, 68 insertions(+), 35 deletions(-) diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java index c1e1d3c888..8dc9671422 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java @@ -375,8 +375,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java index 4f6a6113d2..e1fe227a12 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java @@ -16,6 +16,8 @@ package io.swagger.v3.oas.models; +import io.swagger.v3.oas.annotations.OpenAPI31; + import java.util.Objects; /** @@ -100,8 +102,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java index 54f0342327..00a6d4b095 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java @@ -350,8 +350,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java index 45044351e6..d365865973 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java @@ -16,6 +16,7 @@ package io.swagger.v3.oas.models; +import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.callbacks.Callback; import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.parameters.RequestBody; @@ -352,8 +353,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java index bf819837ac..b44d1c1b40 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java @@ -16,6 +16,7 @@ package io.swagger.v3.oas.models; +import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.servers.Server; @@ -406,8 +407,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java index a588c761e4..af9e45a209 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java @@ -16,6 +16,8 @@ package io.swagger.v3.oas.models; +import io.swagger.v3.oas.annotations.OpenAPI31; + import java.util.LinkedHashMap; import java.util.Objects; @@ -68,8 +70,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java index d20dd8cf33..3bf18721b7 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java @@ -16,6 +16,7 @@ package io.swagger.v3.oas.models.callbacks; +import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.PathItem; import java.util.LinkedHashMap; @@ -100,8 +101,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java index 971732cade..211ddbabf9 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java @@ -16,6 +16,8 @@ package io.swagger.v3.oas.models.examples; +import io.swagger.v3.oas.annotations.OpenAPI31; + /** * Example */ @@ -137,8 +139,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java index 16fdfbd42d..172988ade2 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java @@ -16,6 +16,8 @@ package io.swagger.v3.oas.models.info; +import io.swagger.v3.oas.annotations.OpenAPI31; + import java.util.Objects; /** @@ -121,8 +123,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java index e0c29ed41a..c1cbd6369f 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java @@ -213,8 +213,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java index bc4719b57a..11d7189350 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java @@ -130,8 +130,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java index 9f925f1e01..d837935642 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java @@ -16,6 +16,7 @@ package io.swagger.v3.oas.models.links; +import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.headers.Header; import io.swagger.v3.oas.models.servers.Server; @@ -261,8 +262,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/LinkParameter.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/LinkParameter.java index db244dfb83..0b61f15a80 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/LinkParameter.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/LinkParameter.java @@ -16,6 +16,8 @@ package io.swagger.v3.oas.models.links; +import io.swagger.v3.oas.annotations.OpenAPI31; + import java.util.Objects; /** @@ -77,8 +79,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java index 1c69c89dfb..dd3dd6f3bb 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java @@ -16,6 +16,7 @@ package io.swagger.v3.oas.models.media; +import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.headers.Header; import java.util.Map; @@ -144,8 +145,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EncodingProperty.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EncodingProperty.java index 35f3281f20..ad45604a64 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EncodingProperty.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EncodingProperty.java @@ -16,6 +16,7 @@ package io.swagger.v3.oas.models.media; +import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.headers.Header; import java.util.LinkedHashMap; @@ -200,8 +201,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MediaType.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MediaType.java index 6699f08bac..0b3800e45d 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MediaType.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MediaType.java @@ -16,6 +16,7 @@ package io.swagger.v3.oas.models.media; +import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.examples.Example; import java.util.LinkedHashMap; @@ -180,8 +181,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } 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 c9e08750da..d144e5765a 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 @@ -1261,8 +1261,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/XML.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/XML.java index 8df18abcf0..5cb50938a5 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/XML.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/XML.java @@ -16,6 +16,8 @@ package io.swagger.v3.oas.models.media; +import io.swagger.v3.oas.annotations.OpenAPI31; + import java.util.Objects; /** @@ -163,8 +165,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java index 23d101ba1f..b6d56a3566 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java @@ -16,6 +16,7 @@ package io.swagger.v3.oas.models.parameters; +import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.examples.Example; import io.swagger.v3.oas.models.media.Content; import io.swagger.v3.oas.models.media.Schema; @@ -391,8 +392,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java index 6c0c661605..947eaabf9a 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java @@ -16,6 +16,7 @@ package io.swagger.v3.oas.models.parameters; +import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.media.Content; /** @@ -102,8 +103,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java index ee46d41971..728c4a76ba 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java @@ -16,6 +16,7 @@ package io.swagger.v3.oas.models.responses; +import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.headers.Header; import io.swagger.v3.oas.models.links.Link; import io.swagger.v3.oas.models.media.Content; @@ -182,8 +183,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java index bc5e2917ac..03c2a4c18e 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java @@ -16,6 +16,8 @@ package io.swagger.v3.oas.models.responses; +import io.swagger.v3.oas.annotations.OpenAPI31; + import java.util.LinkedHashMap; import java.util.Objects; @@ -69,8 +71,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java index 09aa50519a..0c2329e730 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java @@ -16,6 +16,8 @@ package io.swagger.v3.oas.models.security; +import io.swagger.v3.oas.annotations.OpenAPI31; + import java.util.Objects; /** @@ -142,8 +144,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java index 06659a0b00..7d31965273 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java @@ -16,6 +16,8 @@ package io.swagger.v3.oas.models.security; +import io.swagger.v3.oas.annotations.OpenAPI31; + import java.util.Objects; /** @@ -142,8 +144,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java index 004ed79d68..a0c00fe8fe 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java @@ -240,6 +240,14 @@ public java.util.Map getExtensions() { return extensions; } + @OpenAPI31 + public void addExtension31(String name, Object value) { + if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { + return; + } + addExtension(name, value); + } + public void addExtension(String name, Object value) { if (name == null || name.isEmpty() || !name.startsWith("x-")) { return; @@ -250,14 +258,6 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } - public void addExtension31(String name, Object value) { - // TODO silently fail? - if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { - return; - } - addExtension(name, value); - } - public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java index 232c6efa9f..5ada32920c 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java @@ -16,6 +16,8 @@ package io.swagger.v3.oas.models.servers; +import io.swagger.v3.oas.annotations.OpenAPI31; + import java.util.Objects; /** @@ -121,8 +123,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java index 97645ee9d8..aeff3dbaf2 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java @@ -16,6 +16,8 @@ package io.swagger.v3.oas.models.servers; +import io.swagger.v3.oas.annotations.OpenAPI31; + import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -131,8 +133,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java index 738c6e352c..1e5cc6a041 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java @@ -16,6 +16,7 @@ package io.swagger.v3.oas.models.tags; +import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.ExternalDocumentation; import java.util.Objects; @@ -123,8 +124,8 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } + @OpenAPI31 public void addExtension31(String name, Object value) { - // TODO silently fail? if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { return; } From 7824cb71931d3693e8a4a6e62ea71bc2862aa92a Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Thu, 30 Sep 2021 17:45:29 -0500 Subject: [PATCH 36/79] added extensions on Discriminator equals method --- .../java/io/swagger/v3/oas/models/media/Discriminator.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Discriminator.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Discriminator.java index d0e1e4cc08..4643ae121a 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Discriminator.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Discriminator.java @@ -94,6 +94,9 @@ public boolean equals(Object o) { if (propertyName != null ? !propertyName.equals(that.propertyName) : that.propertyName != null) { return false; } + if (extensions != null ? !extensions.equals(that.extensions) : that.extensions != null) { + return false; + } return mapping != null ? mapping.equals(that.mapping) : that.mapping == null; } From 4a425ba09cee912d46aee3da970b7bc552479f39 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Thu, 30 Sep 2021 17:46:17 -0500 Subject: [PATCH 37/79] removed addExtension31 method from Schema class --- .../main/java/io/swagger/v3/oas/models/media/Schema.java | 8 -------- 1 file changed, 8 deletions(-) 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 d144e5765a..e4f9cfce2f 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 @@ -1261,14 +1261,6 @@ public void addExtension(String name, Object value) { this.extensions.put(name, value); } - @OpenAPI31 - public void addExtension31(String name, Object value) { - if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) { - return; - } - addExtension(name, value); - } - public void setExtensions(java.util.Map extensions) { this.extensions = extensions; } From ae62bd2190c4e175bff3565e413961c4f6b25b87 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Thu, 30 Sep 2021 21:43:14 -0500 Subject: [PATCH 38/79] Revert "added jsonSchemaDialect field." This reverts commit de632e55078f71c23045298c6deb38c2affc8e24. --- .../swagger/v3/oas/models/media/Schema.java | 25 ++----------------- 1 file changed, 2 insertions(+), 23 deletions(-) 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 e4f9cfce2f..3adb26f870 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 @@ -130,8 +130,6 @@ public Schema specVersion(SpecVersion specVersion) { private String $schema; @OpenAPI31 private String $anchor; - @OpenAPI31 - private String jsonSchemaDialect; @OpenAPI31 public Schema getContains() { @@ -339,22 +337,6 @@ public Schema jsonSchemaImpl(Object jsonSchemaImpl) { return this; } - @OpenAPI31 - public String getJsonSchemaDialect() { - return jsonSchemaDialect; - } - - @OpenAPI31 - public void setJsonSchemaDialect(String jsonSchemaDialect) { - this.jsonSchemaDialect = jsonSchemaDialect; - } - - @OpenAPI31 - public Schema jsonSchemaDialect(String jsonSchemaDialect) { - this.jsonSchemaDialect = jsonSchemaDialect; - return this; - } - /* CONSTRUCTORS */ @@ -1233,8 +1215,7 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.anyOf, schema.anyOf) && Objects.equals(this.oneOf, schema.oneOf) && Objects.equals(this._const, schema._const) && - Objects.equals(this._default, schema._default) && - Objects.equals(this.jsonSchemaDialect, schema.jsonSchemaDialect); + Objects.equals(this._default, schema._default); } @Override @@ -1243,8 +1224,7 @@ public int hashCode() { exclusiveMinimum, exclusiveMinimumValue, maxLength, minLength, pattern, maxItems, minItems, uniqueItems, maxProperties, minProperties, required, type, not, properties, additionalProperties, description, format, $ref, nullable, readOnly, writeOnly, example, externalDocs, deprecated, xml, extensions, - discriminator, _enum, _default, patternProperties, $id, $anchor, $schema, types, allOf, anyOf, oneOf, _const, - jsonSchemaDialect); + discriminator, _enum, _default, patternProperties, $id, $anchor, $schema, types, allOf, anyOf, oneOf, _const); } public java.util.Map getExtensions() { @@ -1314,7 +1294,6 @@ public String toString() { sb.append(" $anchor: ").append(toIndentedString($anchor)).append("\n"); sb.append(" $schema: ").append(toIndentedString($schema)).append("\n"); sb.append(" const: ").append(toIndentedString(_const)).append("\n"); - sb.append(" jsonSchemaDialect: ").append(toIndentedString(jsonSchemaDialect)).append("\n"); } sb.append("}"); return sb.toString(); From 2fe3218db6d68dbb343f1c09172fc2223376dfed Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Thu, 30 Sep 2021 22:02:12 -0500 Subject: [PATCH 39/79] added `jsonSchemaDialect` field to OpenAPI class. --- .../io/swagger/v3/oas/models/OpenAPI.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java index 00a6d4b095..77c22420af 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java @@ -48,6 +48,9 @@ public class OpenAPI { private Components components = null; private java.util.Map extensions = null; + @OpenAPI31 + private String jsonSchemaDialect; + public OpenAPI() {} public OpenAPI(SpecVersion specVersion) { this.specVersion = specVersion;} private SpecVersion specVersion = SpecVersion.V30; @@ -309,6 +312,22 @@ public OpenAPI addWebhooks(String key, PathItem pathItem) { return this; } + @OpenAPI31 + public String getJsonSchemaDialect() { + return jsonSchemaDialect; + } + + @OpenAPI31 + public void setJsonSchemaDialect(String jsonSchemaDialect) { + this.jsonSchemaDialect = jsonSchemaDialect; + } + + @OpenAPI31 + public OpenAPI jsonSchemaDialect(String jsonSchemaDialect) { + this.jsonSchemaDialect = jsonSchemaDialect; + return this; + } + @Override public boolean equals(java.lang.Object o) { @@ -328,12 +347,13 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.paths, openAPI.paths) && Objects.equals(this.components, openAPI.components) && Objects.equals(this.webhooks, openAPI.webhooks) && - Objects.equals(this.extensions, openAPI.extensions); + Objects.equals(this.extensions, openAPI.extensions) && + Objects.equals(this.jsonSchemaDialect, openAPI.jsonSchemaDialect); } @Override public int hashCode() { - return Objects.hash(openapi, info, externalDocs, servers, security, tags, paths, components, webhooks, extensions); + return Objects.hash(openapi, info, externalDocs, servers, security, tags, paths, components, webhooks, extensions, jsonSchemaDialect); } public java.util.Map getExtensions() { @@ -381,6 +401,7 @@ public String toString() { sb.append(" paths: ").append(toIndentedString(paths)).append("\n"); sb.append(" components: ").append(toIndentedString(components)).append("\n"); if (specVersion == SpecVersion.V31) sb.append(" webhooks: ").append(toIndentedString(webhooks)).append("\n"); + sb.append(" jsonSchemaDialect: ").append(toIndentedString(jsonSchemaDialect)).append("\n"); sb.append("}"); return sb.toString(); } From bfd7f822efab19f12e75732562a7ce4775152d7f Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Fri, 1 Oct 2021 01:45:40 -0500 Subject: [PATCH 40/79] tweaked fluent accessors on Link, Encoding, ApiResponse and Operation class. --- .../main/java/io/swagger/v3/oas/models/Operation.java | 9 +++++++++ .../main/java/io/swagger/v3/oas/models/links/Link.java | 8 ++++++-- .../java/io/swagger/v3/oas/models/media/Encoding.java | 9 +++++++++ .../io/swagger/v3/oas/models/responses/ApiResponse.java | 9 +++++++-- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java index d365865973..1972ff67ee 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java @@ -25,6 +25,7 @@ import io.swagger.v3.oas.models.servers.Server; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Objects; @@ -237,6 +238,14 @@ public Operation callbacks(Map callbacks) { return this; } + public Operation addCallbacks(String key, Callback callback) { + if (this.callbacks == null) { + this.callbacks = new LinkedHashMap<>(); + } + this.callbacks.put(key, callback); + return this; + } + /** * returns the deprecated property from a Operation instance. * diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java index d837935642..adff653f54 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java @@ -124,12 +124,16 @@ public void setParameters(Map parameters) { this.parameters = parameters; } - public Link parameters(String name, String parameter) { + public Link parameters(Map parameters) { + this.parameters = parameters; + return this; + } + + public Link addParameters(String name, String parameter) { if (this.parameters == null) { this.parameters = new LinkedHashMap<>(); } this.parameters.put(name, parameter); - return this; } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java index dd3dd6f3bb..5ca9e45d47 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java @@ -19,6 +19,7 @@ import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.headers.Header; +import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; @@ -92,6 +93,14 @@ public void setHeaders(Map headers) { this.headers = headers; } + public Encoding addHeader(String name, Header header) { + if (this.headers == null) { + this.headers = new LinkedHashMap<>(); + } + this.headers.put(name, header); + return this; + } + public Encoding style(StyleEnum style) { this.style = style; return this; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java index 728c4a76ba..39a05a2a5f 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java @@ -114,11 +114,16 @@ public java.util.Map getLinks() { return links; } - public void setLinks(java.util.Map links) { + public void setLinks(Map links) { this.links = links; } - public ApiResponse link(String name, Link link) { + public ApiResponse link(Map links) { + this.links = links; + return this; + } + + public ApiResponse addLink(String name, Link link) { if (this.links == null) { this.links = new LinkedHashMap<>(); } From e7f10032b3faab2bf362a68070c8e7b47831a681 Mon Sep 17 00:00:00 2001 From: frantuma Date: Mon, 4 Oct 2021 16:21:20 +0200 Subject: [PATCH 41/79] OpenAPI 3.1 - fix tests after accessors fixes --- .../io/swagger/v3/core/converting/SwaggerSerializerTest.java | 4 ++-- .../java/io/swagger/v3/oas/models/responses/ApiResponse.java | 4 ++-- .../src/test/java/io/swagger/test/SimpleBuilderTest.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/SwaggerSerializerTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/SwaggerSerializerTest.java index 40045ddc71..3909559474 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/SwaggerSerializerTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/SwaggerSerializerTest.java @@ -102,10 +102,10 @@ public void convertSpec() throws IOException { final ApiResponse errorResponse = new ApiResponse() .description("error response") - .link("myLink", new Link() + .addLink("myLink", new Link() .description("a link") .operationId("theLinkedOperationId") - .parameters("userId", "gah") + .addParameters("userId", "gah") ) .content(new Content() .addMediaType("application/json", new MediaType() diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java index 39a05a2a5f..a4f4336aaf 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java @@ -110,7 +110,7 @@ public ApiResponse content(Content content) { * @return Link links **/ - public java.util.Map getLinks() { + public Map getLinks() { return links; } @@ -118,7 +118,7 @@ public void setLinks(Map links) { this.links = links; } - public ApiResponse link(Map links) { + public ApiResponse links(Map links) { this.links = links; return this; } diff --git a/modules/swagger-models/src/test/java/io/swagger/test/SimpleBuilderTest.java b/modules/swagger-models/src/test/java/io/swagger/test/SimpleBuilderTest.java index 2dd5a6b8fa..45f82dbea1 100644 --- a/modules/swagger-models/src/test/java/io/swagger/test/SimpleBuilderTest.java +++ b/modules/swagger-models/src/test/java/io/swagger/test/SimpleBuilderTest.java @@ -112,7 +112,7 @@ public void testBuilder() throws Exception { new MediaType().schema(new Schema() .$ref("#/components/schemas/Address"))) ) - .link("funky", new Link() + .addLink("funky", new Link() .operationId("getFunky"))) ) ) From c6d2b50112d7a280f7604deb6022239219d912a1 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Fri, 3 Dec 2021 12:19:07 -0500 Subject: [PATCH 42/79] updated oas 3.1 properties on schema class. --- .../swagger/v3/oas/models/media/Schema.java | 361 +++++++++++++++++- 1 file changed, 358 insertions(+), 3 deletions(-) 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 3adb26f870..301b4c6d88 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 @@ -40,8 +40,12 @@ */ public class Schema { + @OpenAPI30 protected T _default; + @OpenAPI31 + protected Schema defaultSchema; + private String name; private String title = null; private BigDecimal multipleOf = null; @@ -131,6 +135,39 @@ public Schema specVersion(SpecVersion specVersion) { @OpenAPI31 private String $anchor; + @OpenAPI31 + private String contentEncoding; + @OpenAPI31 + private String contentMediaType; + @OpenAPI31 + private Schema contentSchema; + @OpenAPI31 + private Schema propertyNames; + @OpenAPI31 + private Schema unevaluatedProperties; + @OpenAPI31 + private Integer maxContains; + @OpenAPI31 + private Integer minContains; + @OpenAPI31 + private Schema additionalItems; + @OpenAPI31 + private Schema unevaluatedItems; + @OpenAPI31 + private Schema _if; + @OpenAPI31 + private Schema _else; + @OpenAPI31 + private Schema then; + @OpenAPI31 + private Map dependentSchemas; + @OpenAPI31 + private Map> dependentRequired; + @OpenAPI31 + private String $comment; + @OpenAPI31 + private List examples; + @OpenAPI31 public Schema getContains() { return contains; @@ -1162,6 +1199,286 @@ public void setExampleSetFlag(boolean exampleSetFlag) { this.exampleSetFlag = exampleSetFlag; } + @OpenAPI31 + public Schema getDefaultSchema() { + return defaultSchema; + } + + @OpenAPI31 + public void setDefaultSchema(Schema defaultSchema) { + this.defaultSchema = defaultSchema; + } + + @OpenAPI31 + public Schema defaultSchema(Schema defaultSchema) { + this.defaultSchema = defaultSchema; + return this; + } + + @OpenAPI31 + public String getContentEncoding() { + return contentEncoding; + } + + @OpenAPI31 + public void setContentEncoding(String contentEncoding) { + this.contentEncoding = contentEncoding; + } + + @OpenAPI31 + public Schema contentEncoding(String contentEncoding) { + this.contentEncoding = contentEncoding; + return this; + } + + @OpenAPI31 + public String getContentMediaType() { + return contentMediaType; + } + + @OpenAPI31 + public void setContentMediaType(String contentMediaType) { + this.contentMediaType = contentMediaType; + } + + @OpenAPI31 + public Schema contentMediaType(String contentMediaType) { + this.contentMediaType = contentMediaType; + return this; + } + + @OpenAPI31 + public Schema getContentSchema() { + return contentSchema; + } + + @OpenAPI31 + public void setContentSchema(Schema contentSchema) { + this.contentSchema = contentSchema; + } + + @OpenAPI31 + public Schema contentSchema(Schema contentSchema) { + this.contentSchema = contentSchema; + return this; + } + + @OpenAPI31 + public Schema getPropertyNames() { + return propertyNames; + } + + @OpenAPI31 + public void setPropertyNames(Schema propertyNames) { + this.propertyNames = propertyNames; + } + + @OpenAPI31 + public Schema propertyNames(Schema propertyNames) { + this.propertyNames = propertyNames; + return this; + } + + @OpenAPI31 + public Schema getUnevaluatedProperties() { + return unevaluatedProperties; + } + + @OpenAPI31 + public void setUnevaluatedProperties(Schema unevaluatedProperties) { + this.unevaluatedProperties = unevaluatedProperties; + } + + @OpenAPI31 + public Schema unevaluatedProperties(Schema unevaluatedProperties) { + this.unevaluatedProperties = unevaluatedProperties; + return this; + } + + @OpenAPI31 + public Integer getMaxContains() { + return maxContains; + } + + @OpenAPI31 + public void setMaxContains(Integer maxContains) { + this.maxContains = maxContains; + } + + @OpenAPI31 + public Schema maxContains(Integer maxContains) { + this.maxContains = maxContains; + return this; + } + + @OpenAPI31 + public Integer getMinContains() { + return minContains; + } + + @OpenAPI31 + public void setMinContains(Integer minContains) { + this.minContains = minContains; + } + + @OpenAPI31 + public Schema minContains(Integer minContains) { + this.minContains = minContains; + return this; + } + + @OpenAPI31 + public Schema getAdditionalItems() { + return additionalItems; + } + + @OpenAPI31 + public void setAdditionalItems(Schema additionalItems) { + this.additionalItems = additionalItems; + } + + @OpenAPI31 + public Schema additionalItems(Schema additionalItems) { + this.additionalItems = additionalItems; + return this; + } + + @OpenAPI31 + public Schema getUnevaluatedItems() { + return unevaluatedItems; + } + + @OpenAPI31 + public void setUnevaluatedItems(Schema unevaluatedItems) { + this.unevaluatedItems = unevaluatedItems; + } + + @OpenAPI31 + public Schema unevaluatedItems(Schema unevaluatedItems) { + this.unevaluatedItems = unevaluatedItems; + return this; + } + + @OpenAPI31 + public Schema getIf() { + return _if; + } + + @OpenAPI31 + public void setIf(Schema _if) { + this._if = _if; + } + + @OpenAPI31 + public Schema _if(Schema _if) { + this._if = _if; + return this; + } + + @OpenAPI31 + public Schema getElse() { + return _else; + } + + @OpenAPI31 + public void setElse(Schema _else) { + this._else = _else; + } + + @OpenAPI31 + public Schema _else(Schema _else) { + this._else = _else; + return this; + } + + @OpenAPI31 + public Schema getThen() { + return then; + } + + @OpenAPI31 + public void setThen(Schema then) { + this.then = then; + } + + @OpenAPI31 + public Schema then(Schema then) { + this.then = then; + return this; + } + + @OpenAPI31 + public Map getDependentSchemas() { + return dependentSchemas; + } + + @OpenAPI31 + public void setDependentSchemas(Map dependentSchemas) { + this.dependentSchemas = dependentSchemas; + } + + @OpenAPI31 + public Schema dependentSchemas(Map dependentSchemas) { + this.dependentSchemas = dependentSchemas; + return this; + } + + @OpenAPI31 + public Map> getDependentRequired() { + return dependentRequired; + } + + @OpenAPI31 + public void setDependentRequired(Map> dependentRequired) { + this.dependentRequired = dependentRequired; + } + + @OpenAPI31 + public Schema dependentRequired(Map> dependentRequired) { + this.dependentRequired = dependentRequired; + return this; + } + + @OpenAPI31 + public String get$comment() { + return $comment; + } + + @OpenAPI31 + public void set$comment(String $comment) { + this.$comment = $comment; + } + + @OpenAPI31 + public Schema $comment(String $comment) { + this.$comment = $comment; + return this; + } + + @OpenAPI31 + public List getExamples() { + return examples; + } + + @OpenAPI31 + public void setExamples(List examples) { + this.examples = examples; + } + + @OpenAPI31 + public Schema examples(List examples) { + this.examples = examples; + return this; + } + + @OpenAPI31 + public void addExample(T example) { + if (this.examples == null) { + this.examples = new ArrayList<>(); + } + this.examples.add(example); + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -1215,7 +1532,26 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.anyOf, schema.anyOf) && Objects.equals(this.oneOf, schema.oneOf) && Objects.equals(this._const, schema._const) && - Objects.equals(this._default, schema._default); + Objects.equals(this._default, schema._default) && + Objects.equals(this.defaultSchema, schema.defaultSchema) && + Objects.equals(this.contentEncoding, schema.contentEncoding) && + Objects.equals(this.contentMediaType, schema.contentMediaType) && + Objects.equals(this.contentSchema, schema.contentSchema) && + Objects.equals(this.propertyNames, schema.propertyNames) && + Objects.equals(this.unevaluatedProperties, schema.unevaluatedProperties) && + Objects.equals(this.maxContains, schema.maxContains) && + Objects.equals(this.minContains, schema.minContains) && + Objects.equals(this.additionalItems, schema.additionalItems) && + Objects.equals(this.unevaluatedItems, schema.unevaluatedItems) && + Objects.equals(this._if, schema._if) && + Objects.equals(this._else, schema._else) && + Objects.equals(this.then, schema.then) && + Objects.equals(this.dependentRequired, schema.dependentRequired) && + Objects.equals(this.dependentSchemas, schema.dependentSchemas) && + Objects.equals(this.$comment, schema.$comment) && + Objects.equals(this.examples, schema.examples) + + ; } @Override @@ -1224,7 +1560,11 @@ public int hashCode() { exclusiveMinimum, exclusiveMinimumValue, maxLength, minLength, pattern, maxItems, minItems, uniqueItems, maxProperties, minProperties, required, type, not, properties, additionalProperties, description, format, $ref, nullable, readOnly, writeOnly, example, externalDocs, deprecated, xml, extensions, - discriminator, _enum, _default, patternProperties, $id, $anchor, $schema, types, allOf, anyOf, oneOf, _const); + discriminator, _enum, _default, patternProperties, $id, $anchor, $schema, types, allOf, anyOf, oneOf, _const, + contentEncoding, contentMediaType, contentSchema, propertyNames, unevaluatedProperties, maxContains, + minContains, additionalItems, unevaluatedItems, _if, _else, then, dependentRequired, dependentSchemas, + $comment, examples, defaultSchema + ); } public java.util.Map getExtensions() { @@ -1232,7 +1572,7 @@ public java.util.Map getExtensions() { } public void addExtension(String name, Object value) { - if (name == null || name.isEmpty() || !name.startsWith("x-")) { + if (name == null || name.isEmpty() || (specVersion == SpecVersion.V30 && !name.startsWith("x-"))) { return; } if (this.extensions == null) { @@ -1294,6 +1634,21 @@ public String toString() { sb.append(" $anchor: ").append(toIndentedString($anchor)).append("\n"); sb.append(" $schema: ").append(toIndentedString($schema)).append("\n"); sb.append(" const: ").append(toIndentedString(_const)).append("\n"); + sb.append(" contentEncoding: ").append(toIndentedString(contentEncoding)).append("\n"); + sb.append(" contentMediaType: ").append(toIndentedString(contentMediaType)).append("\n"); + sb.append(" contentSchema: ").append(toIndentedString(contentSchema)).append("\n"); + sb.append(" propertyNames: ").append(toIndentedString(propertyNames)).append("\n"); + sb.append(" unevaluatedProperties: ").append(toIndentedString(unevaluatedProperties)).append("\n"); + sb.append(" maxContains: ").append(toIndentedString(maxContains)).append("\n"); + sb.append(" minContains: ").append(toIndentedString(minContains)).append("\n"); + sb.append(" additionalItems: ").append(toIndentedString(additionalItems)).append("\n"); + sb.append(" unevaluatedItems: ").append(toIndentedString(unevaluatedItems)).append("\n"); + sb.append(" _if: ").append(toIndentedString(_if)).append("\n"); + sb.append(" _else: ").append(toIndentedString(_else)).append("\n"); + sb.append(" then: ").append(toIndentedString(then)).append("\n"); + sb.append(" dependentRequired: ").append(toIndentedString(dependentRequired)).append("\n"); + sb.append(" dependentSchemas: ").append(toIndentedString(dependentSchemas)).append("\n"); + sb.append(" $comment: ").append(toIndentedString($comment)).append("\n"); } sb.append("}"); return sb.toString(); From 325ac9341cdd3131a086433a6ca8ad270b14c1ef Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Fri, 3 Dec 2021 22:30:09 -0500 Subject: [PATCH 43/79] removed extra line --- .../src/main/java/io/swagger/v3/oas/models/media/Schema.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 301b4c6d88..e294a0aa61 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 @@ -1563,8 +1563,7 @@ public int hashCode() { discriminator, _enum, _default, patternProperties, $id, $anchor, $schema, types, allOf, anyOf, oneOf, _const, contentEncoding, contentMediaType, contentSchema, propertyNames, unevaluatedProperties, maxContains, minContains, additionalItems, unevaluatedItems, _if, _else, then, dependentRequired, dependentSchemas, - $comment, examples, defaultSchema - ); + $comment, examples, defaultSchema); } public java.util.Map getExtensions() { From ae94b0f139b6fb3d19042e1d59a23c52b060f35e Mon Sep 17 00:00:00 2001 From: gracekarina Date: Sun, 12 Dec 2021 12:09:14 -0500 Subject: [PATCH 44/79] add prefixItems fields and methods --- .../swagger/v3/oas/models/media/Schema.java | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) 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 e294a0aa61..93d1a9cd66 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 @@ -84,7 +84,8 @@ public class Schema { private Discriminator discriminator = null; private boolean exampleSetFlag; - + @OpenAPI31 + private List prefixItems = null; private List allOf = null; private List anyOf = null; private List oneOf = null; @@ -1215,6 +1216,22 @@ public Schema defaultSchema(Schema defaultSchema) { return this; } + @OpenAPI31 + public List getPrefixItems() { + return prefixItems; + } + + @OpenAPI31 + public void setPrefixItems(List prefixItems) { + this.prefixItems = prefixItems; + } + + @OpenAPI31 + public Schema prefixItems(List prefixItems) { + this.prefixItems = prefixItems; + return this; + } + @OpenAPI31 public String getContentEncoding() { return contentEncoding; @@ -1549,7 +1566,8 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.dependentRequired, schema.dependentRequired) && Objects.equals(this.dependentSchemas, schema.dependentSchemas) && Objects.equals(this.$comment, schema.$comment) && - Objects.equals(this.examples, schema.examples) + Objects.equals(this.examples, schema.examples) && + Objects.equals(this.prefixItems, schema.prefixItems) ; } @@ -1563,7 +1581,7 @@ public int hashCode() { discriminator, _enum, _default, patternProperties, $id, $anchor, $schema, types, allOf, anyOf, oneOf, _const, contentEncoding, contentMediaType, contentSchema, propertyNames, unevaluatedProperties, maxContains, minContains, additionalItems, unevaluatedItems, _if, _else, then, dependentRequired, dependentSchemas, - $comment, examples, defaultSchema); + $comment, examples, defaultSchema, prefixItems); } public java.util.Map getExtensions() { @@ -1648,6 +1666,7 @@ public String toString() { sb.append(" dependentRequired: ").append(toIndentedString(dependentRequired)).append("\n"); sb.append(" dependentSchemas: ").append(toIndentedString(dependentSchemas)).append("\n"); sb.append(" $comment: ").append(toIndentedString($comment)).append("\n"); + sb.append(" prefixItems: ").append(toIndentedString(prefixItems)).append("\n"); } sb.append("}"); return sb.toString(); @@ -1691,7 +1710,5 @@ public Schema _const(Object _const) { this._const = cast(_const); return this; } - - } From 6a932a86cc8b3d91ffe2d80cf0864a5b656df365 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Mon, 22 Nov 2021 04:37:28 -0500 Subject: [PATCH 45/79] added mixin to handle new openapi 3.1 fields: info.summary, license.identifier, webhooks, components.pahitems --- .../swagger/v3/core/jackson/mixin/ComponentsMixin.java | 5 +++++ .../java/io/swagger/v3/core/jackson/mixin/InfoMixin.java | 9 +++++++++ .../io/swagger/v3/core/jackson/mixin/LicenseMixin.java | 9 +++++++++ .../io/swagger/v3/core/jackson/mixin/OpenAPIMixin.java | 5 +++++ .../io/swagger/v3/core/util/ObjectMapperFactory.java | 8 ++++++-- 5 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/InfoMixin.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/LicenseMixin.java diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ComponentsMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ComponentsMixin.java index 14b25b3c79..ec6423126b 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ComponentsMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ComponentsMixin.java @@ -2,8 +2,10 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import io.swagger.v3.core.jackson.CallbackSerializer; +import io.swagger.v3.oas.models.PathItem; import io.swagger.v3.oas.models.callbacks.Callback; import java.util.Map; @@ -19,4 +21,7 @@ public abstract class ComponentsMixin { @JsonSerialize(contentUsing = CallbackSerializer.class) public abstract Map getCallbacks(); + @JsonIgnore + public abstract Map getPathItems(); + } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/InfoMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/InfoMixin.java new file mode 100644 index 0000000000..9cf4a064e7 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/InfoMixin.java @@ -0,0 +1,9 @@ +package io.swagger.v3.core.jackson.mixin; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +public abstract class InfoMixin { + + @JsonIgnore + public abstract String getSummary(); +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/LicenseMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/LicenseMixin.java new file mode 100644 index 0000000000..fb970b9d7a --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/LicenseMixin.java @@ -0,0 +1,9 @@ +package io.swagger.v3.core.jackson.mixin; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +public abstract class LicenseMixin { + + @JsonIgnore + public abstract String getIdentifier(); +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/OpenAPIMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/OpenAPIMixin.java index e43b1b2152..b2296e8b39 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/OpenAPIMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/OpenAPIMixin.java @@ -2,8 +2,10 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import io.swagger.v3.core.jackson.PathsSerializer; +import io.swagger.v3.oas.models.PathItem; import io.swagger.v3.oas.models.Paths; import java.util.Map; @@ -17,4 +19,7 @@ public abstract class OpenAPIMixin { @JsonSerialize(using = PathsSerializer.class) public abstract Paths getPaths(); + + @JsonIgnore + public abstract Map getWebhooks(); } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java index 7d54a4b69f..3186c2896f 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java @@ -21,6 +21,8 @@ import io.swagger.v3.core.jackson.mixin.DateSchemaMixin; import io.swagger.v3.core.jackson.mixin.ExampleMixin; import io.swagger.v3.core.jackson.mixin.ExtensionsMixin; +import io.swagger.v3.core.jackson.mixin.InfoMixin; +import io.swagger.v3.core.jackson.mixin.LicenseMixin; import io.swagger.v3.core.jackson.mixin.MediaTypeMixin; import io.swagger.v3.core.jackson.mixin.OpenAPIMixin; import io.swagger.v3.core.jackson.mixin.OperationMixin; @@ -148,7 +150,6 @@ public JsonSerializer modifySerializer( sourceMixins.put(ApiResponses.class, ExtensionsMixin.class); sourceMixins.put(ApiResponse.class, ExtensionsMixin.class); sourceMixins.put(Callback.class, ExtensionsMixin.class); - sourceMixins.put(Components.class, ComponentsMixin.class); sourceMixins.put(Contact.class, ExtensionsMixin.class); sourceMixins.put(Encoding.class, ExtensionsMixin.class); sourceMixins.put(EncodingProperty.class, ExtensionsMixin.class); @@ -162,7 +163,6 @@ public JsonSerializer modifySerializer( sourceMixins.put(MediaType.class, MediaTypeMixin.class); sourceMixins.put(OAuthFlow.class, ExtensionsMixin.class); sourceMixins.put(OAuthFlows.class, ExtensionsMixin.class); - sourceMixins.put(OpenAPI.class, OpenAPIMixin.class); sourceMixins.put(Operation.class, OperationMixin.class); sourceMixins.put(Parameter.class, ExtensionsMixin.class); sourceMixins.put(PathItem.class, ExtensionsMixin.class); @@ -179,6 +179,10 @@ public JsonSerializer modifySerializer( if (!openapi31) { sourceMixins.put(Schema.class, SchemaMixin.class); sourceMixins.put(DateSchema.class, DateSchemaMixin.class); + sourceMixins.put(Components.class, ComponentsMixin.class); + sourceMixins.put(Info.class, InfoMixin.class); + sourceMixins.put(License.class, LicenseMixin.class); + sourceMixins.put(OpenAPI.class, OpenAPIMixin.class); } else { sourceMixins.put(Schema.class, Schema31Mixin.class); sourceMixins.put(DateSchema.class, DateSchemaMixin.class); From d209767091ed1020413971ac99d99004f2f21938 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Mon, 22 Nov 2021 04:37:48 -0500 Subject: [PATCH 46/79] added serialization tests --- .../OpenAPI3_1SerializationTest.java | 216 +++++++++++++++++- 1 file changed, 214 insertions(+), 2 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 018f4ee147..3be510d3e5 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 @@ -6,11 +6,19 @@ import io.swagger.v3.core.util.ResourceUtils; import io.swagger.v3.core.util.Yaml; import io.swagger.v3.core.util.Yaml31; +import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.PathItem; +import io.swagger.v3.oas.models.info.Contact; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.info.License; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.media.StringSchema; +import io.swagger.v3.oas.models.responses.ApiResponse; +import io.swagger.v3.oas.models.responses.ApiResponses; import org.testng.annotations.Test; -import java.util.Map; - import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; @@ -329,4 +337,208 @@ public void testSerializePetstore() throws Exception { "}"); } + + @Test + public void testInfoSerialization() { + OpenAPI openAPI = new OpenAPI() + .openapi("3.1.0") + .info(new Info() + .title("Title test") + .description("This is a description for test") + .summary("Test Summary") + .version("1.0.0") + .termsOfService("https://test.term.of.services") + .contact(new Contact() + .name("Test Contact") + .url("https://test.contact.url") + .email("test@email.com")) + .license(new License() + .name("test license") + .url("https://test.license.com") + .identifier("swagger"))); + SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + + "info:\n" + + " title: Title test\n" + + " description: This is a description for test\n" + + " summary: Test Summary\n" + + " termsOfService: https://test.term.of.services\n" + + " contact:\n" + + " name: Test Contact\n" + + " url: https://test.contact.url\n" + + " email: test@email.com\n" + + " license:\n" + + " name: test license\n" + + " url: https://test.license.com\n" + + " identifier: swagger\n" + + " version: 1.0.0"); + + SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + + " \"openapi\" : \"3.1.0\",\n" + + " \"info\" : {\n" + + " \"title\" : \"Title test\",\n" + + " \"description\" : \"This is a description for test\",\n" + + " \"summary\" : \"Test Summary\",\n" + + " \"termsOfService\" : \"https://test.term.of.services\",\n" + + " \"contact\" : {\n" + + " \"name\" : \"Test Contact\",\n" + + " \"url\" : \"https://test.contact.url\",\n" + + " \"email\" : \"test@email.com\"\n" + + " },\n" + + " \"license\" : {\n" + + " \"name\" : \"test license\",\n" + + " \"url\" : \"https://test.license.com\",\n" + + " \"identifier\" : \"swagger\"\n" + + " },\n" + + " \"version\" : \"1.0.0\"\n" + + " }\n" + + "}"); + + openAPI.setOpenapi("3.0.3"); + SerializationMatchers.assertEqualsToYaml(openAPI, "openapi: 3.0.3\n" + + "info:\n" + + " title: Title test\n" + + " description: This is a description for test\n" + + " termsOfService: https://test.term.of.services\n" + + " contact:\n" + + " name: Test Contact\n" + + " url: https://test.contact.url\n" + + " email: test@email.com\n" + + " license:\n" + + " name: test license\n" + + " url: https://test.license.com\n" + + " version: 1.0.0"); + + SerializationMatchers.assertEqualsToJson(openAPI, "{\n" + + " \"openapi\" : \"3.0.3\",\n" + + " \"info\" : {\n" + + " \"title\" : \"Title test\",\n" + + " \"description\" : \"This is a description for test\",\n" + + " \"termsOfService\" : \"https://test.term.of.services\",\n" + + " \"contact\" : {\n" + + " \"name\" : \"Test Contact\",\n" + + " \"url\" : \"https://test.contact.url\",\n" + + " \"email\" : \"test@email.com\"\n" + + " },\n" + + " \"license\" : {\n" + + " \"name\" : \"test license\",\n" + + " \"url\" : \"https://test.license.com\"\n" + + " },\n" + + " \"version\" : \"1.0.0\"\n" + + " }\n" + + "}"); + } + + @Test + public void testOWebHooksSerialization() { + OpenAPI openAPI = new OpenAPI() + .openapi("3.1.0") + .addWebhooks("hook", new PathItem() + .description("test path hook") + .get(new Operation() + .operationId("testHookOperation") + .responses(new ApiResponses() + .addApiResponse("200", new ApiResponse().description("test response description"))))); + + SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + + "webhooks:\n" + + " hook:\n" + + " description: test path hook\n" + + " get:\n" + + " operationId: testHookOperation\n" + + " responses:\n" + + " \"200\":\n" + + " description: test response description"); + + SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + + " \"openapi\" : \"3.1.0\",\n" + + " \"webhooks\" : {\n" + + " \"hook\" : {\n" + + " \"description\" : \"test path hook\",\n" + + " \"get\" : {\n" + + " \"operationId\" : \"testHookOperation\",\n" + + " \"responses\" : {\n" + + " \"200\" : {\n" + + " \"description\" : \"test response description\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + "}"); + openAPI.setOpenapi("3.0.3"); + SerializationMatchers.assertEqualsToYaml(openAPI, "openapi: 3.0.3"); + SerializationMatchers.assertEqualsToJson(openAPI, "{\n" + + " \"openapi\" : \"3.0.3\"\n}"); + + } + + @Test + public void testComponentPathItemsSerialization() { + Schema schema = new StringSchema(); + schema.addType(schema.getType()); + OpenAPI openAPI = new OpenAPI().openapi("3.1.0").components(new Components() + .addSchemas("stringTest", schema) + .addPathItems("/pathTest", new PathItem() + .description("test path item") + .get(new Operation() + .operationId("testPathItem") + .responses(new ApiResponses() + .addApiResponse("200", new ApiResponse().description("response description")))))); + + SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + + "components:\n" + + " schemas:\n" + + " stringTest:\n" + + " type: string\n" + + " pathItems:\n" + + " /pathTest:\n" + + " description: test path item\n" + + " get:\n" + + " operationId: testPathItem\n" + + " responses:\n" + + " \"200\":\n" + + " description: response description"); + + SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + + " \"openapi\" : \"3.1.0\",\n" + + " \"components\" : {\n" + + " \"schemas\" : {\n" + + " \"stringTest\" : {" + + " \"type\" : \"string\"" + + " }\n" + + " },\n" + + " \"pathItems\" : {\n" + + " \"/pathTest\" : {\n" + + " \"description\" : \"test path item\",\n" + + " \"get\" : {\n" + + " \"operationId\" : \"testPathItem\",\n" + + " \"responses\" : {\n" + + " \"200\" : {\n" + + " \"description\" : \"response description\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + "}"); + + openAPI.openapi("3.0.3"); + SerializationMatchers.assertEqualsToYaml(openAPI, "openapi: 3.0.3\n" + + "components:\n" + + " schemas:\n" + + " stringTest:\n" + + " type: string\n"); + + SerializationMatchers.assertEqualsToJson(openAPI, "{\n" + + " \"openapi\" : \"3.0.3\",\n" + + " \"components\" : {\n" + + " \"schemas\" : {\n" + + " \"stringTest\" : {" + + " \"type\" : \"string\"" + + " }\n" + + " }\n" + + " }\n" + + "}"); + } } From f7b0c81a7334ce032e000c9b129a1c33b5c1f00c Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Mon, 22 Nov 2021 09:15:23 -0500 Subject: [PATCH 47/79] renamed info mixin --- .../core/jackson/mixin/{InfoMixin.java => Info31Mixin.java} | 2 +- .../java/io/swagger/v3/core/util/ObjectMapperFactory.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/{InfoMixin.java => Info31Mixin.java} (81%) diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/InfoMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Info31Mixin.java similarity index 81% rename from modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/InfoMixin.java rename to modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Info31Mixin.java index 9cf4a064e7..781eb20758 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/InfoMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Info31Mixin.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; -public abstract class InfoMixin { +public abstract class Info31Mixin { @JsonIgnore public abstract String getSummary(); diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java index 3186c2896f..9fbfd29cb6 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java @@ -21,7 +21,7 @@ import io.swagger.v3.core.jackson.mixin.DateSchemaMixin; import io.swagger.v3.core.jackson.mixin.ExampleMixin; import io.swagger.v3.core.jackson.mixin.ExtensionsMixin; -import io.swagger.v3.core.jackson.mixin.InfoMixin; +import io.swagger.v3.core.jackson.mixin.Info31Mixin; import io.swagger.v3.core.jackson.mixin.LicenseMixin; import io.swagger.v3.core.jackson.mixin.MediaTypeMixin; import io.swagger.v3.core.jackson.mixin.OpenAPIMixin; @@ -180,7 +180,7 @@ public JsonSerializer modifySerializer( sourceMixins.put(Schema.class, SchemaMixin.class); sourceMixins.put(DateSchema.class, DateSchemaMixin.class); sourceMixins.put(Components.class, ComponentsMixin.class); - sourceMixins.put(Info.class, InfoMixin.class); + sourceMixins.put(Info.class, Info31Mixin.class); sourceMixins.put(License.class, LicenseMixin.class); sourceMixins.put(OpenAPI.class, OpenAPIMixin.class); } else { From 0b5f97a98a1df96f2d01789ba355b7db4f2d09f9 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Mon, 22 Nov 2021 17:55:16 -0500 Subject: [PATCH 48/79] added discriminator mixins for oas 3.0 and 3.1 --- .../jackson/mixin/Discriminator31Mixin.java | 15 +++ .../jackson/mixin/DiscriminatorMixin.java | 11 +++ .../v3/core/util/ObjectMapperFactory.java | 5 + .../OpenAPI3_1SerializationTest.java | 97 +++++++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Discriminator31Mixin.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/DiscriminatorMixin.java diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Discriminator31Mixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Discriminator31Mixin.java new file mode 100644 index 0000000000..249452630f --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Discriminator31Mixin.java @@ -0,0 +1,15 @@ +package io.swagger.v3.core.jackson.mixin; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; + +import java.util.Map; + +public abstract class Discriminator31Mixin { + + @JsonAnyGetter + public abstract Map getExtensions(); + + @JsonAnySetter + public abstract void addExtension(String name, Object value); +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/DiscriminatorMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/DiscriminatorMixin.java new file mode 100644 index 0000000000..d633a651f5 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/DiscriminatorMixin.java @@ -0,0 +1,11 @@ +package io.swagger.v3.core.jackson.mixin; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +import java.util.Map; + +public abstract class DiscriminatorMixin { + + @JsonIgnore + public abstract Map getExtensions(); +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java index 9fbfd29cb6..e4ede60b2f 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java @@ -19,6 +19,8 @@ import io.swagger.v3.core.jackson.SchemaSerializer; import io.swagger.v3.core.jackson.mixin.ComponentsMixin; import io.swagger.v3.core.jackson.mixin.DateSchemaMixin; +import io.swagger.v3.core.jackson.mixin.Discriminator31Mixin; +import io.swagger.v3.core.jackson.mixin.DiscriminatorMixin; import io.swagger.v3.core.jackson.mixin.ExampleMixin; import io.swagger.v3.core.jackson.mixin.ExtensionsMixin; import io.swagger.v3.core.jackson.mixin.Info31Mixin; @@ -44,6 +46,7 @@ import io.swagger.v3.oas.models.links.Link; import io.swagger.v3.oas.models.links.LinkParameter; import io.swagger.v3.oas.models.media.DateSchema; +import io.swagger.v3.oas.models.media.Discriminator; import io.swagger.v3.oas.models.media.Encoding; import io.swagger.v3.oas.models.media.EncodingProperty; import io.swagger.v3.oas.models.media.MediaType; @@ -183,9 +186,11 @@ public JsonSerializer modifySerializer( sourceMixins.put(Info.class, Info31Mixin.class); sourceMixins.put(License.class, LicenseMixin.class); sourceMixins.put(OpenAPI.class, OpenAPIMixin.class); + sourceMixins.put(Discriminator.class, DiscriminatorMixin.class); } else { sourceMixins.put(Schema.class, Schema31Mixin.class); sourceMixins.put(DateSchema.class, DateSchemaMixin.class); + sourceMixins.put(Discriminator.class, Discriminator31Mixin.class); } mapper.setMixIns(sourceMixins); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); 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 3be510d3e5..d72bfbcc17 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 @@ -13,6 +13,8 @@ import io.swagger.v3.oas.models.info.Contact; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; +import io.swagger.v3.oas.models.media.Discriminator; +import io.swagger.v3.oas.models.media.ObjectSchema; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.StringSchema; import io.swagger.v3.oas.models.responses.ApiResponse; @@ -541,4 +543,99 @@ public void testComponentPathItemsSerialization() { " }\n" + "}"); } + + @Test + public void testDiscriminatorSerialization() { + Schema propertySchema1 = new StringSchema(); + propertySchema1.addType(propertySchema1.getType()); + + Schema propertySchema2 = new StringSchema(); + propertySchema2.addType(propertySchema2.getType()); + + Discriminator discriminator = new Discriminator().propertyName("type"); + discriminator.addExtension("x-otherName", "discriminationType"); + + Schema schema = new ObjectSchema() + .addProperties("name", propertySchema1) + .addProperties("type", propertySchema1) + .discriminator(discriminator); + + schema.addType(schema.getType()); + OpenAPI openAPI = new OpenAPI().openapi("3.1.0").components(new Components() + .addSchemas("pet", schema)); + + SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + + "components:\n" + + " schemas:\n" + + " pet:\n" + + " properties:\n" + + " name:\n" + + " type: string\n" + + " type:\n" + + " type: string\n" + + " discriminator:\n" + + " propertyName: type\n" + + " x-otherName: discriminationType\n" + + " type: object"); + + SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + + " \"openapi\" : \"3.1.0\",\n" + + " \"components\" : {\n" + + " \"schemas\" : {\n" + + " \"pet\" : {\n" + + " \"properties\" : {\n" + + " \"name\" : {\n" + + " \"type\" : \"string\"\n" + + " },\n" + + " \"type\" : {\n" + + " \"type\" : \"string\"\n" + + " }\n" + + " },\n" + + " \"discriminator\" : {\n" + + " \"propertyName\" : \"type\",\n" + + " \"x-otherName\" : \"discriminationType\"\n" + + " },\n" + + " \"type\" : \"object\"\n" + + " }\n" + + " }\n" + + " }\n" + + "}"); + + openAPI.openapi("3.0.3"); + + SerializationMatchers.assertEqualsToYaml(openAPI, "openapi: 3.0.3\n" + + "components:\n" + + " schemas:\n" + + " pet:\n" + + " properties:\n" + + " name:\n" + + " type: string\n" + + " type:\n" + + " type: string\n" + + " discriminator:\n" + + " propertyName: type\n" + + " type: object"); + + SerializationMatchers.assertEqualsToJson(openAPI, "{\n" + + " \"openapi\" : \"3.0.3\",\n" + + " \"components\" : {\n" + + " \"schemas\" : {\n" + + " \"pet\" : {\n" + + " \"properties\" : {\n" + + " \"name\" : {\n" + + " \"type\" : \"string\"\n" + + " },\n" + + " \"type\" : {\n" + + " \"type\" : \"string\"\n" + + " }\n" + + " },\n" + + " \"discriminator\" : {\n" + + " \"propertyName\" : \"type\"\n" + + " },\n" + + " \"type\" : \"object\"\n" + + " }\n" + + " }\n" + + " }\n" + + "}"); + } } From 4a71fa8140a016dcf913f7d07ced016c0caf1c86 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Tue, 23 Nov 2021 19:00:33 -0500 Subject: [PATCH 49/79] added deserialization tests --- .../OpenAPI3_1DeserializationTest.java | 43 ++++++ .../specFiles/3.1.0/petstore-3.1_sample.yaml | 141 ++++++++++++++++++ 2 files changed, 184 insertions(+) create mode 100644 modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_sample.yaml diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java index 4b851034ff..378f29a0f4 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java @@ -9,8 +9,11 @@ import java.io.IOException; +import static org.junit.Assert.assertNull; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; public class OpenAPI3_1DeserializationTest { @@ -52,4 +55,44 @@ public void deserializeChangelog3_1() throws IOException { Yaml31.prettyPrint(swagger); SerializationMatchers.assertEqualsToYaml31(swagger, jsonString); } + + @Test + public void testDeserializationOnOAS31() throws IOException { + + final String jsonString = ResourceUtils.loadClassResource(getClass(), "specFiles/3.1.0/petstore-3.1_sample.yaml"); + OpenAPI openAPI = Yaml31.mapper().readValue(jsonString, OpenAPI.class); + assertNotNull(openAPI); + + assertEquals(openAPI.getInfo().getTitle(), "Swagger Petstore"); + assertEquals(openAPI.getInfo().getVersion(), "1.0.0"); + assertEquals(openAPI.getInfo().getSummary(), "petstore sample for OAS 3.1.0"); + assertEquals(openAPI.getInfo().getLicense().getName(), "MIT"); + assertEquals(openAPI.getInfo().getLicense().getIdentifier(), "test"); + + assertNotNull(openAPI.getWebhooks()); + assertFalse(openAPI.getWebhooks().isEmpty()); + assertNotNull(openAPI.getWebhooks().get("newPet")); + assertNotNull(openAPI.getWebhooks().get("newPet").getPost()); + + assertNotNull(openAPI.getComponents().getPathItems()); + assertNotNull(openAPI.getComponents().getPathItems().get("/pet")); + assertEquals(openAPI.getComponents().getPathItems().get("/pet").getDescription(), "get a pet"); + assertNotNull(openAPI.getComponents().getPathItems().get("/pet").getGet()); + assertEquals(openAPI.getComponents().getPathItems().get("/pet").getGet().getOperationId(), "getPet"); + + assertNotNull(openAPI.getComponents().getSchemas()); + assertNotNull(openAPI.getComponents().getSchemas().get("Pet")); + assertNotNull(openAPI.getComponents().getSchemas().get("Pet").getDiscriminator()); + assertNotNull(openAPI.getComponents().getSchemas().get("Pet").getDiscriminator().getExtensions()); + assertEquals(openAPI.getComponents().getSchemas().get("Pet").getDiscriminator().getExtensions().get("x-test-extension"), "extended"); + + openAPI = Yaml.mapper().readValue(jsonString, OpenAPI.class); + assertNotNull(openAPI); + + assertNull(openAPI.getInfo().getSummary()); + assertNull(openAPI.getWebhooks()); + assertNull(openAPI.getComponents().getPathItems()); + assertNull(openAPI.getComponents().getSchemas().get("Pet").getDiscriminator().getExtensions()); + + } } diff --git a/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_sample.yaml b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_sample.yaml new file mode 100644 index 0000000000..36e9d52c09 --- /dev/null +++ b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_sample.yaml @@ -0,0 +1,141 @@ + +openapi: "3.1.0" +info: + version: 1.0.0 + title: Swagger Petstore + summary: petstore sample for OAS 3.1.0 + license: + name: MIT + identifier: test +servers: + - url: http://petstore.swagger.io/v1 +webhooks: + # Each webhook needs a name + newPet: + # This is a Path Item Object, the only difference is that the request is initiated by the API provider + post: + requestBody: + description: Information about a new pet in the system + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + responses: + "200": + description: Return a 200 status to indicate that the data was received successfully +paths: + /pets: + get: + summary: List all pets + operationId: listPets + tags: + - pets + parameters: + - name: limit + in: query + description: How many items to return at one time (max 100) + required: false + schema: + type: integer + format: int32 + responses: + "200": + description: An paged array of pets + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + content: + application/json: + schema: + $ref: "#/components/schemas/Pets" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + post: + summary: Create a pet + operationId: createPets + tags: + - pets + responses: + "201": + description: Null response + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + /pets/{petId}: + get: + summary: Info for a specific pet + operationId: showPetById + tags: + - pets + parameters: + - name: petId + in: path + required: true + description: The id of the pet to retrieve + schema: + type: string + responses: + "200": + description: Expected response to a valid request + content: + application/json: + schema: + $ref: "#/components/schemas/Pets" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" +components: + schemas: + Pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string + discriminator: + propertyName: tag + x-test-extension: extended + Pets: + $id: test + $anchor: test + type: array + items: + $ref: "#/components/schemas/Pet" + description: desc + format: int32 + Error: + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string + pathItems: + /pet: + description: get a pet + get: + operationId: getPet + responses: + "200": + description: pet returned From d09819f6a3369e966f1e9b75d1103a60df7c02e4 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Tue, 23 Nov 2021 21:31:46 -0500 Subject: [PATCH 50/79] fixed tests errors related to info mixin class --- .../io/swagger/v3/core/jackson/mixin/Info31Mixin.java | 10 ++++++++++ .../io/swagger/v3/core/util/ObjectMapperFactory.java | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Info31Mixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Info31Mixin.java index 781eb20758..bd2265b22d 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Info31Mixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Info31Mixin.java @@ -1,9 +1,19 @@ package io.swagger.v3.core.jackson.mixin; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + public abstract class Info31Mixin { + @JsonAnyGetter + public abstract Map getExtensions(); + + @JsonAnySetter + public abstract void addExtension(String name, Object value); + @JsonIgnore public abstract String getSummary(); } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java index e4ede60b2f..ec2dbeb3c2 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java @@ -159,7 +159,6 @@ public JsonSerializer modifySerializer( sourceMixins.put(Example.class, ExampleMixin.class); sourceMixins.put(ExternalDocumentation.class, ExtensionsMixin.class); sourceMixins.put(Header.class, ExtensionsMixin.class); - sourceMixins.put(Info.class, ExtensionsMixin.class); sourceMixins.put(License.class, ExtensionsMixin.class); sourceMixins.put(Link.class, ExtensionsMixin.class); sourceMixins.put(LinkParameter.class, ExtensionsMixin.class); @@ -188,6 +187,7 @@ public JsonSerializer modifySerializer( sourceMixins.put(OpenAPI.class, OpenAPIMixin.class); sourceMixins.put(Discriminator.class, DiscriminatorMixin.class); } else { + sourceMixins.put(Info.class, ExtensionsMixin.class); sourceMixins.put(Schema.class, Schema31Mixin.class); sourceMixins.put(DateSchema.class, DateSchemaMixin.class); sourceMixins.put(Discriminator.class, Discriminator31Mixin.class); From 7f98b90f5b76de9355c3f00d13e61f97a5781bdd Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Tue, 23 Nov 2021 22:24:19 -0500 Subject: [PATCH 51/79] fixed tests error related to license mixin class --- .../io/swagger/v3/core/jackson/mixin/LicenseMixin.java | 10 ++++++++++ .../io/swagger/v3/core/util/ObjectMapperFactory.java | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/LicenseMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/LicenseMixin.java index fb970b9d7a..4b205a908e 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/LicenseMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/LicenseMixin.java @@ -1,9 +1,19 @@ package io.swagger.v3.core.jackson.mixin; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + public abstract class LicenseMixin { + @JsonAnyGetter + public abstract Map getExtensions(); + + @JsonAnySetter + public abstract void addExtension(String name, Object value); + @JsonIgnore public abstract String getIdentifier(); } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java index ec2dbeb3c2..22b78398c1 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java @@ -159,7 +159,6 @@ public JsonSerializer modifySerializer( sourceMixins.put(Example.class, ExampleMixin.class); sourceMixins.put(ExternalDocumentation.class, ExtensionsMixin.class); sourceMixins.put(Header.class, ExtensionsMixin.class); - sourceMixins.put(License.class, ExtensionsMixin.class); sourceMixins.put(Link.class, ExtensionsMixin.class); sourceMixins.put(LinkParameter.class, ExtensionsMixin.class); sourceMixins.put(MediaType.class, MediaTypeMixin.class); From df15830250f6b45b771bf606f332798ba7358fb3 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Thu, 9 Dec 2021 23:18:21 -0500 Subject: [PATCH 52/79] added summary property, on model class with ref property without it, and mixin class --- .../core/jackson/mixin/ApiResponseMixin.java | 19 + .../v3/core/jackson/mixin/CallbackMixin.java | 22 + .../v3/core/jackson/mixin/HeaderMixin.java | 19 + .../v3/core/jackson/mixin/LinkMixin.java | 19 + .../v3/core/jackson/mixin/ParameterMixin.java | 19 + .../core/jackson/mixin/RequestBodyMixin.java | 19 + .../jackson/mixin/SecuritySchemeMixin.java | 19 + .../v3/core/util/ObjectMapperFactory.java | 28 +- .../OpenAPI3_1SerializationTest.java | 532 ++++++++++++++++++ .../v3/oas/models/callbacks/Callback.java | 50 +- .../swagger/v3/oas/models/headers/Header.java | 28 +- .../io/swagger/v3/oas/models/links/Link.java | 22 + .../v3/oas/models/parameters/Parameter.java | 27 +- .../v3/oas/models/parameters/RequestBody.java | 25 + .../v3/oas/models/responses/ApiResponse.java | 26 +- .../oas/models/security/SecurityScheme.java | 25 + 16 files changed, 886 insertions(+), 13 deletions(-) create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ApiResponseMixin.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/CallbackMixin.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/HeaderMixin.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/LinkMixin.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ParameterMixin.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/RequestBodyMixin.java create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SecuritySchemeMixin.java diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ApiResponseMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ApiResponseMixin.java new file mode 100644 index 0000000000..a623829b08 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ApiResponseMixin.java @@ -0,0 +1,19 @@ +package io.swagger.v3.core.jackson.mixin; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; + +import java.util.Map; + +public abstract class ApiResponseMixin { + + @JsonAnyGetter + public abstract Map getExtensions(); + + @JsonAnySetter + public abstract void addExtension(String name, Object value); + + @JsonIgnore + public abstract String getSummary(); +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/CallbackMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/CallbackMixin.java new file mode 100644 index 0000000000..50c13dda21 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/CallbackMixin.java @@ -0,0 +1,22 @@ +package io.swagger.v3.core.jackson.mixin; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; + +import java.util.Map; + +public abstract class CallbackMixin { + + @JsonAnyGetter + public abstract Map getExtensions(); + + @JsonAnySetter + public abstract void addExtension(String name, Object value); + + @JsonIgnore + public abstract String getDescription(); + + @JsonIgnore + public abstract String getSummary(); +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/HeaderMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/HeaderMixin.java new file mode 100644 index 0000000000..b9f4615eec --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/HeaderMixin.java @@ -0,0 +1,19 @@ +package io.swagger.v3.core.jackson.mixin; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; + +import java.util.Map; + +public abstract class HeaderMixin { + + @JsonAnyGetter + public abstract Map getExtensions(); + + @JsonAnySetter + public abstract void addExtension(String name, Object value); + + @JsonIgnore + public abstract String getSummary(); +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/LinkMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/LinkMixin.java new file mode 100644 index 0000000000..027ca05dbf --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/LinkMixin.java @@ -0,0 +1,19 @@ +package io.swagger.v3.core.jackson.mixin; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; + +import java.util.Map; + +public abstract class LinkMixin { + + @JsonAnyGetter + public abstract Map getExtensions(); + + @JsonAnySetter + public abstract void addExtension(String name, Object value); + + @JsonIgnore + public abstract String getSummary(); +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ParameterMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ParameterMixin.java new file mode 100644 index 0000000000..30e432c7ac --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ParameterMixin.java @@ -0,0 +1,19 @@ +package io.swagger.v3.core.jackson.mixin; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; + +import java.util.Map; + +public abstract class ParameterMixin { + + @JsonAnyGetter + public abstract Map getExtensions(); + + @JsonAnySetter + public abstract void addExtension(String name, Object value); + + @JsonIgnore + public abstract String getSummary(); +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/RequestBodyMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/RequestBodyMixin.java new file mode 100644 index 0000000000..3089c79246 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/RequestBodyMixin.java @@ -0,0 +1,19 @@ +package io.swagger.v3.core.jackson.mixin; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; + +import java.util.Map; + +public abstract class RequestBodyMixin { + + @JsonAnyGetter + public abstract Map getExtensions(); + + @JsonAnySetter + public abstract void addExtension(String name, Object value); + + @JsonIgnore + public abstract String getSummary(); +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SecuritySchemeMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SecuritySchemeMixin.java new file mode 100644 index 0000000000..546bf3e9f6 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SecuritySchemeMixin.java @@ -0,0 +1,19 @@ +package io.swagger.v3.core.jackson.mixin; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; + +import java.util.Map; + +public abstract class SecuritySchemeMixin { + + @JsonAnyGetter + public abstract Map getExtensions(); + + @JsonAnySetter + public abstract void addExtension(String name, Object value); + + @JsonIgnore + public abstract String getSummary(); +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java index 22b78398c1..0b22a03e4b 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java @@ -17,20 +17,27 @@ import io.swagger.v3.core.jackson.Schema31Serializer; import io.swagger.v3.core.jackson.MediaTypeSerializer; import io.swagger.v3.core.jackson.SchemaSerializer; +import io.swagger.v3.core.jackson.mixin.ApiResponseMixin; +import io.swagger.v3.core.jackson.mixin.CallbackMixin; import io.swagger.v3.core.jackson.mixin.ComponentsMixin; import io.swagger.v3.core.jackson.mixin.DateSchemaMixin; import io.swagger.v3.core.jackson.mixin.Discriminator31Mixin; import io.swagger.v3.core.jackson.mixin.DiscriminatorMixin; import io.swagger.v3.core.jackson.mixin.ExampleMixin; import io.swagger.v3.core.jackson.mixin.ExtensionsMixin; +import io.swagger.v3.core.jackson.mixin.HeaderMixin; import io.swagger.v3.core.jackson.mixin.Info31Mixin; import io.swagger.v3.core.jackson.mixin.LicenseMixin; +import io.swagger.v3.core.jackson.mixin.LinkMixin; import io.swagger.v3.core.jackson.mixin.MediaTypeMixin; import io.swagger.v3.core.jackson.mixin.OpenAPIMixin; import io.swagger.v3.core.jackson.mixin.OperationMixin; +import io.swagger.v3.core.jackson.mixin.ParameterMixin; +import io.swagger.v3.core.jackson.mixin.RequestBodyMixin; import io.swagger.v3.core.jackson.mixin.Schema31Mixin; import io.swagger.v3.core.jackson.mixin.SchemaConverterMixin; import io.swagger.v3.core.jackson.mixin.SchemaMixin; +import io.swagger.v3.core.jackson.mixin.SecuritySchemeMixin; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.ExternalDocumentation; import io.swagger.v3.oas.models.OpenAPI; @@ -64,6 +71,7 @@ import io.swagger.v3.oas.models.servers.ServerVariable; import io.swagger.v3.oas.models.servers.ServerVariables; import io.swagger.v3.oas.models.tags.Tag; +import jdk.nashorn.internal.codegen.CompilerConstants; import java.util.LinkedHashMap; import java.util.Map; @@ -151,26 +159,20 @@ public JsonSerializer modifySerializer( Map, Class> sourceMixins = new LinkedHashMap<>(); sourceMixins.put(ApiResponses.class, ExtensionsMixin.class); - sourceMixins.put(ApiResponse.class, ExtensionsMixin.class); - sourceMixins.put(Callback.class, ExtensionsMixin.class); sourceMixins.put(Contact.class, ExtensionsMixin.class); sourceMixins.put(Encoding.class, ExtensionsMixin.class); sourceMixins.put(EncodingProperty.class, ExtensionsMixin.class); sourceMixins.put(Example.class, ExampleMixin.class); sourceMixins.put(ExternalDocumentation.class, ExtensionsMixin.class); - sourceMixins.put(Header.class, ExtensionsMixin.class); sourceMixins.put(Link.class, ExtensionsMixin.class); sourceMixins.put(LinkParameter.class, ExtensionsMixin.class); sourceMixins.put(MediaType.class, MediaTypeMixin.class); sourceMixins.put(OAuthFlow.class, ExtensionsMixin.class); sourceMixins.put(OAuthFlows.class, ExtensionsMixin.class); sourceMixins.put(Operation.class, OperationMixin.class); - sourceMixins.put(Parameter.class, ExtensionsMixin.class); sourceMixins.put(PathItem.class, ExtensionsMixin.class); sourceMixins.put(Paths.class, ExtensionsMixin.class); - sourceMixins.put(RequestBody.class, ExtensionsMixin.class); sourceMixins.put(Scopes.class, ExtensionsMixin.class); - sourceMixins.put(SecurityScheme.class, ExtensionsMixin.class); sourceMixins.put(Server.class, ExtensionsMixin.class); sourceMixins.put(ServerVariable.class, ExtensionsMixin.class); sourceMixins.put(ServerVariables.class, ExtensionsMixin.class); @@ -185,11 +187,25 @@ public JsonSerializer modifySerializer( sourceMixins.put(License.class, LicenseMixin.class); sourceMixins.put(OpenAPI.class, OpenAPIMixin.class); sourceMixins.put(Discriminator.class, DiscriminatorMixin.class); + sourceMixins.put(ApiResponse.class, ApiResponseMixin.class); + sourceMixins.put(Parameter.class, ParameterMixin.class); + sourceMixins.put(RequestBody.class, RequestBodyMixin.class); + sourceMixins.put(Header.class, HeaderMixin.class); + sourceMixins.put(SecurityScheme.class, SecuritySchemeMixin.class); + sourceMixins.put(Link.class, LinkMixin.class); + sourceMixins.put(Callback.class, CallbackMixin.class); } else { sourceMixins.put(Info.class, ExtensionsMixin.class); sourceMixins.put(Schema.class, Schema31Mixin.class); sourceMixins.put(DateSchema.class, DateSchemaMixin.class); sourceMixins.put(Discriminator.class, Discriminator31Mixin.class); + sourceMixins.put(ApiResponse.class, ExtensionsMixin.class); + sourceMixins.put(Parameter.class, ExtensionsMixin.class); + sourceMixins.put(RequestBody.class, ExtensionsMixin.class); + sourceMixins.put(Header.class, ExtensionsMixin.class); + sourceMixins.put(SecurityScheme.class, ExtensionsMixin.class); + sourceMixins.put(Link.class, ExtensionsMixin.class); + sourceMixins.put(Callback.class, ExtensionsMixin.class); } mapper.setMixIns(sourceMixins); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); 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 d72bfbcc17..4cf2cf0b96 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 @@ -10,15 +10,25 @@ import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.PathItem; +import io.swagger.v3.oas.models.callbacks.Callback; +import io.swagger.v3.oas.models.examples.Example; +import io.swagger.v3.oas.models.headers.Header; import io.swagger.v3.oas.models.info.Contact; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; +import io.swagger.v3.oas.models.links.Link; +import io.swagger.v3.oas.models.media.Content; import io.swagger.v3.oas.models.media.Discriminator; +import io.swagger.v3.oas.models.media.MediaType; import io.swagger.v3.oas.models.media.ObjectSchema; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.StringSchema; +import io.swagger.v3.oas.models.parameters.Parameter; +import io.swagger.v3.oas.models.parameters.RequestBody; import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.oas.models.responses.ApiResponses; +import io.swagger.v3.oas.models.security.SecurityScheme; +import org.checkerframework.checker.units.qual.C; import org.testng.annotations.Test; import static org.testng.Assert.assertEquals; @@ -638,4 +648,526 @@ public void testDiscriminatorSerialization() { " }\n" + "}"); } + + @Test + public void testPathItemsRefSerialization() { + OpenAPI openAPI = new OpenAPI().openapi("3.1.0") + .path("/pathTest", new PathItem() + .$ref("#/components/pathItems/pathTest") + .description("This is a ref path item") + .summary("ref path item") + ) + .components(new Components() + .addPathItems("pathTest", new PathItem() + .description("test path item") + .get(new Operation() + .operationId("testPathItem") + .responses(new ApiResponses() + .addApiResponse("200", new ApiResponse().description("response description")))))); + + SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + + "paths:\n" + + " /pathTest:\n" + + " $ref: '#/components/pathItems/pathTest'\n" + + " description: This is a ref path item\n" + + " summary: ref path item\n" + + "components:\n" + + " pathItems:\n" + + " pathTest:\n" + + " description: test path item\n" + + " get:\n" + + " operationId: testPathItem\n" + + " responses:\n" + + " \"200\":\n" + + " description: response description"); + + SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + + " \"openapi\" : \"3.1.0\",\n" + + " \"paths\" : {\n" + + " \"/pathTest\" : {\n" + + " \"summary\" : \"ref path item\",\n" + + " \"description\" : \"This is a ref path item\",\n" + + " \"$ref\" : \"#/components/pathItems/pathTest\"\n" + + " }\n" + + " },\n" + + " \"components\" : {\n" + + " \"pathItems\" : {\n" + + " \"pathTest\" : {\n" + + " \"description\" : \"test path item\",\n" + + " \"get\" : {\n" + + " \"operationId\" : \"testPathItem\",\n" + + " \"responses\" : {\n" + + " \"200\" : {\n" + + " \"description\" : \"response description\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + "}"); + } + + @Test + public void testResponseRefSerialization() { + OpenAPI openAPI = new OpenAPI() + .openapi("3.1.0") + .path("/test", new PathItem() + .description("test path item") + .get(new Operation() + .operationId("testPathItem") + .responses(new ApiResponses() + .addApiResponse("200" , new ApiResponse() + .description("point to a $ref response") + .summary("point to a $ref response") + .$ref("#/components/responses/okResponse"))))) + .components(new Components() + .addResponses("okResponse", new ApiResponse().description("everything is good"))); + SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + + "paths:\n" + + " /test:\n" + + " description: test path item\n" + + " get:\n" + + " operationId: testPathItem\n" + + " responses:\n" + + " \"200\":\n" + + " description: point to a $ref response\n" + + " summary: point to a $ref response\n" + + " $ref: '#/components/responses/okResponse'\n" + + "components:\n" + + " responses:\n" + + " okResponse:\n" + + " description: everything is good"); + + SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + + " \"openapi\" : \"3.1.0\",\n" + + " \"paths\" : {\n" + + " \"/test\" : {\n" + + " \"description\" : \"test path item\",\n" + + " \"get\" : {\n" + + " \"operationId\" : \"testPathItem\",\n" + + " \"responses\" : {\n" + + " \"200\" : {\n" + + " \"description\" : \"point to a $ref response\",\n" + + " \"summary\" : \"point to a $ref response\",\n" + + " \"$ref\" : \"#/components/responses/okResponse\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " },\n" + + " \"components\" : {\n" + + " \"responses\" : {\n" + + " \"okResponse\" : {\n" + + " \"description\" : \"everything is good\"\n" + + " }\n" + + " }\n" + + " }\n" + + "}"); + } + + @Test + public void testParameterRefSerialization() { + OpenAPI openAPI = new OpenAPI() + .openapi("3.1.0") + .components(new Components() + .addParameters("testParameter", new Parameter() + .in("query"))) + .path("/test", new PathItem() + .description("test path item") + .get(new Operation() + .operationId("testPathItem") + .addParametersItem(new Parameter() + .$ref("#/components/parameters/testParameter") + .description("test parameter") + .summary("test param")))); + + SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + + "paths:\n" + + " /test:\n" + + " description: test path item\n" + + " get:\n" + + " operationId: testPathItem\n" + + " parameters:\n" + + " - description: test parameter\n" + + " summary: test param\n" + + " $ref: '#/components/parameters/testParameter'\n" + + "components:\n" + + " parameters:\n" + + " testParameter:\n" + + " in: query"); + + SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + + " \"openapi\" : \"3.1.0\",\n" + + " \"paths\" : {\n" + + " \"/test\" : {\n" + + " \"description\" : \"test path item\",\n" + + " \"get\" : {\n" + + " \"operationId\" : \"testPathItem\",\n" + + " \"parameters\" : [ {\n" + + " \"description\" : \"test parameter\",\n" + + " \"summary\" : \"test param\",\n" + + " \"$ref\" : \"#/components/parameters/testParameter\"\n" + + " } ]\n" + + " }\n" + + " }\n" + + " },\n" + + " \"components\" : {\n" + + " \"parameters\" : {\n" + + " \"testParameter\" : {\n" + + " \"in\" : \"query\"\n" + + " }\n" + + " }\n" + + " }\n" + + "}"); + } + + @Test + public void testExampleRefSerialization() { + OpenAPI openAPI = new OpenAPI() + .openapi("3.1.0") + .components(new Components() + .addExamples("testExample", new Example() + .value("Example on test") + .description("this is a example desc") + .summary("this is a summary test")) + .addSchemas("schema", new Schema().example(new Example() + .$ref("#/components/examples/testExample") + .description("ref description") + .summary("ref summary")))); + + SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + + "components:\n" + + " schemas:\n" + + " schema:\n" + + " example:\n" + + " summary: ref summary\n" + + " description: ref description\n" + + " $ref: '#/components/examples/testExample'\n" + + " examples:\n" + + " testExample:\n" + + " summary: this is a summary test\n" + + " description: this is a example desc\n" + + " value: Example on test"); + SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + + " \"openapi\" : \"3.1.0\",\n" + + " \"components\" : {\n" + + " \"schemas\" : {\n" + + " \"schema\" : {\n" + + " \"example\" : {\n" + + " \"summary\" : \"ref summary\",\n" + + " \"description\" : \"ref description\",\n" + + " \"$ref\" : \"#/components/examples/testExample\"\n" + + " }\n" + + " }\n" + + " },\n" + + " \"examples\" : {\n" + + " \"testExample\" : {\n" + + " \"summary\" : \"this is a summary test\",\n" + + " \"description\" : \"this is a example desc\",\n" + + " \"value\" : \"Example on test\"\n" + + " }\n" + + " }\n" + + " }\n" + + "}"); + } + @Test + public void testRequestBodyRefSerialization() { + OpenAPI openAPI = new OpenAPI() + .openapi("3.1.0") + .path("/test", new PathItem() + .description("test path item") + .post(new Operation() + .operationId("testPathItem") + .requestBody(new RequestBody() + .$ref("#/components/requestBodies/body") + .description("ref request body") + .summary("ref req body")))) + .components(new Components() + .addRequestBodies("body", new RequestBody() + .content(new Content() + .addMediaType("application/json", new MediaType() + .schema(new ObjectSchema()))))) + ; + SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + + "paths:\n" + + " /test:\n" + + " description: test path item\n" + + " post:\n" + + " operationId: testPathItem\n" + + " requestBody:\n" + + " description: ref request body\n" + + " summary: ref req body\n" + + " $ref: '#/components/requestBodies/body'\n" + + "components:\n" + + " requestBodies:\n" + + " body:\n" + + " content:\n" + + " application/json:\n" + + " schema: {}"); + SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + + " \"openapi\" : \"3.1.0\",\n" + + " \"paths\" : {\n" + + " \"/test\" : {\n" + + " \"description\" : \"test path item\",\n" + + " \"post\" : {\n" + + " \"operationId\" : \"testPathItem\",\n" + + " \"requestBody\" : {\n" + + " \"description\" : \"ref request body\",\n" + + " \"summary\" : \"ref req body\",\n" + + " \"$ref\" : \"#/components/requestBodies/body\"\n" + + " }\n" + + " }\n" + + " }\n" + + " },\n" + + " \"components\" : {\n" + + " \"requestBodies\" : {\n" + + " \"body\" : {\n" + + " \"content\" : {\n" + + " \"application/json\" : {\n" + + " \"schema\" : { }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + "}"); + } + + @Test + public void testHeaderRefSerialization() { + OpenAPI openAPI = new OpenAPI() + .openapi("3.1.0") + .path("/test", new PathItem() + .description("test path item") + .post(new Operation() + .operationId("testPathItem") + .responses(new ApiResponses() + .addApiResponse("default", new ApiResponse() + .description("default response") + .addHeaderObject("header", new Header() + .$ref("#/components/responses/okResponse") + .description("ref header description") + .summary("ref header summary")))) + )) + .components(new Components() + .addHeaders("test-head", new Header() + .description("test header description") + .summary("test header summary"))); + + SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + + "paths:\n" + + " /test:\n" + + " description: test path item\n" + + " post:\n" + + " operationId: testPathItem\n" + + " responses:\n" + + " default:\n" + + " description: default response\n" + + " headers:\n" + + " header:\n" + + " description: ref header description\n" + + " summary: ref header summary\n" + + " $ref: '#/components/responses/okResponse'\n" + + "components:\n" + + " headers:\n" + + " test-head:\n" + + " description: test header description\n" + + " summary: test header summary"); + SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + + " \"openapi\" : \"3.1.0\",\n" + + " \"paths\" : {\n" + + " \"/test\" : {\n" + + " \"description\" : \"test path item\",\n" + + " \"post\" : {\n" + + " \"operationId\" : \"testPathItem\",\n" + + " \"responses\" : {\n" + + " \"default\" : {\n" + + " \"description\" : \"default response\",\n" + + " \"headers\" : {\n" + + " \"header\" : {\n" + + " \"description\" : \"ref header description\",\n" + + " \"summary\" : \"ref header summary\",\n" + + " \"$ref\" : \"#/components/responses/okResponse\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " },\n" + + " \"components\" : {\n" + + " \"headers\" : {\n" + + " \"test-head\" : {\n" + + " \"description\" : \"test header description\",\n" + + " \"summary\" : \"test header summary\"\n" + + " }\n" + + " }\n" + + " }\n" + + "}"); + } + + @Test + public void testSecuritySchemeRefSerialization() { + OpenAPI openAPI = new OpenAPI() + .openapi("3.1.0") + .components(new Components().addSecuritySchemes("basic", new SecurityScheme() + .$ref("https://external.site.com/#components/securitySchemes/basic") + .description("ref security description") + .summary("ref security summary"))); + + SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + + "components:\n" + + " securitySchemes:\n" + + " basic:\n" + + " description: ref security description\n" + + " summary: ref security summary\n" + + " $ref: https://external.site.com/#components/securitySchemes/basic"); + SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + + " \"openapi\" : \"3.1.0\",\n" + + " \"components\" : {\n" + + " \"securitySchemes\" : {\n" + + " \"basic\" : {\n" + + " \"description\" : \"ref security description\",\n" + + " \"summary\" : \"ref security summary\",\n" + + " \"$ref\" : \"https://external.site.com/#components/securitySchemes/basic\"\n" + + " }\n" + + " }\n" + + " }\n" + + "}"); + } + + @Test + public void testLinkRefSerialization() { + OpenAPI openAPI = new OpenAPI() + .openapi("3.1.0") + .path("/test", new PathItem() + .description("test path item") + .post(new Operation() + .operationId("testPathItem") + .responses(new ApiResponses() + .addApiResponse("default", new ApiResponse() + .description("default response") + .addLink("link", new Link() + .$ref("#/components/links/Link") + .description("ref link description") + .summary("ref link summary")))))) + .components(new Components().addLinks("Link", new Link() + .operationRef("#/paths/~12.0~1repositories~1{username}/get"))); + + SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + + "paths:\n" + + " /test:\n" + + " description: test path item\n" + + " post:\n" + + " operationId: testPathItem\n" + + " responses:\n" + + " default:\n" + + " description: default response\n" + + " links:\n" + + " link:\n" + + " description: ref link description\n" + + " summary: ref link summary\n" + + " $ref: '#/components/links/Link'\n" + + "components:\n" + + " links:\n" + + " Link:\n" + + " operationRef: \"#/paths/~12.0~1repositories~1{username}/get\""); + SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + + " \"openapi\" : \"3.1.0\",\n" + + " \"paths\" : {\n" + + " \"/test\" : {\n" + + " \"description\" : \"test path item\",\n" + + " \"post\" : {\n" + + " \"operationId\" : \"testPathItem\",\n" + + " \"responses\" : {\n" + + " \"default\" : {\n" + + " \"description\" : \"default response\",\n" + + " \"links\" : {\n" + + " \"link\" : {\n" + + " \"description\" : \"ref link description\",\n" + + " \"summary\" : \"ref link summary\",\n" + + " \"$ref\" : \"#/components/links/Link\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " },\n" + + " \"components\" : {\n" + + " \"links\" : {\n" + + " \"Link\" : {\n" + + " \"operationRef\" : \"#/paths/~12.0~1repositories~1{username}/get\"\n" + + " }\n" + + " }\n" + + " }\n" + + "}"); + } + + @Test + public void testCallRefSerialization() { + OpenAPI openAPI = new OpenAPI() + .openapi("3.1.0") + .path("/test", new PathItem() + .description("test path item") + .post(new Operation() + .operationId("testPathItem") + .addCallbacks("callbackSample", new Callback() + .$ref("#/components/callbacks/TestCallback") + .description("ref callback description") + .summary("ref callback summary")))) + .components(new Components().addCallbacks("TestCallback", new Callback().addPathItem("{$request.query.queryUrl}", new PathItem() + .description("test path item") + .post(new Operation() + .operationId("testPathItem"))))); + + SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + + "paths:\n" + + " /test:\n" + + " description: test path item\n" + + " post:\n" + + " operationId: testPathItem\n" + + " callbacks:\n" + + " callbackSample:\n" + + " $ref: '#/components/callbacks/TestCallback'\n" + + "components:\n" + + " callbacks:\n" + + " TestCallback:\n" + + " '{$request.query.queryUrl}':\n" + + " description: test path item\n" + + " post:\n" + + " operationId: testPathItem"); + + SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + + " \"openapi\" : \"3.1.0\",\n" + + " \"paths\" : {\n" + + " \"/test\" : {\n" + + " \"description\" : \"test path item\",\n" + + " \"post\" : {\n" + + " \"operationId\" : \"testPathItem\",\n" + + " \"callbacks\" : {\n" + + " \"callbackSample\" : {\n" + + " \"$ref\" : \"#/components/callbacks/TestCallback\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " },\n" + + " \"components\" : {\n" + + " \"callbacks\" : {\n" + + " \"TestCallback\" : {\n" + + " \"{$request.query.queryUrl}\" : {\n" + + " \"description\" : \"test path item\",\n" + + " \"post\" : {\n" + + " \"operationId\" : \"testPathItem\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + "}"); + } + + } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java index 3bf18721b7..4016b2e3d2 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java @@ -36,6 +36,12 @@ public Callback() { private String $ref = null; + @OpenAPI31 + private String description; + + @OpenAPI31 + private String summary; + /** * @since 2.0.3 */ @@ -53,6 +59,38 @@ public Callback() { this.$ref = $ref; } + @OpenAPI31 + public String getDescription() { + return description; + } + + @OpenAPI31 + public void setDescription(String description) { + this.description = description; + } + + @OpenAPI31 + public Callback description(String description) { + this.description = description; + return this; + } + + @OpenAPI31 + public String getSummary() { + return summary; + } + + @OpenAPI31 + public void setSummary(String summary) { + this.summary = summary; + } + + @OpenAPI31 + public Callback summary(String summary) { + this.summary = summary; + return this; + } + /** * @since 2.0.3 */ @@ -78,13 +116,19 @@ public boolean equals(java.lang.Object o) { if ($ref != null ? !$ref.equals(callback.$ref) : callback.$ref != null) { return false; } + if (description != null ? !description.equals(callback.description) : callback.description != null) { + return false; + } + if (summary != null ? !summary.equals(callback.summary) : callback.summary != null) { + return false; + } return Objects.equals(this.extensions, callback.extensions) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(extensions, $ref, super.hashCode()); + return Objects.hash(extensions, $ref, description, summary, super.hashCode()); } public java.util.Map getExtensions() { @@ -122,6 +166,10 @@ public Callback extensions(java.util.Map extensions) { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Callback {\n"); + + sb.append(" $ref: ").append(toIndentedString($ref)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append("}"); return sb.toString(); diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java index 6d380f7f31..12f1132ab3 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java @@ -16,9 +16,11 @@ package io.swagger.v3.oas.models.headers; +import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.examples.Example; import io.swagger.v3.oas.models.media.Content; import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.parameters.RequestBody; import java.util.LinkedHashMap; import java.util.Map; @@ -32,6 +34,10 @@ public class Header { private String description = null; + + @OpenAPI31 + private String summary = null; + private String $ref = null; private Boolean required = null; private Boolean deprecated = null; @@ -81,6 +87,22 @@ public Header description(String description) { return this; } + @OpenAPI31 + public String getSummary() { + return summary; + } + + @OpenAPI31 + public void setSummary(String summary) { + this.summary = summary; + } + + @OpenAPI31 + public Header summary(String summary) { + this.summary = summary; + return this; + } + /** * returns the required property from a Header instance. * @@ -260,12 +282,13 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.example, header.example) && Objects.equals(this.content, header.content) && Objects.equals(this.extensions, header.extensions) && - Objects.equals(this.$ref, header.$ref); + Objects.equals(this.$ref, header.$ref) && + Objects.equals(this.summary, header.summary); } @Override public int hashCode() { - return Objects.hash(description, required, deprecated, style, explode, schema, examples, example, content, extensions, $ref); + return Objects.hash(description, required, deprecated, style, explode, schema, examples, example, content, extensions, $ref, summary); } public java.util.Map getExtensions() { @@ -312,6 +335,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Header {\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); sb.append(" required: ").append(toIndentedString(required)).append("\n"); sb.append(" deprecated: ").append(toIndentedString(deprecated)).append("\n"); sb.append(" style: ").append(toIndentedString(style)).append("\n"); diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java index adff653f54..a6ff7185c8 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java @@ -36,6 +36,10 @@ public class Link { private Object requestBody = null; private Map headers = null; private String description = null; + + @OpenAPI31 + private String summary = null; + private String $ref = null; private java.util.Map extensions = null; private Server server; @@ -183,6 +187,19 @@ public Link description(String description) { return this; } + public String getSummary() { + return summary; + } + + public void setSummary(String summary) { + this.summary = summary; + } + + public Link summary(String summary) { + this.summary = summary; + return this; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -218,6 +235,9 @@ public boolean equals(Object o) { if (extensions != null ? !extensions.equals(link.extensions) : link.extensions != null) { return false; } + if (summary != null ? !summary.equals(link.summary) : link.summary != null) { + return false; + } return server != null ? server.equals(link.server) : link.server == null; } @@ -233,6 +253,7 @@ public int hashCode() { result = 31 * result + ($ref != null ? $ref.hashCode() : 0); result = 31 * result + (extensions != null ? extensions.hashCode() : 0); result = 31 * result + (server != null ? server.hashCode() : 0); + result = 31 * result + (summary != null ? summary.hashCode() : 0); return result; } @@ -294,6 +315,7 @@ public String toString() { sb.append(" requestBody: ").append(toIndentedString(requestBody)).append("\n"); sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); sb.append(" $ref: ").append(toIndentedString($ref)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java index b6d56a3566..746181aa3d 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java @@ -20,6 +20,7 @@ import io.swagger.v3.oas.models.examples.Example; import io.swagger.v3.oas.models.media.Content; import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.responses.ApiResponse; import java.util.LinkedHashMap; import java.util.Map; @@ -35,6 +36,10 @@ public class Parameter { private String name = null; private String in = null; private String description = null; + + @OpenAPI31 + private String summary = null; + private Boolean required = null; private Boolean deprecated = null; private Boolean allowEmptyValue = null; @@ -133,6 +138,22 @@ public Parameter description(String description) { return this; } + @OpenAPI31 + public String getSummary() { + return summary; + } + + @OpenAPI31 + public void setSummary(String summary) { + this.summary = summary; + } + + @OpenAPI31 + public Parameter summary(String summary) { + this.summary = summary; + return this; + } + /** * returns the required property from a Parameter instance. * @@ -370,12 +391,13 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.example, parameter.example) && Objects.equals(this.content, parameter.content) && Objects.equals(this.$ref, parameter.$ref) && - Objects.equals(this.extensions, parameter.extensions); + Objects.equals(this.extensions, parameter.extensions) && + Objects.equals(this.summary, parameter.summary); } @Override public int hashCode() { - return Objects.hash(name, in, description, required, deprecated, allowEmptyValue, style, explode, allowReserved, schema, examples, example, content, $ref, extensions); + return Objects.hash(name, in, description, required, deprecated, allowEmptyValue, style, explode, allowReserved, schema, examples, example, content, $ref, extensions, summary); } public java.util.Map getExtensions() { @@ -417,6 +439,7 @@ public String toString() { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" in: ").append(toIndentedString(in)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); sb.append(" required: ").append(toIndentedString(required)).append("\n"); sb.append(" deprecated: ").append(toIndentedString(deprecated)).append("\n"); sb.append(" allowEmptyValue: ").append(toIndentedString(allowEmptyValue)).append("\n"); diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java index 947eaabf9a..aed54934e1 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java @@ -27,6 +27,10 @@ public class RequestBody { private String description = null; + + @OpenAPI31 + private String summary = null; + private Content content = null; private Boolean required = null; private java.util.Map extensions = null; @@ -51,6 +55,22 @@ public RequestBody description(String description) { return this; } + @OpenAPI31 + public String getSummary() { + return summary; + } + + @OpenAPI31 + public void setSummary(String summary) { + this.summary = summary; + } + + @OpenAPI31 + public RequestBody summary(String summary) { + this.summary = summary; + return this; + } + /** * returns the content property from a RequestBody instance. * @@ -159,6 +179,9 @@ public boolean equals(Object o) { if (extensions != null ? !extensions.equals(that.extensions) : that.extensions != null) { return false; } + if (summary != null ? !summary.equals(that.summary) : that.summary != null) { + return false; + } return $ref != null ? $ref.equals(that.$ref) : that.$ref == null; } @@ -170,6 +193,7 @@ public int hashCode() { result = 31 * result + (required != null ? required.hashCode() : 0); result = 31 * result + (extensions != null ? extensions.hashCode() : 0); result = 31 * result + ($ref != null ? $ref.hashCode() : 0); + result = 31 * result + (summary != null ? summary.hashCode() : 0); return result; } @@ -179,6 +203,7 @@ public String toString() { sb.append("class RequestBody {\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); sb.append(" content: ").append(toIndentedString(content)).append("\n"); sb.append(" required: ").append(toIndentedString(required)).append("\n"); sb.append("}"); diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java index a4f4336aaf..825de6423f 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java @@ -33,6 +33,10 @@ public class ApiResponse { private String description = null; + + @OpenAPI31 + private String summary = null; + private Map headers = null; private Content content = null; private java.util.Map links = null; @@ -58,6 +62,22 @@ public ApiResponse description(String description) { return this; } + @OpenAPI31 + public String getSummary() { + return summary; + } + + @OpenAPI31 + public void setSummary(String summary) { + this.summary = summary; + } + + @OpenAPI31 + public ApiResponse summary(String summary) { + this.summary = summary; + return this; + } + /** * returns the headers property from a ApiResponse instance. * @@ -166,12 +186,13 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.content, apiResponse.content) && Objects.equals(this.links, apiResponse.links) && Objects.equals(this.extensions, apiResponse.extensions) && - Objects.equals(this.$ref, apiResponse.$ref); + Objects.equals(this.$ref, apiResponse.$ref) && + Objects.equals(this.summary, apiResponse.summary); } @Override public int hashCode() { - return Objects.hash(description, headers, content, links, extensions, $ref); + return Objects.hash(description, headers, content, links, extensions, $ref, summary); } public java.util.Map getExtensions() { @@ -211,6 +232,7 @@ public String toString() { sb.append("class ApiResponse {\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); sb.append(" content: ").append(toIndentedString(content)).append("\n"); sb.append(" links: ").append(toIndentedString(links)).append("\n"); diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java index a0c00fe8fe..066f296f62 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java @@ -52,6 +52,10 @@ public String toString() { private Type type = null; private String description = null; + + @OpenAPI31 + private String summary = null; + private String name = null; private String $ref = null; @@ -122,6 +126,22 @@ public SecurityScheme description(String description) { return this; } + @OpenAPI31 + public String getSummary() { + return summary; + } + + @OpenAPI31 + public void setSummary(String summary) { + this.summary = summary; + } + + @OpenAPI31 + public SecurityScheme summary(String summary) { + this.summary = summary; + return this; + } + /** * returns the name property from a SecurityScheme instance. * @@ -326,6 +346,9 @@ public boolean equals(Object o) { if (openIdConnectUrl != null ? !openIdConnectUrl.equals(that.openIdConnectUrl) : that.openIdConnectUrl != null) { return false; } + if (summary != null ? !summary.equals(that.summary) : that.summary != null) { + return false; + } return extensions != null ? extensions.equals(that.extensions) : that.extensions == null; } @@ -341,6 +364,7 @@ public int hashCode() { result = 31 * result + (flows != null ? flows.hashCode() : 0); result = 31 * result + (openIdConnectUrl != null ? openIdConnectUrl.hashCode() : 0); result = 31 * result + (extensions != null ? extensions.hashCode() : 0); + result = 31 * result + (summary != null ? summary.hashCode() : 0); return result; } @@ -351,6 +375,7 @@ public String toString() { sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" in: ").append(toIndentedString(in)).append("\n"); sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); From 4fba7c214d54a78ca57016e1e42d93b01b507f12 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Mon, 13 Dec 2021 02:18:18 -0500 Subject: [PATCH 53/79] updated callback serializer --- .../java/io/swagger/v3/core/jackson/CallbackSerializer.java | 6 ++++++ .../v3/core/serialization/OpenAPI3_1SerializationTest.java | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/CallbackSerializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/CallbackSerializer.java index 9d3dd5757c..d606d6e9db 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/CallbackSerializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/CallbackSerializer.java @@ -43,6 +43,12 @@ public void serialize( } else { // handle ref schema serialization skipping all other props jgen.writeStartObject(); jgen.writeStringField("$ref", value.get$ref()); + if (StringUtils.isNotEmpty(value.getDescription())) { + jgen.writeStringField("description", value.getDescription()); + } + if (StringUtils.isNotEmpty(value.getSummary())) { + jgen.writeStringField("summary", value.getSummary()); + } jgen.writeEndObject(); } } 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 4cf2cf0b96..15fe12048c 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 @@ -1131,6 +1131,8 @@ public void testCallRefSerialization() { " callbacks:\n" + " callbackSample:\n" + " $ref: '#/components/callbacks/TestCallback'\n" + + " description: ref callback description\n" + + " summary: ref callback summary\n" + "components:\n" + " callbacks:\n" + " TestCallback:\n" + @@ -1148,7 +1150,9 @@ public void testCallRefSerialization() { " \"operationId\" : \"testPathItem\",\n" + " \"callbacks\" : {\n" + " \"callbackSample\" : {\n" + - " \"$ref\" : \"#/components/callbacks/TestCallback\"\n" + + " \"$ref\" : \"#/components/callbacks/TestCallback\",\n" + + " \"description\" : \"ref callback description\",\n" + + " \"summary\" : \"ref callback summary\"\n" + " }\n" + " }\n" + " }\n" + From 78b050324e94fe427aa03b201011b20bc5c18e75 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Wed, 15 Dec 2021 11:06:34 -0500 Subject: [PATCH 54/79] updated callback and parameter deserializer, and made test to check ref siblings in OAS 3.1 objects. --- .../v3/core/util/Callback31Deserializer.java | 21 +++ .../v3/core/util/CallbackDeserializer.java | 7 + .../v3/core/util/DeserializationModule31.java | 2 +- .../v3/core/util/Parameter31Deserializer.java | 24 --- .../v3/core/util/ParameterDeserializer.java | 10 +- .../OpenAPI3_1DeserializationTest.java | 40 +++++ .../3.1.0/petstore-3.1_refs_siblings.yaml | 142 ++++++++++++++++++ 7 files changed, 219 insertions(+), 27 deletions(-) create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/util/Callback31Deserializer.java create mode 100644 modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_refs_siblings.yaml diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Callback31Deserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Callback31Deserializer.java new file mode 100644 index 0000000000..aae9fd1bf1 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Callback31Deserializer.java @@ -0,0 +1,21 @@ +package io.swagger.v3.core.util; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import io.swagger.v3.oas.models.PathItem; + +import javax.security.auth.callback.Callback; +import java.io.IOException; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; + +public class Callback31Deserializer extends CallbackDeserializer { + + public Callback31Deserializer() { + openapi31 = true; + } +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/CallbackDeserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/CallbackDeserializer.java index f5a8668f20..8011541183 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/CallbackDeserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/CallbackDeserializer.java @@ -14,6 +14,9 @@ import java.util.Map; public class CallbackDeserializer extends JsonDeserializer { + + protected boolean openapi31; + @Override public Callback deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { @@ -29,6 +32,10 @@ public Callback deserialize(JsonParser jp, DeserializationContext ctxt) extensions.put(childName, Json.mapper().convertValue(child, Object.class)); } else if (childName.equals("$ref")) { result.$ref(child.asText()); + } else if (childName.equals("description") && openapi31) { + result.description(child.asText()); + } else if (childName.equals("summary") && openapi31) { + result.summary(child.asText()); } else { result.put(childName, Json.mapper().convertValue(child, PathItem.class)); } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/DeserializationModule31.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/DeserializationModule31.java index 7177638c17..c397a5df5d 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/DeserializationModule31.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/DeserializationModule31.java @@ -25,6 +25,6 @@ public DeserializationModule31() { this.addDeserializer(ApiResponses.class, new ApiResponses31Deserializer()); this.addDeserializer(Paths.class, new Paths31Deserializer()); - this.addDeserializer(Callback.class, new CallbackDeserializer()); + this.addDeserializer(Callback.class, new Callback31Deserializer()); } } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Parameter31Deserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Parameter31Deserializer.java index f14b74188d..fc9d50a001 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Parameter31Deserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Parameter31Deserializer.java @@ -1,32 +1,8 @@ package io.swagger.v3.core.util; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonNode; -import io.swagger.v3.oas.models.parameters.Parameter; -import org.apache.commons.lang3.StringUtils; - -import java.io.IOException; - public class Parameter31Deserializer extends ParameterDeserializer { public Parameter31Deserializer() { this.openapi31 = true; } - - @Override - public Parameter deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException { - - Parameter result = super.deserialize(jp, ctxt); - - if (result != null && StringUtils.isNotBlank(result.get$ref())) { - JsonNode node = jp.getCodec().readTree(jp); - JsonNode desc = node.get("description"); - if (desc != null) { - result.description(desc.asText()); - } - } - return result; - } } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java index 14918e8858..b016d8bf57 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java @@ -31,8 +31,14 @@ public Parameter deserialize(JsonParser jp, DeserializationContext ctxt) if (sub != null) { result = new Parameter().$ref(sub.asText()); - if (desc != null && openapi31) { - result.description(desc.asText()); + if (openapi31) { + if (desc != null) { + result.description(desc.asText()); + } + JsonNode summary = node.get("summary"); + if (summary != null) { + result.setSummary(summary.asText()); + } } } else if (inNode != null) { diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java index 378f29a0f4..c3e77a5e43 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java @@ -94,5 +94,45 @@ public void testDeserializationOnOAS31() throws IOException { assertNull(openAPI.getComponents().getPathItems()); assertNull(openAPI.getComponents().getSchemas().get("Pet").getDiscriminator().getExtensions()); + } + + @Test + public void testRefDeserializationOnOAS31() throws IOException { + final String jsonString = ResourceUtils.loadClassResource(getClass(), "specFiles/3.1.0/petstore-3.1_refs_siblings.yaml"); + OpenAPI openAPI = Yaml31.mapper().readValue(jsonString, OpenAPI.class); + + + assertEquals(openAPI.getPaths().get("/ref_pet").get$ref(), "#/components/pathItems/pet"); + assertEquals(openAPI.getPaths().get("/ref_pet").getDescription(), "ref pathItem description"); + assertEquals(openAPI.getPaths().get("/ref_pet").getSummary(), "ref pathItem summary"); + + assertEquals(openAPI.getPaths().get("/pets").getPost().getParameters().get(0).get$ref(), "#/components/parameters/testParameter"); + assertEquals(openAPI.getPaths().get("/pets").getPost().getParameters().get(0).getDescription(), "ref parameter description"); + assertEquals(openAPI.getPaths().get("/pets").getPost().getParameters().get(0).getSummary(), "ref parameter summary"); + + assertEquals(openAPI.getPaths().get("/pets").getPost().getParameters().get(1).getName(), "randomParam"); + assertEquals(openAPI.getPaths().get("/pets").getPost().getParameters().get(1).getIn(), "query"); + assertEquals(openAPI.getPaths().get("/pets").getPost().getParameters().get(1).getExamples().get("refExample").get$ref(), "#/components/examples/testExample"); + assertEquals(openAPI.getPaths().get("/pets").getPost().getParameters().get(1).getExamples().get("refExample").getDescription(), "ref example description"); + assertEquals(openAPI.getPaths().get("/pets").getPost().getParameters().get(1).getExamples().get("refExample").getSummary(), "ref example summary"); + + assertEquals(openAPI.getPaths().get("/pets").getPost().getCallbacks().get("callIt").get$ref(), "#/components/callbacks/TestCallback"); + assertEquals(openAPI.getPaths().get("/pets").getPost().getCallbacks().get("callIt").getDescription(), "ref call back description"); + assertEquals(openAPI.getPaths().get("/pets").getPost().getCallbacks().get("callIt").getSummary(), "ref call back summary"); + + assertEquals(openAPI.getPaths().get("/pets").getPost().getRequestBody().get$ref(), "#/components/requestBodies/body"); + assertEquals(openAPI.getPaths().get("/pets").getPost().getRequestBody().getDescription(), "ref request body description"); + assertEquals(openAPI.getPaths().get("/pets").getPost().getRequestBody().getSummary(), "ref request body summary"); + + assertEquals(openAPI.getPaths().get("/pets").getPost().getResponses().get("201").get$ref(), "#/components/responses/okResponse"); + assertEquals(openAPI.getPaths().get("/pets").getPost().getResponses().get("201").getDescription(), "ref response description"); + assertEquals(openAPI.getPaths().get("/pets").getPost().getResponses().get("201").getSummary(), "ref response summary"); + + assertEquals(openAPI.getPaths().get("/pets").getPost().getResponses().get("default").getHeaders().get("head").get$ref(), "#/components/headers/head"); + assertEquals(openAPI.getPaths().get("/pets").getPost().getResponses().get("default").getHeaders().get("head").getDescription(), "ref header description"); + assertEquals(openAPI.getPaths().get("/pets").getPost().getResponses().get("default").getHeaders().get("head").getSummary(), "ref header summary"); + + + } } diff --git a/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_refs_siblings.yaml b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_refs_siblings.yaml new file mode 100644 index 0000000000..3cb44655ca --- /dev/null +++ b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_refs_siblings.yaml @@ -0,0 +1,142 @@ +openapi: "3.1.0" +info: + version: 1.0.0 + title: Swagger Petstore + summary: petstore sample for OAS 3.1.0 + license: + name: MIT + identifier: test +servers: + - url: http://petstore.swagger.io/v1 +paths: + /ref_pet: + $ref: '#/components/pathItems/pet' + description: "ref pathItem description" + summary: "ref pathItem summary" + /pets: + post: + tags: + - pets + summary: Create a pet + operationId: createPets + parameters: + - $ref: '#/components/parameters/testParameter' + description: "ref parameter description" + summary: "ref parameter summary" + - name: randomParam + in: query + schema: + type: string + examples: + refExample: + $ref: '#/components/examples/testExample' + description: "ref example description" + summary: "ref example summary" + callbacks: + callIt: + $ref: '#/components/callbacks/TestCallback' + description: "ref call back description" + summary: "ref call back summary" + requestBody: + $ref: '#/components/requestBodies/body' + description: "ref request body description" + summary: "ref request body summary" + responses: + "201": + $ref: '#/components/responses/okResponse' + description: "ref response description" + summary: "ref response summary" + default: + description: 'default response' + headers: + head: + $ref: '#/components/headers/head' + description: "ref header description" + summary: "ref header summary" + + +components: + schemas: + Pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string + discriminator: + propertyName: tag + x-test-extension: extended + Pets: + type: array + items: + $ref: "#/components/schemas/Pet" + description: desc + format: int32 + Error: + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string + pathItems: + pet: + description: get a pet + get: + operationId: getPet + responses: + "200": + description: pet returned + links: + address: + operationId: getUserAddressByUUID + parameters: + # get the `uuid` field from the `uuid` field in the response body + userUuid: $response.body#/uuid + callbacks: + TestCallback: + '{$request.query.queryUrl}': + description: test path item + post: + operationId: testPathItem + responses: + default: + description: ok + securitySchemes: + basic: + $ref: "#/components/securitySchemes/http" + http: + type: http + scheme: basic + headers: + head: + schema: + type: string + requestBodies: + body: + description: client model + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + okResponse: + description: everything is good" + examples: + testExample: + value: Example on test + parameters: + testParameter: + name: param + in: query + schema: + type: string From c740a56e6f6764bc166273ebf528bf8151046f6c Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Wed, 29 Dec 2021 04:23:05 -0500 Subject: [PATCH 55/79] updated securityscheme deserialization class and updated serialization and deserialization tests --- .../v3/core/util/DeserializationModule31.java | 2 +- .../util/SecurityScheme31Deserializer.java | 8 + .../core/util/SecuritySchemeDeserializer.java | 8 + .../OpenAPI3_1DeserializationTest.java | 39 +++ .../OpenAPI3_1SerializationTest.java | 250 +++++++++++++++++- .../specFiles/3.1.0/petstore-3.1_sample.yaml | 40 +++ 6 files changed, 337 insertions(+), 10 deletions(-) create mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecurityScheme31Deserializer.java diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/DeserializationModule31.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/DeserializationModule31.java index c397a5df5d..b9003784e4 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/DeserializationModule31.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/DeserializationModule31.java @@ -21,7 +21,7 @@ public DeserializationModule31() { this.addDeserializer(Encoding.StyleEnum.class, new EncodingStyleEnumDeserializer()); this.addDeserializer(EncodingProperty.StyleEnum.class, new EncodingPropertyStyleEnumDeserializer()); - this.addDeserializer(SecurityScheme.class, new SecuritySchemeDeserializer()); + this.addDeserializer(SecurityScheme.class, new SecurityScheme31Deserializer()); this.addDeserializer(ApiResponses.class, new ApiResponses31Deserializer()); this.addDeserializer(Paths.class, new Paths31Deserializer()); diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecurityScheme31Deserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecurityScheme31Deserializer.java new file mode 100644 index 0000000000..9a641f28e8 --- /dev/null +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecurityScheme31Deserializer.java @@ -0,0 +1,8 @@ +package io.swagger.v3.core.util; + +public class SecurityScheme31Deserializer extends SecuritySchemeDeserializer { + + public SecurityScheme31Deserializer() { + openapi31 = true; + } +} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecuritySchemeDeserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecuritySchemeDeserializer.java index 737dbfe9ed..6e0e078cd6 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecuritySchemeDeserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecuritySchemeDeserializer.java @@ -12,6 +12,9 @@ import java.util.Arrays; public class SecuritySchemeDeserializer extends JsonDeserializer { + + protected boolean openapi31; + @Override public SecurityScheme deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { @@ -53,6 +56,11 @@ public SecurityScheme deserialize(JsonParser jp, DeserializationContext ctxt) .type(SecurityScheme.Type.MUTUALTLS); } + JsonNode summaryNode = node.get("summary"); + if (summaryNode != null && openapi31) { + result.setSummary(summaryNode.asText()); + } + } return result; diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java index c3e77a5e43..906ecd9b81 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java @@ -86,6 +86,45 @@ public void testDeserializationOnOAS31() throws IOException { assertNotNull(openAPI.getComponents().getSchemas().get("Pet").getDiscriminator().getExtensions()); assertEquals(openAPI.getComponents().getSchemas().get("Pet").getDiscriminator().getExtensions().get("x-test-extension"), "extended"); + assertNotNull(openAPI.getComponents().getResponses()); + assertNotNull(openAPI.getComponents().getResponses().get("201")); + assertEquals(openAPI.getComponents().getResponses().get("201").getDescription(), "api response description"); + assertEquals(openAPI.getComponents().getResponses().get("201").getSummary(), "api response summary"); + + assertNotNull(openAPI.getComponents().getParameters()); + assertNotNull(openAPI.getComponents().getParameters().get("param")); + assertEquals(openAPI.getComponents().getParameters().get("param").getIn(), "query"); + assertEquals(openAPI.getComponents().getParameters().get("param").getName(), "param0"); + assertEquals(openAPI.getComponents().getParameters().get("param").getDescription(), "parameter description"); + assertEquals(openAPI.getComponents().getParameters().get("param").getSummary(), "parameter summary"); + + assertNotNull(openAPI.getComponents().getExamples()); + assertNotNull(openAPI.getComponents().getExamples().get("example")); + assertEquals(openAPI.getComponents().getExamples().get("example").getDescription(), "example description"); + assertEquals(openAPI.getComponents().getExamples().get("example").getSummary(), "example summary"); + assertEquals(openAPI.getComponents().getExamples().get("example").getValue(), "This is an example"); + + assertNotNull(openAPI.getComponents().getRequestBodies()); + assertNotNull(openAPI.getComponents().getRequestBodies().get("body")); + + assertNotNull(openAPI.getComponents().getHeaders()); + assertNotNull(openAPI.getComponents().getHeaders().get("test-head")); + assertEquals(openAPI.getComponents().getHeaders().get("test-head").getDescription(), "test header description"); + assertEquals(openAPI.getComponents().getHeaders().get("test-head").getSummary(), "test header summary"); + + assertNotNull(openAPI.getComponents().getSecuritySchemes()); + assertNotNull(openAPI.getComponents().getSecuritySchemes().get("basic")); + assertEquals(openAPI.getComponents().getSecuritySchemes().get("basic").getDescription(), "security description"); + assertEquals(openAPI.getComponents().getSecuritySchemes().get("basic").getSummary(), "security summary"); + assertEquals(openAPI.getComponents().getSecuritySchemes().get("basic").getType().toString(), "http"); + + assertNotNull(openAPI.getComponents().getLinks()); + assertNotNull(openAPI.getComponents().getLinks().get("Link")); + assertEquals(openAPI.getComponents().getLinks().get("Link").getOperationRef(), "#/paths/~12.0~1repositories~1{username}/get"); + + assertNotNull(openAPI.getComponents().getCallbacks()); + assertNotNull(openAPI.getComponents().getCallbacks().get("TestCallback")); + openAPI = Yaml.mapper().readValue(jsonString, OpenAPI.class); assertNotNull(openAPI); 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 15fe12048c..b5253c6cee 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 @@ -31,6 +31,9 @@ import org.checkerframework.checker.units.qual.C; import org.testng.annotations.Test; +import java.util.HashMap; +import java.util.Map; + import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; @@ -441,7 +444,7 @@ public void testInfoSerialization() { } @Test - public void testOWebHooksSerialization() { + public void testWebHooksSerialization() { OpenAPI openAPI = new OpenAPI() .openapi("3.1.0") .addWebhooks("hook", new PathItem() @@ -495,13 +498,85 @@ public void testComponentPathItemsSerialization() { .get(new Operation() .operationId("testPathItem") .responses(new ApiResponses() - .addApiResponse("200", new ApiResponse().description("response description")))))); + .addApiResponse("200", new ApiResponse().description("response description"))))) + .addResponses("201", new ApiResponse() + .description("api response description") + .summary("api response summary")) + .addParameters("param", new Parameter() + .in("query") + .description("parameter description") + .summary("parameter summary") + .schema(schema)) + .addExamples("example", new Example() + .summary("example summary") + .value("This is an example/") + .description("example description")) + .addRequestBodies("body", new RequestBody() + .content(new Content() + .addMediaType("application/json", new MediaType() + .schema(new ObjectSchema())))) + .addHeaders("test-head", new Header() + .description("test header description") + .summary("test header summary")) + .addSecuritySchemes("basic", new SecurityScheme() + .in(SecurityScheme.In.HEADER) + .scheme("http") + .description("ref security description") + .summary("ref security summary")) + .addLinks("Link", new Link() + .operationRef("#/paths/~12.0~1repositories~1{username}/get")) + .addCallbacks("TestCallback", new Callback().addPathItem("{$request.query.queryUrl}", new PathItem() + .description("test path item") + .post(new Operation() + .operationId("testPathItem"))))); + + Yaml31.prettyPrint(openAPI); SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + "components:\n" + " schemas:\n" + " stringTest:\n" + " type: string\n" + + " responses:\n" + + " \"201\":\n" + + " description: api response description\n" + + " summary: api response summary\n" + + " parameters:\n" + + " param:\n" + + " in: query\n" + + " description: parameter description\n" + + " summary: parameter summary\n" + + " schema:\n" + + " type: string\n" + + " examples:\n" + + " example:\n" + + " summary: example summary\n" + + " description: example description\n" + + " value: This is an example/\n" + + " requestBodies:\n" + + " body:\n" + + " content:\n" + + " application/json:\n" + + " schema: {}\n" + + " headers:\n" + + " test-head:\n" + + " description: test header description\n" + + " summary: test header summary\n" + + " securitySchemes:\n" + + " basic:\n" + + " description: ref security description\n" + + " summary: ref security summary\n" + + " in: header\n" + + " scheme: http\n" + + " links:\n" + + " Link:\n" + + " operationRef: \"#/paths/~12.0~1repositories~1{username}/get\"\n" + + " callbacks:\n" + + " TestCallback:\n" + + " '{$request.query.queryUrl}':\n" + + " description: test path item\n" + + " post:\n" + + " operationId: testPathItem\n" + " pathItems:\n" + " /pathTest:\n" + " description: test path item\n" + @@ -515,9 +590,70 @@ public void testComponentPathItemsSerialization() { " \"openapi\" : \"3.1.0\",\n" + " \"components\" : {\n" + " \"schemas\" : {\n" + - " \"stringTest\" : {" + - " \"type\" : \"string\"" + - " }\n" + + " \"stringTest\" : {\n" + + " \"type\" : \"string\"\n" + + " }\n" + + " },\n" + + " \"responses\" : {\n" + + " \"201\" : {\n" + + " \"description\" : \"api response description\",\n" + + " \"summary\" : \"api response summary\"\n" + + " }\n" + + " },\n" + + " \"parameters\" : {\n" + + " \"param\" : {\n" + + " \"in\" : \"query\",\n" + + " \"description\" : \"parameter description\",\n" + + " \"summary\" : \"parameter summary\",\n" + + " \"schema\" : {\n" + + " \"type\" : \"string\"\n" + + " }\n" + + " }\n" + + " },\n" + + " \"examples\" : {\n" + + " \"example\" : {\n" + + " \"summary\" : \"example summary\",\n" + + " \"description\" : \"example description\",\n" + + " \"value\" : \"This is an example/\"\n" + + " }\n" + + " },\n" + + " \"requestBodies\" : {\n" + + " \"body\" : {\n" + + " \"content\" : {\n" + + " \"application/json\" : {\n" + + " \"schema\" : { }\n" + + " }\n" + + " }\n" + + " }\n" + + " },\n" + + " \"headers\" : {\n" + + " \"test-head\" : {\n" + + " \"description\" : \"test header description\",\n" + + " \"summary\" : \"test header summary\"\n" + + " }\n" + + " },\n" + + " \"securitySchemes\" : {\n" + + " \"basic\" : {\n" + + " \"description\" : \"ref security description\",\n" + + " \"summary\" : \"ref security summary\",\n" + + " \"in\" : \"header\",\n" + + " \"scheme\" : \"http\"\n" + + " }\n" + + " },\n" + + " \"links\" : {\n" + + " \"Link\" : {\n" + + " \"operationRef\" : \"#/paths/~12.0~1repositories~1{username}/get\"\n" + + " }\n" + + " },\n" + + " \"callbacks\" : {\n" + + " \"TestCallback\" : {\n" + + " \"{$request.query.queryUrl}\" : {\n" + + " \"description\" : \"test path item\",\n" + + " \"post\" : {\n" + + " \"operationId\" : \"testPathItem\"\n" + + " }\n" + + " }\n" + + " }\n" + " },\n" + " \"pathItems\" : {\n" + " \"/pathTest\" : {\n" + @@ -540,15 +676,111 @@ public void testComponentPathItemsSerialization() { "components:\n" + " schemas:\n" + " stringTest:\n" + - " type: string\n"); + " type: string\n" + + " responses:\n" + + " \"201\":\n" + + " description: api response description\n" + + " parameters:\n" + + " param:\n" + + " in: query\n" + + " description: parameter description\n" + + " schema:\n" + + " type: string\n" + + " examples:\n" + + " example:\n" + + " summary: example summary\n" + + " description: example description\n" + + " value: This is an example/\n" + + " requestBodies:\n" + + " body:\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " type: object\n" + + " headers:\n" + + " test-head:\n" + + " description: test header description\n" + + " securitySchemes:\n" + + " basic:\n" + + " description: ref security description\n" + + " in: header\n" + + " scheme: http\n" + + " links:\n" + + " Link:\n" + + " operationRef: \"#/paths/~12.0~1repositories~1{username}/get\"\n" + + " callbacks:\n" + + " TestCallback:\n" + + " '{$request.query.queryUrl}':\n" + + " description: test path item\n" + + " post:\n" + + " operationId: testPathItem"); SerializationMatchers.assertEqualsToJson(openAPI, "{\n" + " \"openapi\" : \"3.0.3\",\n" + " \"components\" : {\n" + " \"schemas\" : {\n" + - " \"stringTest\" : {" + - " \"type\" : \"string\"" + - " }\n" + + " \"stringTest\" : {\n" + + " \"type\" : \"string\"\n" + + " }\n" + + " },\n" + + " \"responses\" : {\n" + + " \"201\" : {\n" + + " \"description\" : \"api response description\"\n" + + " }\n" + + " },\n" + + " \"parameters\" : {\n" + + " \"param\" : {\n" + + " \"in\" : \"query\",\n" + + " \"description\" : \"parameter description\",\n" + + " \"schema\" : {\n" + + " \"type\" : \"string\"\n" + + " }\n" + + " }\n" + + " },\n" + + " \"examples\" : {\n" + + " \"example\" : {\n" + + " \"summary\" : \"example summary\",\n" + + " \"description\" : \"example description\",\n" + + " \"value\" : \"This is an example/\"\n" + + " }\n" + + " },\n" + + " \"requestBodies\" : {\n" + + " \"body\" : {\n" + + " \"content\" : {\n" + + " \"application/json\" : {\n" + + " \"schema\" : {\n" + + " \"type\" : \"object\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " },\n" + + " \"headers\" : {\n" + + " \"test-head\" : {\n" + + " \"description\" : \"test header description\"\n" + + " }\n" + + " },\n" + + " \"securitySchemes\" : {\n" + + " \"basic\" : {\n" + + " \"description\" : \"ref security description\",\n" + + " \"in\" : \"header\",\n" + + " \"scheme\" : \"http\"\n" + + " }\n" + + " },\n" + + " \"links\" : {\n" + + " \"Link\" : {\n" + + " \"operationRef\" : \"#/paths/~12.0~1repositories~1{username}/get\"\n" + + " }\n" + + " },\n" + + " \"callbacks\" : {\n" + + " \"TestCallback\" : {\n" + + " \"{$request.query.queryUrl}\" : {\n" + + " \"description\" : \"test path item\",\n" + + " \"post\" : {\n" + + " \"operationId\" : \"testPathItem\"\n" + + " }\n" + + " }\n" + + " }\n" + " }\n" + " }\n" + "}"); diff --git a/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_sample.yaml b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_sample.yaml index 36e9d52c09..ed7368dd6e 100644 --- a/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_sample.yaml +++ b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_sample.yaml @@ -131,6 +131,46 @@ components: format: int32 message: type: string + responses: + "201": + description: api response description + summary: api response summary + parameters: + param: + in: query + name: param0 + description: parameter description + summary: parameter summary + schema: + type: string + examples: + example: + summary: example summary + description: example description + value: This is an example + requestBodies: + body: + content: + application/json: + schema: { } + headers: + test-head: + description: test header description + summary: test header summary + securitySchemes: + basic: + description: security description + summary: security summary + type: http + links: + Link: + operationRef: "#/paths/~12.0~1repositories~1{username}/get" + callbacks: + TestCallback: + '{$request.query.queryUrl}': + description: test path item + post: + operationId: testPathItem pathItems: /pet: description: get a pet From 12b29070faae297b3517641c0d9727a1c31d168b Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Wed, 29 Dec 2021 04:48:55 -0500 Subject: [PATCH 56/79] added deserialization test for OAS 3.0 using a OAS 3.1 definition --- .../OpenAPI3_1DeserializationTest.java | 66 ++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java index 906ecd9b81..cf603e5235 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java @@ -13,7 +13,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; public class OpenAPI3_1DeserializationTest { @@ -135,6 +134,71 @@ public void testDeserializationOnOAS31() throws IOException { } + @Test + public void testDeserializationOnOAS30() throws IOException { + + final String jsonString = ResourceUtils.loadClassResource(getClass(), "specFiles/3.1.0/petstore-3.1_sample.yaml"); + OpenAPI openAPI = Yaml.mapper().readValue(jsonString, OpenAPI.class); + assertNotNull(openAPI); + + assertEquals(openAPI.getInfo().getTitle(), "Swagger Petstore"); + assertEquals(openAPI.getInfo().getVersion(), "1.0.0"); + assertNull(openAPI.getInfo().getSummary()); + assertEquals(openAPI.getInfo().getLicense().getName(), "MIT"); + assertNull(openAPI.getInfo().getLicense().getIdentifier()); + + assertNull(openAPI.getWebhooks()); + + assertNull(openAPI.getComponents().getPathItems()); + + assertNotNull(openAPI.getComponents().getSchemas()); + assertNotNull(openAPI.getComponents().getSchemas().get("Pet")); + assertNotNull(openAPI.getComponents().getSchemas().get("Pet").getDiscriminator()); + assertNull(openAPI.getComponents().getSchemas().get("Pet").getDiscriminator().getExtensions()); + + assertNotNull(openAPI.getComponents().getResponses()); + assertNotNull(openAPI.getComponents().getResponses().get("201")); + assertEquals(openAPI.getComponents().getResponses().get("201").getDescription(), "api response description"); + assertNull(openAPI.getComponents().getResponses().get("201").getSummary()); + + assertNotNull(openAPI.getComponents().getParameters()); + assertNotNull(openAPI.getComponents().getParameters().get("param")); + assertEquals(openAPI.getComponents().getParameters().get("param").getIn(), "query"); + assertEquals(openAPI.getComponents().getParameters().get("param").getName(), "param0"); + assertEquals(openAPI.getComponents().getParameters().get("param").getDescription(), "parameter description"); + assertNull(openAPI.getComponents().getParameters().get("param").getSummary()); + + assertNotNull(openAPI.getComponents().getExamples()); + assertNotNull(openAPI.getComponents().getExamples().get("example")); + assertEquals(openAPI.getComponents().getExamples().get("example").getDescription(), "example description"); + assertEquals(openAPI.getComponents().getExamples().get("example").getSummary(), "example summary"); + assertEquals(openAPI.getComponents().getExamples().get("example").getValue(), "This is an example"); + + assertNotNull(openAPI.getComponents().getRequestBodies()); + assertNotNull(openAPI.getComponents().getRequestBodies().get("body")); + + assertNotNull(openAPI.getComponents().getHeaders()); + assertNotNull(openAPI.getComponents().getHeaders().get("test-head")); + assertEquals(openAPI.getComponents().getHeaders().get("test-head").getDescription(), "test header description"); + assertNull(openAPI.getComponents().getHeaders().get("test-head").getSummary()); + + assertNotNull(openAPI.getComponents().getSecuritySchemes()); + assertNotNull(openAPI.getComponents().getSecuritySchemes().get("basic")); + assertEquals(openAPI.getComponents().getSecuritySchemes().get("basic").getDescription(), "security description"); + assertNull(openAPI.getComponents().getSecuritySchemes().get("basic").getSummary()); + assertEquals(openAPI.getComponents().getSecuritySchemes().get("basic").getType().toString(), "http"); + + assertNotNull(openAPI.getComponents().getLinks()); + assertNotNull(openAPI.getComponents().getLinks().get("Link")); + assertEquals(openAPI.getComponents().getLinks().get("Link").getOperationRef(), "#/paths/~12.0~1repositories~1{username}/get"); + + assertNotNull(openAPI.getComponents().getCallbacks()); + assertNotNull(openAPI.getComponents().getCallbacks().get("TestCallback")); + + openAPI = Yaml.mapper().readValue(jsonString, OpenAPI.class); + assertNotNull(openAPI); + } + @Test public void testRefDeserializationOnOAS31() throws IOException { final String jsonString = ResourceUtils.loadClassResource(getClass(), "specFiles/3.1.0/petstore-3.1_refs_siblings.yaml"); From b9413b6a8c078987fc94af20c685d24d17015618 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Thu, 30 Dec 2021 14:24:42 -0500 Subject: [PATCH 57/79] update type for unevaluatedProperties property --- .../main/java/io/swagger/v3/oas/models/media/Schema.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 93d1a9cd66..401674c525 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 @@ -145,7 +145,7 @@ public Schema specVersion(SpecVersion specVersion) { @OpenAPI31 private Schema propertyNames; @OpenAPI31 - private Schema unevaluatedProperties; + private Object unevaluatedProperties; @OpenAPI31 private Integer maxContains; @OpenAPI31 @@ -1297,17 +1297,17 @@ public Schema propertyNames(Schema propertyNames) { } @OpenAPI31 - public Schema getUnevaluatedProperties() { + public Object getUnevaluatedProperties() { return unevaluatedProperties; } @OpenAPI31 - public void setUnevaluatedProperties(Schema unevaluatedProperties) { + public void setUnevaluatedProperties(Object unevaluatedProperties) { this.unevaluatedProperties = unevaluatedProperties; } @OpenAPI31 - public Schema unevaluatedProperties(Schema unevaluatedProperties) { + public Schema unevaluatedProperties(Object unevaluatedProperties) { this.unevaluatedProperties = unevaluatedProperties; return this; } From 693ca1e4b672cf2500809d7cdee7ef0be9a3b2e1 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Mon, 3 Jan 2022 08:03:29 -0500 Subject: [PATCH 58/79] added tests to check that ref property is deserialized along other properties in schema object. --- .../SchemaDeserializationTest.java | 31 +++++++++++++++++++ .../3.1.0/petstore-3.1_refs_siblings.yaml | 9 ++++++ 2 files changed, 40 insertions(+) create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/SchemaDeserializationTest.java diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/SchemaDeserializationTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/SchemaDeserializationTest.java new file mode 100644 index 0000000000..6f506b3cf5 --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/SchemaDeserializationTest.java @@ -0,0 +1,31 @@ +package io.swagger.v3.core.deserialization; + +import io.swagger.v3.core.util.ResourceUtils; +import io.swagger.v3.core.util.Yaml31; +import io.swagger.v3.oas.models.OpenAPI; +import org.testng.annotations.Test; + +import java.io.IOException; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; + +public class SchemaDeserializationTest { + + @Test + public void deserializeRefSchema3_1() throws IOException { + + final String jsonString = ResourceUtils.loadClassResource(getClass(), "specFiles/3.1.0/petstore-3.1_refs_siblings.yaml"); + final OpenAPI openAPI = Yaml31.mapper().readValue(jsonString, OpenAPI.class); + assertNotNull(openAPI); + assertNotNull(openAPI.getComponents()); + assertNotNull(openAPI.getComponents().getSchemas()); + assertNotNull(openAPI.getComponents().getSchemas().get("AnotherPet")); + assertEquals(openAPI.getComponents().getSchemas().get("AnotherPet").get$ref(), "#/components/schemas/Pet"); + assertEquals(openAPI.getComponents().getSchemas().get("AnotherPet").getTitle(), "Another Pet"); + assertEquals(openAPI.getComponents().getSchemas().get("AnotherPet").getDescription(), "Another Pet for petstore referencing Pet schema"); + assertNotNull(openAPI.getComponents().getSchemas().get("AnotherPet").getProperties()); + assertNotNull(openAPI.getComponents().getSchemas().get("AnotherPet").getProperties().get("category")); + assertNotNull(openAPI.getComponents().getSchemas().get("AnotherPet").getProperties().get("photoUrl")); + } +} diff --git a/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_refs_siblings.yaml b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_refs_siblings.yaml index 3cb44655ca..d1999c93ac 100644 --- a/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_refs_siblings.yaml +++ b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_refs_siblings.yaml @@ -88,6 +88,15 @@ components: format: int32 message: type: string + AnotherPet: + title: Another Pet + description: Another Pet for petstore referencing Pet schema + $ref: "#/components/schemas/Pet" + properties: + category: + type: string + photoUrl: + type: string pathItems: pet: description: get a pet From 53b6a91c881bad3543e1b03a59178cd162a989ee Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Tue, 4 Jan 2022 23:06:38 -0500 Subject: [PATCH 59/79] added tests to check ref serialization siblings. --- .../SchemaSerializationTest.java | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/SchemaSerializationTest.java diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/SchemaSerializationTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/SchemaSerializationTest.java new file mode 100644 index 0000000000..00f63796ec --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/SchemaSerializationTest.java @@ -0,0 +1,55 @@ +package io.swagger.v3.core.serialization; + +import io.swagger.v3.core.matchers.SerializationMatchers; +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.media.Schema; +import org.testng.annotations.Test; + +public class SchemaSerializationTest { + + @Test + public void serializeRefSchema3_1() { + OpenAPI openAPI = new OpenAPI() + .components(new Components() + .addSchemas("Pet", new Schema() + .addProperties("id", new Schema().type("integer")) + .addProperties("name", new Schema().type("string")) + .addProperties("tag", new Schema().type("string"))) + .addSchemas("AnotherPet", new Schema() + .title("Another Pet") + .description("Another Pet for petstore referencing Pet schema") + .$ref("#/components/schemas/Pet") + .addProperties("category", new Schema().type("string")) + .addProperties("photoUrl", new Schema().type("string")))); + + SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.0.1\n" + + "components:\n" + + " schemas:\n" + + " Pet:\n" + + " properties:\n" + + " id: {}\n" + + " name: {}\n" + + " tag: {}\n" + + " AnotherPet:\n" + + " title: Another Pet\n" + + " properties:\n" + + " category: {}\n" + + " photoUrl: {}\n" + + " description: Another Pet for petstore referencing Pet schema\n" + + " $ref: '#/components/schemas/Pet'"); + SerializationMatchers.assertEqualsToYaml(openAPI, "openapi: 3.0.1\n" + + "components:\n" + + " schemas:\n" + + " Pet:\n" + + " properties:\n" + + " id:\n" + + " type: integer\n" + + " name:\n" + + " type: string\n" + + " tag:\n" + + " type: string\n" + + " AnotherPet:\n" + + " $ref: '#/components/schemas/Pet'"); + } +} From 37917b0928aa551e8c58d59849d6bc07f154ce69 Mon Sep 17 00:00:00 2001 From: gracekarina Date: Mon, 17 Jan 2022 10:16:23 -0500 Subject: [PATCH 60/79] added basic file for 3.1 testing --- .../test/resources/testOAS31/basicOAS31.yaml | 164 ++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 modules/swagger-core/src/test/resources/testOAS31/basicOAS31.yaml diff --git a/modules/swagger-core/src/test/resources/testOAS31/basicOAS31.yaml b/modules/swagger-core/src/test/resources/testOAS31/basicOAS31.yaml new file mode 100644 index 0000000000..7a7e631695 --- /dev/null +++ b/modules/swagger-core/src/test/resources/testOAS31/basicOAS31.yaml @@ -0,0 +1,164 @@ +openapi: "3.1.0" +info: + version: 1.0.0 + title: Swagger Petstore + license: + name: MIT + identifier: test +servers: + - url: http://petstore.swagger.io/v1 +webhooks: + # Each webhook needs a name + newPet: + # This is a Path Item Object, the only difference is that the request is initiated by the API provider + post: + requestBody: + description: Information about a new pet in the system + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: pet + responses: + "200": + description: Return a 200 status to indicate that the data was received successfully +paths: + /pets: + get: + summary: List all pets + operationId: listPets + tags: + - pets + parameters: + - name: limit + in: query + description: How many items to return at one time (max 100) + required: false + schema: + type: integer + format: int32 + responses: + "200": + description: An paged array of pets + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + content: + application/json: + schema: + $ref: "#/components/schemas/Pets" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + description: error + post: + summary: Create a pet + operationId: createPets + tags: + - pets + responses: + "201": + description: Null response + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Tag" + /pets/{petId}: + get: + summary: Info for a specific pet + operationId: showPetById + tags: + - pets + parameters: + - name: petId + in: path + required: true + description: The id of the pet to retrieve + schema: + type: string + - $ref: "#/components/parameters/User" + description: user + summary: user + responses: + "200": + description: Expected response to a valid request + content: + application/json: + schema: + $ref: "#/components/schemas/Pets" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" +components: + parameters: + User: + in: query + description: user + name: user + schema: + type: string + schemas: + Pet: + type: + - object + - string + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + testenum: + type: string + enum: + - available + - pending + - sold + default: available + testconst: + type: string + const: pending + tag: + type: string + arbitraryKeyword: test + Pets: + type: array + items: + $ref: "#/components/schemas/Pet" + Error: + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string + tag: + $ref: "#/components/schemas/Tag" + Tag: + type: + - object + - string + - string + - foo + properties: + id: + type: integer + format: int64 + name: + type: string From dc6c9fd17c06070f49c6541114c755c335611f75 Mon Sep 17 00:00:00 2001 From: frantuma Date: Fri, 18 Feb 2022 21:09:23 +0100 Subject: [PATCH 61/79] OpenAPI 3.1 - various fixes --- .../v3/core/jackson/CallbackSerializer.java | 6 -- .../v3/core/jackson/Schema31Serializer.java | 14 +-- ...ponseMixin.java => Components31Mixin.java} | 11 ++- .../v3/core/jackson/mixin/HeaderMixin.java | 19 ---- .../mixin/{LinkMixin.java => InfoMixin.java} | 2 +- ...CallbackMixin.java => OpenAPI31Mixin.java} | 12 +-- .../v3/core/jackson/mixin/ParameterMixin.java | 19 ---- .../core/jackson/mixin/RequestBodyMixin.java | 19 ---- .../v3/core/jackson/mixin/Schema31Mixin.java | 2 +- .../jackson/mixin/SchemaConverterMixin.java | 95 ++++++++++++++++--- .../v3/core/jackson/mixin/SchemaMixin.java | 59 ++++++++++++ .../jackson/mixin/SecuritySchemeMixin.java | 19 ---- .../core/util/ApiResponsesDeserializer.java | 4 +- .../v3/core/util/CallbackDeserializer.java | 16 ++-- .../v3/core/util/ObjectMapperFactory.java | 39 +++----- .../v3/core/util/ParameterDeserializer.java | 10 +- .../core/util/SecuritySchemeDeserializer.java | 15 +-- .../converting/SwaggerSerializerTest.java | 2 +- .../OpenAPI3_1DeserializationTest.java | 16 ---- .../OpenAPI3_1SerializationTest.java | 84 ++++------------ .../3.1.0/petstore-3.1_refs_siblings.yaml | 2 - .../io/swagger/v3/oas/models/Components.java | 2 +- .../io/swagger/v3/oas/models/OpenAPI.java | 2 +- .../io/swagger/v3/oas/models/Operation.java | 2 +- .../v3/oas/models/callbacks/Callback.java | 49 +--------- .../swagger/v3/oas/models/headers/Header.java | 28 +----- .../io/swagger/v3/oas/models/links/Link.java | 30 +----- .../swagger/v3/oas/models/media/Schema.java | 27 +----- .../v3/oas/models/parameters/Parameter.java | 27 +----- .../v3/oas/models/parameters/RequestBody.java | 25 ----- .../v3/oas/models/responses/ApiResponse.java | 30 ++---- .../oas/models/security/SecurityScheme.java | 28 ------ 32 files changed, 242 insertions(+), 473 deletions(-) rename modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/{ApiResponseMixin.java => Components31Mixin.java} (50%) delete mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/HeaderMixin.java rename modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/{LinkMixin.java => InfoMixin.java} (93%) rename modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/{CallbackMixin.java => OpenAPI31Mixin.java} (55%) delete mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ParameterMixin.java delete mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/RequestBodyMixin.java delete mode 100644 modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SecuritySchemeMixin.java diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/CallbackSerializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/CallbackSerializer.java index d606d6e9db..9d3dd5757c 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/CallbackSerializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/CallbackSerializer.java @@ -43,12 +43,6 @@ public void serialize( } else { // handle ref schema serialization skipping all other props jgen.writeStartObject(); jgen.writeStringField("$ref", value.get$ref()); - if (StringUtils.isNotEmpty(value.getDescription())) { - jgen.writeStringField("description", value.getDescription()); - } - if (StringUtils.isNotEmpty(value.getSummary())) { - jgen.writeStringField("summary", value.getSummary()); - } jgen.writeEndObject(); } } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java index 3f477c6592..a582b5ce96 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/Schema31Serializer.java @@ -29,13 +29,13 @@ public void serialize( Schema value, JsonGenerator jgen, SerializerProvider provider) throws IOException { - defaultSerializer.serialize(value, jgen, provider); - -/* - // handle ref schema serialization skipping all other props - if (value.getJsonSchema() != null) { - jgen.writeObject(value.getJsonSchema()); + if (value.getExampleSetFlag() && value.getExample() == null) { + jgen.writeStartObject(); + defaultSerializer.unwrappingSerializer(null).serialize(value, jgen, provider); + jgen.writeNullField("example"); + jgen.writeEndObject(); + } else { + defaultSerializer.serialize(value, jgen, provider); } -*/ } } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ApiResponseMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Components31Mixin.java similarity index 50% rename from modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ApiResponseMixin.java rename to modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Components31Mixin.java index a623829b08..71945ebeec 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ApiResponseMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Components31Mixin.java @@ -2,11 +2,13 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import io.swagger.v3.core.jackson.CallbackSerializer; +import io.swagger.v3.oas.models.callbacks.Callback; import java.util.Map; -public abstract class ApiResponseMixin { +public abstract class Components31Mixin { @JsonAnyGetter public abstract Map getExtensions(); @@ -14,6 +16,7 @@ public abstract class ApiResponseMixin { @JsonAnySetter public abstract void addExtension(String name, Object value); - @JsonIgnore - public abstract String getSummary(); + @JsonSerialize(contentUsing = CallbackSerializer.class) + public abstract Map getCallbacks(); + } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/HeaderMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/HeaderMixin.java deleted file mode 100644 index b9f4615eec..0000000000 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/HeaderMixin.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.swagger.v3.core.jackson.mixin; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; - -import java.util.Map; - -public abstract class HeaderMixin { - - @JsonAnyGetter - public abstract Map getExtensions(); - - @JsonAnySetter - public abstract void addExtension(String name, Object value); - - @JsonIgnore - public abstract String getSummary(); -} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/LinkMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/InfoMixin.java similarity index 93% rename from modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/LinkMixin.java rename to modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/InfoMixin.java index 027ca05dbf..0eb289d552 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/LinkMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/InfoMixin.java @@ -6,7 +6,7 @@ import java.util.Map; -public abstract class LinkMixin { +public abstract class InfoMixin { @JsonAnyGetter public abstract Map getExtensions(); diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/CallbackMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/OpenAPI31Mixin.java similarity index 55% rename from modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/CallbackMixin.java rename to modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/OpenAPI31Mixin.java index 50c13dda21..96add18b36 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/CallbackMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/OpenAPI31Mixin.java @@ -2,11 +2,13 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import io.swagger.v3.core.jackson.PathsSerializer; +import io.swagger.v3.oas.models.Paths; import java.util.Map; -public abstract class CallbackMixin { +public abstract class OpenAPI31Mixin { @JsonAnyGetter public abstract Map getExtensions(); @@ -14,9 +16,7 @@ public abstract class CallbackMixin { @JsonAnySetter public abstract void addExtension(String name, Object value); - @JsonIgnore - public abstract String getDescription(); + @JsonSerialize(using = PathsSerializer.class) + public abstract Paths getPaths(); - @JsonIgnore - public abstract String getSummary(); } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ParameterMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ParameterMixin.java deleted file mode 100644 index 30e432c7ac..0000000000 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/ParameterMixin.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.swagger.v3.core.jackson.mixin; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; - -import java.util.Map; - -public abstract class ParameterMixin { - - @JsonAnyGetter - public abstract Map getExtensions(); - - @JsonAnySetter - public abstract void addExtension(String name, Object value); - - @JsonIgnore - public abstract String getSummary(); -} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/RequestBodyMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/RequestBodyMixin.java deleted file mode 100644 index 3089c79246..0000000000 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/RequestBodyMixin.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.swagger.v3.core.jackson.mixin; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; - -import java.util.Map; - -public abstract class RequestBodyMixin { - - @JsonAnyGetter - public abstract Map getExtensions(); - - @JsonAnySetter - public abstract void addExtension(String name, Object value); - - @JsonIgnore - public abstract String getSummary(); -} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java index 7dc9d8bd59..02170fc62e 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java @@ -52,7 +52,7 @@ public abstract class Schema31Mixin { @JsonIgnore public abstract boolean getExampleSetFlag(); - @JsonInclude(JsonInclude.Include.CUSTOM) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) public abstract Object getExample(); @JsonIgnore diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java index b026c3490c..b1b38ff4b6 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaConverterMixin.java @@ -4,25 +4,18 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.models.media.Schema; +import java.math.BigDecimal; +import java.util.List; import java.util.Map; +import java.util.Set; public abstract class SchemaConverterMixin { @JsonIgnore public abstract Map getJsonSchema(); -/* - @JsonIgnore - public abstract Boolean getNullable(); - - @JsonIgnore - public abstract Boolean getExclusiveMinimum(); - - @JsonIgnore - public abstract Boolean getExclusiveMaximum(); -*/ - @JsonAnyGetter public abstract Map getExtensions(); @@ -32,10 +25,88 @@ public abstract class SchemaConverterMixin { @JsonIgnore public abstract boolean getExampleSetFlag(); - @JsonInclude(JsonInclude.Include.CUSTOM) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) public abstract Object getExample(); @JsonIgnore public abstract Object getJsonSchemaImpl(); + @JsonIgnore + public abstract BigDecimal getExclusiveMinimumValue(); + + @JsonIgnore + public abstract BigDecimal getExclusiveMaximumValue(); + + @JsonIgnore + public abstract Schema getContains(); + + @JsonIgnore + public abstract String get$id(); + + @JsonIgnore + public abstract String get$anchor(); + + @JsonIgnore + public abstract String get$schema(); + + @JsonIgnore + public abstract Set getTypes(); + + @JsonIgnore + public abstract Map getPatternProperties(); + + @JsonIgnore + public abstract List getPrefixItems(); + + @JsonIgnore + public abstract String getContentEncoding(); + + @JsonIgnore + public abstract String getContentMediaType(); + + @JsonIgnore + public abstract Schema getContentSchema(); + + @JsonIgnore + public abstract Schema getPropertyNames(); + + @JsonIgnore + public abstract Object getUnevaluatedProperties(); + + @JsonIgnore + public abstract Integer getMaxContains(); + + @JsonIgnore + public abstract Integer getMinContains(); + + @JsonIgnore + public abstract Schema getAdditionalItems(); + + @JsonIgnore + public abstract Schema getUnevaluatedItems(); + + @JsonIgnore + public abstract Schema getIf(); + + @JsonIgnore + public abstract Schema getElse(); + + @JsonIgnore + public abstract Schema getThen(); + + @JsonIgnore + public abstract Map getDependentSchemas(); + + @JsonIgnore + public abstract Map> getDependentRequired(); + + @JsonIgnore + public abstract String get$comment(); + + @JsonIgnore + public abstract List getExamples(); + + @JsonIgnore + public abstract Object getConst(); + } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java index 2940fb3691..7c4637eddd 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SchemaMixin.java @@ -7,6 +7,7 @@ import io.swagger.v3.oas.models.media.Schema; import java.math.BigDecimal; +import java.util.List; import java.util.Map; import java.util.Set; @@ -35,12 +36,16 @@ public abstract class SchemaMixin { @JsonIgnore public abstract Schema getContains(); + @JsonIgnore public abstract String get$id(); + @JsonIgnore public abstract String get$anchor(); + @JsonIgnore public abstract String get$schema(); + @JsonIgnore public abstract Set getTypes(); @@ -49,4 +54,58 @@ public abstract class SchemaMixin { @JsonIgnore public abstract Object getJsonSchemaImpl(); + + @JsonIgnore + public abstract List getPrefixItems(); + + @JsonIgnore + public abstract String getContentEncoding(); + + @JsonIgnore + public abstract String getContentMediaType(); + + @JsonIgnore + public abstract Schema getContentSchema(); + + @JsonIgnore + public abstract Schema getPropertyNames(); + + @JsonIgnore + public abstract Object getUnevaluatedProperties(); + + @JsonIgnore + public abstract Integer getMaxContains(); + + @JsonIgnore + public abstract Integer getMinContains(); + + @JsonIgnore + public abstract Schema getAdditionalItems(); + + @JsonIgnore + public abstract Schema getUnevaluatedItems(); + + @JsonIgnore + public abstract Schema getIf(); + + @JsonIgnore + public abstract Schema getElse(); + + @JsonIgnore + public abstract Schema getThen(); + + @JsonIgnore + public abstract Map getDependentSchemas(); + + @JsonIgnore + public abstract Map> getDependentRequired(); + + @JsonIgnore + public abstract String get$comment(); + + @JsonIgnore + public abstract List getExamples(); + + @JsonIgnore + public abstract Object getConst(); } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SecuritySchemeMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SecuritySchemeMixin.java deleted file mode 100644 index 546bf3e9f6..0000000000 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/SecuritySchemeMixin.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.swagger.v3.core.jackson.mixin; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; - -import java.util.Map; - -public abstract class SecuritySchemeMixin { - - @JsonAnyGetter - public abstract Map getExtensions(); - - @JsonAnySetter - public abstract void addExtension(String name, Object value); - - @JsonIgnore - public abstract String getSummary(); -} diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ApiResponsesDeserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ApiResponsesDeserializer.java index ee7d9012a8..cbf21a1a9e 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ApiResponsesDeserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ApiResponsesDeserializer.java @@ -30,12 +30,12 @@ public ApiResponses deserialize(JsonParser jp, DeserializationContext ctxt) } ApiResponses result = new ApiResponses(); JsonNode node = jp.getCodec().readTree(jp); - ObjectNode objectNode = (ObjectNode)node; + ObjectNode objectNode = (ObjectNode) node; Map extensions = new LinkedHashMap<>(); for (Iterator it = objectNode.fieldNames(); it.hasNext(); ) { String childName = it.next(); JsonNode child = objectNode.get(childName); - // if name start with `x-` consider it an extesion + // if name start with `x-` consider it an extension if (childName.startsWith("x-")) { extensions.put(childName, mapper.convertValue(child, Object.class)); } else { diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/CallbackDeserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/CallbackDeserializer.java index 8011541183..1fc2c3ec92 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/CallbackDeserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/CallbackDeserializer.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import io.swagger.v3.oas.models.PathItem; import io.swagger.v3.oas.models.callbacks.Callback; @@ -20,6 +21,13 @@ public class CallbackDeserializer extends JsonDeserializer { @Override public Callback deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + + final ObjectMapper mapper; + if (openapi31) { + mapper = Json31.mapper(); + } else { + mapper = Json.mapper(); + } Callback result = new Callback(); JsonNode node = jp.getCodec().readTree(jp); ObjectNode objectNode = (ObjectNode)node; @@ -29,15 +37,11 @@ public Callback deserialize(JsonParser jp, DeserializationContext ctxt) JsonNode child = objectNode.get(childName); // if name start with `x-` consider it an extension if (childName.startsWith("x-")) { - extensions.put(childName, Json.mapper().convertValue(child, Object.class)); + extensions.put(childName, mapper.convertValue(child, Object.class)); } else if (childName.equals("$ref")) { result.$ref(child.asText()); - } else if (childName.equals("description") && openapi31) { - result.description(child.asText()); - } else if (childName.equals("summary") && openapi31) { - result.summary(child.asText()); } else { - result.put(childName, Json.mapper().convertValue(child, PathItem.class)); + result.put(childName, mapper.convertValue(child, PathItem.class)); } } if (!extensions.isEmpty()) { diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java index 0b22a03e4b..a1d2937223 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ObjectMapperFactory.java @@ -17,27 +17,22 @@ import io.swagger.v3.core.jackson.Schema31Serializer; import io.swagger.v3.core.jackson.MediaTypeSerializer; import io.swagger.v3.core.jackson.SchemaSerializer; -import io.swagger.v3.core.jackson.mixin.ApiResponseMixin; -import io.swagger.v3.core.jackson.mixin.CallbackMixin; +import io.swagger.v3.core.jackson.mixin.Components31Mixin; import io.swagger.v3.core.jackson.mixin.ComponentsMixin; import io.swagger.v3.core.jackson.mixin.DateSchemaMixin; import io.swagger.v3.core.jackson.mixin.Discriminator31Mixin; import io.swagger.v3.core.jackson.mixin.DiscriminatorMixin; import io.swagger.v3.core.jackson.mixin.ExampleMixin; import io.swagger.v3.core.jackson.mixin.ExtensionsMixin; -import io.swagger.v3.core.jackson.mixin.HeaderMixin; -import io.swagger.v3.core.jackson.mixin.Info31Mixin; +import io.swagger.v3.core.jackson.mixin.InfoMixin; import io.swagger.v3.core.jackson.mixin.LicenseMixin; -import io.swagger.v3.core.jackson.mixin.LinkMixin; import io.swagger.v3.core.jackson.mixin.MediaTypeMixin; +import io.swagger.v3.core.jackson.mixin.OpenAPI31Mixin; import io.swagger.v3.core.jackson.mixin.OpenAPIMixin; import io.swagger.v3.core.jackson.mixin.OperationMixin; -import io.swagger.v3.core.jackson.mixin.ParameterMixin; -import io.swagger.v3.core.jackson.mixin.RequestBodyMixin; import io.swagger.v3.core.jackson.mixin.Schema31Mixin; import io.swagger.v3.core.jackson.mixin.SchemaConverterMixin; import io.swagger.v3.core.jackson.mixin.SchemaMixin; -import io.swagger.v3.core.jackson.mixin.SecuritySchemeMixin; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.ExternalDocumentation; import io.swagger.v3.oas.models.OpenAPI; @@ -71,7 +66,6 @@ import io.swagger.v3.oas.models.servers.ServerVariable; import io.swagger.v3.oas.models.servers.ServerVariables; import io.swagger.v3.oas.models.tags.Tag; -import jdk.nashorn.internal.codegen.CompilerConstants; import java.util.LinkedHashMap; import java.util.Map; @@ -120,6 +114,8 @@ public JsonSerializer modifySerializer( SerializationConfig config, BeanDescription desc, JsonSerializer serializer) { if (Schema.class.isAssignableFrom(desc.getBeanClass())) { return new SchemaSerializer((JsonSerializer) serializer); + } else if (MediaType.class.isAssignableFrom(desc.getBeanClass())) { + return new MediaTypeSerializer((JsonSerializer) serializer); } return serializer; } @@ -178,34 +174,29 @@ public JsonSerializer modifySerializer( sourceMixins.put(ServerVariables.class, ExtensionsMixin.class); sourceMixins.put(Tag.class, ExtensionsMixin.class); sourceMixins.put(XML.class, ExtensionsMixin.class); + sourceMixins.put(ApiResponse.class, ExtensionsMixin.class); + sourceMixins.put(Parameter.class, ExtensionsMixin.class); + sourceMixins.put(RequestBody.class, ExtensionsMixin.class); + sourceMixins.put(Header.class, ExtensionsMixin.class); + sourceMixins.put(SecurityScheme.class, ExtensionsMixin.class); + sourceMixins.put(Callback.class, ExtensionsMixin.class); + if (!openapi31) { sourceMixins.put(Schema.class, SchemaMixin.class); sourceMixins.put(DateSchema.class, DateSchemaMixin.class); sourceMixins.put(Components.class, ComponentsMixin.class); - sourceMixins.put(Info.class, Info31Mixin.class); + sourceMixins.put(Info.class, InfoMixin.class); sourceMixins.put(License.class, LicenseMixin.class); sourceMixins.put(OpenAPI.class, OpenAPIMixin.class); sourceMixins.put(Discriminator.class, DiscriminatorMixin.class); - sourceMixins.put(ApiResponse.class, ApiResponseMixin.class); - sourceMixins.put(Parameter.class, ParameterMixin.class); - sourceMixins.put(RequestBody.class, RequestBodyMixin.class); - sourceMixins.put(Header.class, HeaderMixin.class); - sourceMixins.put(SecurityScheme.class, SecuritySchemeMixin.class); - sourceMixins.put(Link.class, LinkMixin.class); - sourceMixins.put(Callback.class, CallbackMixin.class); } else { sourceMixins.put(Info.class, ExtensionsMixin.class); sourceMixins.put(Schema.class, Schema31Mixin.class); + sourceMixins.put(Components.class, Components31Mixin.class); + sourceMixins.put(OpenAPI.class, OpenAPI31Mixin.class); sourceMixins.put(DateSchema.class, DateSchemaMixin.class); sourceMixins.put(Discriminator.class, Discriminator31Mixin.class); - sourceMixins.put(ApiResponse.class, ExtensionsMixin.class); - sourceMixins.put(Parameter.class, ExtensionsMixin.class); - sourceMixins.put(RequestBody.class, ExtensionsMixin.class); - sourceMixins.put(Header.class, ExtensionsMixin.class); - sourceMixins.put(SecurityScheme.class, ExtensionsMixin.class); - sourceMixins.put(Link.class, ExtensionsMixin.class); - sourceMixins.put(Callback.class, ExtensionsMixin.class); } mapper.setMixIns(sourceMixins); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java index b016d8bf57..14918e8858 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterDeserializer.java @@ -31,14 +31,8 @@ public Parameter deserialize(JsonParser jp, DeserializationContext ctxt) if (sub != null) { result = new Parameter().$ref(sub.asText()); - if (openapi31) { - if (desc != null) { - result.description(desc.asText()); - } - JsonNode summary = node.get("summary"); - if (summary != null) { - result.setSummary(summary.asText()); - } + if (desc != null && openapi31) { + result.description(desc.asText()); } } else if (inNode != null) { diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecuritySchemeDeserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecuritySchemeDeserializer.java index 6e0e078cd6..7921af0fce 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecuritySchemeDeserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/SecuritySchemeDeserializer.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import io.swagger.v3.oas.models.security.OAuthFlows; import io.swagger.v3.oas.models.security.SecurityScheme; @@ -18,6 +19,12 @@ public class SecuritySchemeDeserializer extends JsonDeserializer @Override public SecurityScheme deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + ObjectMapper mapper = null; + if (openapi31) { + mapper = Json31.mapper(); + } else { + mapper = Json.mapper(); + } SecurityScheme result = null; JsonNode node = jp.getCodec().readTree(jp); @@ -50,17 +57,11 @@ public SecurityScheme deserialize(JsonParser jp, DeserializationContext ctxt) } else if ("oauth2".equals(type)) { result .type(SecurityScheme.Type.OAUTH2) - .flows(Json.mapper().convertValue(node.get("flows"), OAuthFlows.class)); + .flows(mapper.convertValue(node.get("flows"), OAuthFlows.class)); } else if ("mutualTLS".equals(type)) { result .type(SecurityScheme.Type.MUTUALTLS); } - - JsonNode summaryNode = node.get("summary"); - if (summaryNode != null && openapi31) { - result.setSummary(summaryNode.asText()); - } - } return result; diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/SwaggerSerializerTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/SwaggerSerializerTest.java index 3909559474..0a73bcfd03 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/SwaggerSerializerTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/SwaggerSerializerTest.java @@ -105,7 +105,7 @@ public void convertSpec() throws IOException { .addLink("myLink", new Link() .description("a link") .operationId("theLinkedOperationId") - .addParameters("userId", "gah") + .addParameter("userId", "gah") ) .content(new Content() .addMediaType("application/json", new MediaType() diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java index cf603e5235..9a0a299f40 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/deserialization/OpenAPI3_1DeserializationTest.java @@ -88,14 +88,12 @@ public void testDeserializationOnOAS31() throws IOException { assertNotNull(openAPI.getComponents().getResponses()); assertNotNull(openAPI.getComponents().getResponses().get("201")); assertEquals(openAPI.getComponents().getResponses().get("201").getDescription(), "api response description"); - assertEquals(openAPI.getComponents().getResponses().get("201").getSummary(), "api response summary"); assertNotNull(openAPI.getComponents().getParameters()); assertNotNull(openAPI.getComponents().getParameters().get("param")); assertEquals(openAPI.getComponents().getParameters().get("param").getIn(), "query"); assertEquals(openAPI.getComponents().getParameters().get("param").getName(), "param0"); assertEquals(openAPI.getComponents().getParameters().get("param").getDescription(), "parameter description"); - assertEquals(openAPI.getComponents().getParameters().get("param").getSummary(), "parameter summary"); assertNotNull(openAPI.getComponents().getExamples()); assertNotNull(openAPI.getComponents().getExamples().get("example")); @@ -109,12 +107,10 @@ public void testDeserializationOnOAS31() throws IOException { assertNotNull(openAPI.getComponents().getHeaders()); assertNotNull(openAPI.getComponents().getHeaders().get("test-head")); assertEquals(openAPI.getComponents().getHeaders().get("test-head").getDescription(), "test header description"); - assertEquals(openAPI.getComponents().getHeaders().get("test-head").getSummary(), "test header summary"); assertNotNull(openAPI.getComponents().getSecuritySchemes()); assertNotNull(openAPI.getComponents().getSecuritySchemes().get("basic")); assertEquals(openAPI.getComponents().getSecuritySchemes().get("basic").getDescription(), "security description"); - assertEquals(openAPI.getComponents().getSecuritySchemes().get("basic").getSummary(), "security summary"); assertEquals(openAPI.getComponents().getSecuritySchemes().get("basic").getType().toString(), "http"); assertNotNull(openAPI.getComponents().getLinks()); @@ -159,14 +155,12 @@ public void testDeserializationOnOAS30() throws IOException { assertNotNull(openAPI.getComponents().getResponses()); assertNotNull(openAPI.getComponents().getResponses().get("201")); assertEquals(openAPI.getComponents().getResponses().get("201").getDescription(), "api response description"); - assertNull(openAPI.getComponents().getResponses().get("201").getSummary()); assertNotNull(openAPI.getComponents().getParameters()); assertNotNull(openAPI.getComponents().getParameters().get("param")); assertEquals(openAPI.getComponents().getParameters().get("param").getIn(), "query"); assertEquals(openAPI.getComponents().getParameters().get("param").getName(), "param0"); assertEquals(openAPI.getComponents().getParameters().get("param").getDescription(), "parameter description"); - assertNull(openAPI.getComponents().getParameters().get("param").getSummary()); assertNotNull(openAPI.getComponents().getExamples()); assertNotNull(openAPI.getComponents().getExamples().get("example")); @@ -180,12 +174,10 @@ public void testDeserializationOnOAS30() throws IOException { assertNotNull(openAPI.getComponents().getHeaders()); assertNotNull(openAPI.getComponents().getHeaders().get("test-head")); assertEquals(openAPI.getComponents().getHeaders().get("test-head").getDescription(), "test header description"); - assertNull(openAPI.getComponents().getHeaders().get("test-head").getSummary()); assertNotNull(openAPI.getComponents().getSecuritySchemes()); assertNotNull(openAPI.getComponents().getSecuritySchemes().get("basic")); assertEquals(openAPI.getComponents().getSecuritySchemes().get("basic").getDescription(), "security description"); - assertNull(openAPI.getComponents().getSecuritySchemes().get("basic").getSummary()); assertEquals(openAPI.getComponents().getSecuritySchemes().get("basic").getType().toString(), "http"); assertNotNull(openAPI.getComponents().getLinks()); @@ -211,7 +203,6 @@ public void testRefDeserializationOnOAS31() throws IOException { assertEquals(openAPI.getPaths().get("/pets").getPost().getParameters().get(0).get$ref(), "#/components/parameters/testParameter"); assertEquals(openAPI.getPaths().get("/pets").getPost().getParameters().get(0).getDescription(), "ref parameter description"); - assertEquals(openAPI.getPaths().get("/pets").getPost().getParameters().get(0).getSummary(), "ref parameter summary"); assertEquals(openAPI.getPaths().get("/pets").getPost().getParameters().get(1).getName(), "randomParam"); assertEquals(openAPI.getPaths().get("/pets").getPost().getParameters().get(1).getIn(), "query"); @@ -220,22 +211,15 @@ public void testRefDeserializationOnOAS31() throws IOException { assertEquals(openAPI.getPaths().get("/pets").getPost().getParameters().get(1).getExamples().get("refExample").getSummary(), "ref example summary"); assertEquals(openAPI.getPaths().get("/pets").getPost().getCallbacks().get("callIt").get$ref(), "#/components/callbacks/TestCallback"); - assertEquals(openAPI.getPaths().get("/pets").getPost().getCallbacks().get("callIt").getDescription(), "ref call back description"); - assertEquals(openAPI.getPaths().get("/pets").getPost().getCallbacks().get("callIt").getSummary(), "ref call back summary"); assertEquals(openAPI.getPaths().get("/pets").getPost().getRequestBody().get$ref(), "#/components/requestBodies/body"); assertEquals(openAPI.getPaths().get("/pets").getPost().getRequestBody().getDescription(), "ref request body description"); - assertEquals(openAPI.getPaths().get("/pets").getPost().getRequestBody().getSummary(), "ref request body summary"); assertEquals(openAPI.getPaths().get("/pets").getPost().getResponses().get("201").get$ref(), "#/components/responses/okResponse"); assertEquals(openAPI.getPaths().get("/pets").getPost().getResponses().get("201").getDescription(), "ref response description"); - assertEquals(openAPI.getPaths().get("/pets").getPost().getResponses().get("201").getSummary(), "ref response summary"); assertEquals(openAPI.getPaths().get("/pets").getPost().getResponses().get("default").getHeaders().get("head").get$ref(), "#/components/headers/head"); assertEquals(openAPI.getPaths().get("/pets").getPost().getResponses().get("default").getHeaders().get("head").getDescription(), "ref header description"); - assertEquals(openAPI.getPaths().get("/pets").getPost().getResponses().get("default").getHeaders().get("head").getSummary(), "ref header summary"); - - } } 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 b5253c6cee..ddd08549a3 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 @@ -1,10 +1,7 @@ package io.swagger.v3.core.serialization; import io.swagger.v3.core.matchers.SerializationMatchers; -import io.swagger.v3.core.util.Json; -import io.swagger.v3.core.util.Json31; import io.swagger.v3.core.util.ResourceUtils; -import io.swagger.v3.core.util.Yaml; import io.swagger.v3.core.util.Yaml31; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; @@ -28,12 +25,8 @@ import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.oas.models.responses.ApiResponses; import io.swagger.v3.oas.models.security.SecurityScheme; -import org.checkerframework.checker.units.qual.C; import org.testng.annotations.Test; -import java.util.HashMap; -import java.util.Map; - import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; @@ -493,19 +486,17 @@ public void testComponentPathItemsSerialization() { schema.addType(schema.getType()); OpenAPI openAPI = new OpenAPI().openapi("3.1.0").components(new Components() .addSchemas("stringTest", schema) - .addPathItems("/pathTest", new PathItem() + .addPathItem("/pathTest", new PathItem() .description("test path item") .get(new Operation() .operationId("testPathItem") .responses(new ApiResponses() .addApiResponse("200", new ApiResponse().description("response description"))))) .addResponses("201", new ApiResponse() - .description("api response description") - .summary("api response summary")) + .description("api response description")) .addParameters("param", new Parameter() .in("query") .description("parameter description") - .summary("parameter summary") .schema(schema)) .addExamples("example", new Example() .summary("example summary") @@ -516,13 +507,11 @@ public void testComponentPathItemsSerialization() { .addMediaType("application/json", new MediaType() .schema(new ObjectSchema())))) .addHeaders("test-head", new Header() - .description("test header description") - .summary("test header summary")) + .description("test header description")) .addSecuritySchemes("basic", new SecurityScheme() .in(SecurityScheme.In.HEADER) .scheme("http") - .description("ref security description") - .summary("ref security summary")) + .description("ref security description")) .addLinks("Link", new Link() .operationRef("#/paths/~12.0~1repositories~1{username}/get")) .addCallbacks("TestCallback", new Callback().addPathItem("{$request.query.queryUrl}", new PathItem() @@ -530,8 +519,6 @@ public void testComponentPathItemsSerialization() { .post(new Operation() .operationId("testPathItem"))))); - Yaml31.prettyPrint(openAPI); - SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + "components:\n" + " schemas:\n" + @@ -540,12 +527,10 @@ public void testComponentPathItemsSerialization() { " responses:\n" + " \"201\":\n" + " description: api response description\n" + - " summary: api response summary\n" + " parameters:\n" + " param:\n" + " in: query\n" + " description: parameter description\n" + - " summary: parameter summary\n" + " schema:\n" + " type: string\n" + " examples:\n" + @@ -561,11 +546,9 @@ public void testComponentPathItemsSerialization() { " headers:\n" + " test-head:\n" + " description: test header description\n" + - " summary: test header summary\n" + " securitySchemes:\n" + " basic:\n" + " description: ref security description\n" + - " summary: ref security summary\n" + " in: header\n" + " scheme: http\n" + " links:\n" + @@ -596,15 +579,13 @@ public void testComponentPathItemsSerialization() { " },\n" + " \"responses\" : {\n" + " \"201\" : {\n" + - " \"description\" : \"api response description\",\n" + - " \"summary\" : \"api response summary\"\n" + + " \"description\" : \"api response description\"\n" + " }\n" + " },\n" + " \"parameters\" : {\n" + " \"param\" : {\n" + " \"in\" : \"query\",\n" + " \"description\" : \"parameter description\",\n" + - " \"summary\" : \"parameter summary\",\n" + " \"schema\" : {\n" + " \"type\" : \"string\"\n" + " }\n" + @@ -628,14 +609,12 @@ public void testComponentPathItemsSerialization() { " },\n" + " \"headers\" : {\n" + " \"test-head\" : {\n" + - " \"description\" : \"test header description\",\n" + - " \"summary\" : \"test header summary\"\n" + + " \"description\" : \"test header description\"\n" + " }\n" + " },\n" + " \"securitySchemes\" : {\n" + " \"basic\" : {\n" + " \"description\" : \"ref security description\",\n" + - " \"summary\" : \"ref security summary\",\n" + " \"in\" : \"header\",\n" + " \"scheme\" : \"http\"\n" + " }\n" + @@ -890,7 +869,7 @@ public void testPathItemsRefSerialization() { .summary("ref path item") ) .components(new Components() - .addPathItems("pathTest", new PathItem() + .addPathItem("pathTest", new PathItem() .description("test path item") .get(new Operation() .operationId("testPathItem") @@ -951,7 +930,6 @@ public void testResponseRefSerialization() { .responses(new ApiResponses() .addApiResponse("200" , new ApiResponse() .description("point to a $ref response") - .summary("point to a $ref response") .$ref("#/components/responses/okResponse"))))) .components(new Components() .addResponses("okResponse", new ApiResponse().description("everything is good"))); @@ -964,7 +942,6 @@ public void testResponseRefSerialization() { " responses:\n" + " \"200\":\n" + " description: point to a $ref response\n" + - " summary: point to a $ref response\n" + " $ref: '#/components/responses/okResponse'\n" + "components:\n" + " responses:\n" + @@ -981,7 +958,6 @@ public void testResponseRefSerialization() { " \"responses\" : {\n" + " \"200\" : {\n" + " \"description\" : \"point to a $ref response\",\n" + - " \"summary\" : \"point to a $ref response\",\n" + " \"$ref\" : \"#/components/responses/okResponse\"\n" + " }\n" + " }\n" + @@ -1011,8 +987,7 @@ public void testParameterRefSerialization() { .operationId("testPathItem") .addParametersItem(new Parameter() .$ref("#/components/parameters/testParameter") - .description("test parameter") - .summary("test param")))); + .description("test parameter")))); SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + "paths:\n" + @@ -1022,7 +997,6 @@ public void testParameterRefSerialization() { " operationId: testPathItem\n" + " parameters:\n" + " - description: test parameter\n" + - " summary: test param\n" + " $ref: '#/components/parameters/testParameter'\n" + "components:\n" + " parameters:\n" + @@ -1038,7 +1012,6 @@ public void testParameterRefSerialization() { " \"operationId\" : \"testPathItem\",\n" + " \"parameters\" : [ {\n" + " \"description\" : \"test parameter\",\n" + - " \"summary\" : \"test param\",\n" + " \"$ref\" : \"#/components/parameters/testParameter\"\n" + " } ]\n" + " }\n" + @@ -1113,8 +1086,7 @@ public void testRequestBodyRefSerialization() { .operationId("testPathItem") .requestBody(new RequestBody() .$ref("#/components/requestBodies/body") - .description("ref request body") - .summary("ref req body")))) + .description("ref request body")))) .components(new Components() .addRequestBodies("body", new RequestBody() .content(new Content() @@ -1129,7 +1101,6 @@ public void testRequestBodyRefSerialization() { " operationId: testPathItem\n" + " requestBody:\n" + " description: ref request body\n" + - " summary: ref req body\n" + " $ref: '#/components/requestBodies/body'\n" + "components:\n" + " requestBodies:\n" + @@ -1146,7 +1117,6 @@ public void testRequestBodyRefSerialization() { " \"operationId\" : \"testPathItem\",\n" + " \"requestBody\" : {\n" + " \"description\" : \"ref request body\",\n" + - " \"summary\" : \"ref req body\",\n" + " \"$ref\" : \"#/components/requestBodies/body\"\n" + " }\n" + " }\n" + @@ -1179,13 +1149,11 @@ public void testHeaderRefSerialization() { .description("default response") .addHeaderObject("header", new Header() .$ref("#/components/responses/okResponse") - .description("ref header description") - .summary("ref header summary")))) + .description("ref header description")))) )) .components(new Components() .addHeaders("test-head", new Header() - .description("test header description") - .summary("test header summary"))); + .description("test header description"))); SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + "paths:\n" + @@ -1199,13 +1167,11 @@ public void testHeaderRefSerialization() { " headers:\n" + " header:\n" + " description: ref header description\n" + - " summary: ref header summary\n" + " $ref: '#/components/responses/okResponse'\n" + "components:\n" + " headers:\n" + " test-head:\n" + - " description: test header description\n" + - " summary: test header summary"); + " description: test header description"); SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + " \"openapi\" : \"3.1.0\",\n" + " \"paths\" : {\n" + @@ -1219,7 +1185,6 @@ public void testHeaderRefSerialization() { " \"headers\" : {\n" + " \"header\" : {\n" + " \"description\" : \"ref header description\",\n" + - " \"summary\" : \"ref header summary\",\n" + " \"$ref\" : \"#/components/responses/okResponse\"\n" + " }\n" + " }\n" + @@ -1231,8 +1196,7 @@ public void testHeaderRefSerialization() { " \"components\" : {\n" + " \"headers\" : {\n" + " \"test-head\" : {\n" + - " \"description\" : \"test header description\",\n" + - " \"summary\" : \"test header summary\"\n" + + " \"description\" : \"test header description\"\n" + " }\n" + " }\n" + " }\n" + @@ -1245,15 +1209,13 @@ public void testSecuritySchemeRefSerialization() { .openapi("3.1.0") .components(new Components().addSecuritySchemes("basic", new SecurityScheme() .$ref("https://external.site.com/#components/securitySchemes/basic") - .description("ref security description") - .summary("ref security summary"))); + .description("ref security description"))); SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.1.0\n" + "components:\n" + " securitySchemes:\n" + " basic:\n" + " description: ref security description\n" + - " summary: ref security summary\n" + " $ref: https://external.site.com/#components/securitySchemes/basic"); SerializationMatchers.assertEqualsToJson31(openAPI, "{\n" + " \"openapi\" : \"3.1.0\",\n" + @@ -1261,7 +1223,6 @@ public void testSecuritySchemeRefSerialization() { " \"securitySchemes\" : {\n" + " \"basic\" : {\n" + " \"description\" : \"ref security description\",\n" + - " \"summary\" : \"ref security summary\",\n" + " \"$ref\" : \"https://external.site.com/#components/securitySchemes/basic\"\n" + " }\n" + " }\n" + @@ -1282,8 +1243,7 @@ public void testLinkRefSerialization() { .description("default response") .addLink("link", new Link() .$ref("#/components/links/Link") - .description("ref link description") - .summary("ref link summary")))))) + .description("ref link description")))))) .components(new Components().addLinks("Link", new Link() .operationRef("#/paths/~12.0~1repositories~1{username}/get"))); @@ -1299,7 +1259,6 @@ public void testLinkRefSerialization() { " links:\n" + " link:\n" + " description: ref link description\n" + - " summary: ref link summary\n" + " $ref: '#/components/links/Link'\n" + "components:\n" + " links:\n" + @@ -1318,7 +1277,6 @@ public void testLinkRefSerialization() { " \"links\" : {\n" + " \"link\" : {\n" + " \"description\" : \"ref link description\",\n" + - " \"summary\" : \"ref link summary\",\n" + " \"$ref\" : \"#/components/links/Link\"\n" + " }\n" + " }\n" + @@ -1345,10 +1303,8 @@ public void testCallRefSerialization() { .description("test path item") .post(new Operation() .operationId("testPathItem") - .addCallbacks("callbackSample", new Callback() - .$ref("#/components/callbacks/TestCallback") - .description("ref callback description") - .summary("ref callback summary")))) + .addCallback("callbackSample", new Callback() + .$ref("#/components/callbacks/TestCallback")))) .components(new Components().addCallbacks("TestCallback", new Callback().addPathItem("{$request.query.queryUrl}", new PathItem() .description("test path item") .post(new Operation() @@ -1363,8 +1319,6 @@ public void testCallRefSerialization() { " callbacks:\n" + " callbackSample:\n" + " $ref: '#/components/callbacks/TestCallback'\n" + - " description: ref callback description\n" + - " summary: ref callback summary\n" + "components:\n" + " callbacks:\n" + " TestCallback:\n" + @@ -1382,9 +1336,7 @@ public void testCallRefSerialization() { " \"operationId\" : \"testPathItem\",\n" + " \"callbacks\" : {\n" + " \"callbackSample\" : {\n" + - " \"$ref\" : \"#/components/callbacks/TestCallback\",\n" + - " \"description\" : \"ref callback description\",\n" + - " \"summary\" : \"ref callback summary\"\n" + + " \"$ref\" : \"#/components/callbacks/TestCallback\"\n" + " }\n" + " }\n" + " }\n" + diff --git a/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_refs_siblings.yaml b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_refs_siblings.yaml index d1999c93ac..7d860352e3 100644 --- a/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_refs_siblings.yaml +++ b/modules/swagger-core/src/test/resources/specFiles/3.1.0/petstore-3.1_refs_siblings.yaml @@ -35,8 +35,6 @@ paths: callbacks: callIt: $ref: '#/components/callbacks/TestCallback' - description: "ref call back description" - summary: "ref call back summary" requestBody: $ref: '#/components/requestBodies/body' description: "ref request body description" diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java index 8dc9671422..ccfd156397 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java @@ -326,7 +326,7 @@ public Components pathItems(Map pathItems) { } @OpenAPI31 - public Components addPathItems(String key, PathItem pathItem) { + public Components addPathItem(String key, PathItem pathItem) { if (this.pathItems == null) { this.pathItems = new LinkedHashMap<>(); } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java index 77c22420af..b6f0954959 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java @@ -401,7 +401,7 @@ public String toString() { sb.append(" paths: ").append(toIndentedString(paths)).append("\n"); sb.append(" components: ").append(toIndentedString(components)).append("\n"); if (specVersion == SpecVersion.V31) sb.append(" webhooks: ").append(toIndentedString(webhooks)).append("\n"); - sb.append(" jsonSchemaDialect: ").append(toIndentedString(jsonSchemaDialect)).append("\n"); + if (specVersion == SpecVersion.V31) sb.append(" jsonSchemaDialect: ").append(toIndentedString(jsonSchemaDialect)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java index 1972ff67ee..e7e641e1a0 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java @@ -238,7 +238,7 @@ public Operation callbacks(Map callbacks) { return this; } - public Operation addCallbacks(String key, Callback callback) { + public Operation addCallback(String key, Callback callback) { if (this.callbacks == null) { this.callbacks = new LinkedHashMap<>(); } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java index 4016b2e3d2..cda3eb83e6 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java @@ -36,12 +36,6 @@ public Callback() { private String $ref = null; - @OpenAPI31 - private String description; - - @OpenAPI31 - private String summary; - /** * @since 2.0.3 */ @@ -59,38 +53,6 @@ public Callback() { this.$ref = $ref; } - @OpenAPI31 - public String getDescription() { - return description; - } - - @OpenAPI31 - public void setDescription(String description) { - this.description = description; - } - - @OpenAPI31 - public Callback description(String description) { - this.description = description; - return this; - } - - @OpenAPI31 - public String getSummary() { - return summary; - } - - @OpenAPI31 - public void setSummary(String summary) { - this.summary = summary; - } - - @OpenAPI31 - public Callback summary(String summary) { - this.summary = summary; - return this; - } - /** * @since 2.0.3 */ @@ -116,19 +78,13 @@ public boolean equals(java.lang.Object o) { if ($ref != null ? !$ref.equals(callback.$ref) : callback.$ref != null) { return false; } - if (description != null ? !description.equals(callback.description) : callback.description != null) { - return false; - } - if (summary != null ? !summary.equals(callback.summary) : callback.summary != null) { - return false; - } return Objects.equals(this.extensions, callback.extensions) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(extensions, $ref, description, summary, super.hashCode()); + return Objects.hash(extensions, $ref, super.hashCode()); } public java.util.Map getExtensions() { @@ -166,10 +122,7 @@ public Callback extensions(java.util.Map extensions) { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Callback {\n"); - sb.append(" $ref: ").append(toIndentedString($ref)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append("}"); return sb.toString(); diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java index 12f1132ab3..6d380f7f31 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java @@ -16,11 +16,9 @@ package io.swagger.v3.oas.models.headers; -import io.swagger.v3.oas.annotations.OpenAPI31; import io.swagger.v3.oas.models.examples.Example; import io.swagger.v3.oas.models.media.Content; import io.swagger.v3.oas.models.media.Schema; -import io.swagger.v3.oas.models.parameters.RequestBody; import java.util.LinkedHashMap; import java.util.Map; @@ -34,10 +32,6 @@ public class Header { private String description = null; - - @OpenAPI31 - private String summary = null; - private String $ref = null; private Boolean required = null; private Boolean deprecated = null; @@ -87,22 +81,6 @@ public Header description(String description) { return this; } - @OpenAPI31 - public String getSummary() { - return summary; - } - - @OpenAPI31 - public void setSummary(String summary) { - this.summary = summary; - } - - @OpenAPI31 - public Header summary(String summary) { - this.summary = summary; - return this; - } - /** * returns the required property from a Header instance. * @@ -282,13 +260,12 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.example, header.example) && Objects.equals(this.content, header.content) && Objects.equals(this.extensions, header.extensions) && - Objects.equals(this.$ref, header.$ref) && - Objects.equals(this.summary, header.summary); + Objects.equals(this.$ref, header.$ref); } @Override public int hashCode() { - return Objects.hash(description, required, deprecated, style, explode, schema, examples, example, content, extensions, $ref, summary); + return Objects.hash(description, required, deprecated, style, explode, schema, examples, example, content, extensions, $ref); } public java.util.Map getExtensions() { @@ -335,7 +312,6 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Header {\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); sb.append(" required: ").append(toIndentedString(required)).append("\n"); sb.append(" deprecated: ").append(toIndentedString(deprecated)).append("\n"); sb.append(" style: ").append(toIndentedString(style)).append("\n"); diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java index a6ff7185c8..aa2f75430c 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java @@ -36,10 +36,6 @@ public class Link { private Object requestBody = null; private Map headers = null; private String description = null; - - @OpenAPI31 - private String summary = null; - private String $ref = null; private java.util.Map extensions = null; private Server server; @@ -128,12 +124,12 @@ public void setParameters(Map parameters) { this.parameters = parameters; } - public Link parameters(Map parameters) { - this.parameters = parameters; - return this; + @Deprecated + public Link parameters(String name, String parameter) { + return this.addParameter(name, parameter); } - public Link addParameters(String name, String parameter) { + public Link addParameter(String name, String parameter) { if (this.parameters == null) { this.parameters = new LinkedHashMap<>(); } @@ -187,19 +183,6 @@ public Link description(String description) { return this; } - public String getSummary() { - return summary; - } - - public void setSummary(String summary) { - this.summary = summary; - } - - public Link summary(String summary) { - this.summary = summary; - return this; - } - @Override public boolean equals(Object o) { if (this == o) { @@ -235,9 +218,6 @@ public boolean equals(Object o) { if (extensions != null ? !extensions.equals(link.extensions) : link.extensions != null) { return false; } - if (summary != null ? !summary.equals(link.summary) : link.summary != null) { - return false; - } return server != null ? server.equals(link.server) : link.server == null; } @@ -253,7 +233,6 @@ public int hashCode() { result = 31 * result + ($ref != null ? $ref.hashCode() : 0); result = 31 * result + (extensions != null ? extensions.hashCode() : 0); result = 31 * result + (server != null ? server.hashCode() : 0); - result = 31 * result + (summary != null ? summary.hashCode() : 0); return result; } @@ -315,7 +294,6 @@ public String toString() { sb.append(" requestBody: ").append(toIndentedString(requestBody)).append("\n"); sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); sb.append(" $ref: ").append(toIndentedString($ref)).append("\n"); sb.append("}"); return sb.toString(); 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 401674c525..361b65daf5 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 @@ -37,14 +37,12 @@ * Schema * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#schemaObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#schemaObject" */ public class Schema { - @OpenAPI30 - protected T _default; - @OpenAPI31 - protected Schema defaultSchema; + protected T _default; private String name; private String title = null; @@ -562,7 +560,7 @@ public Schema title(String title) { } /** - * returns the _default property from a StringSchema instance. + * returns the _default property from a Schema instance. * * @return String _default **/ @@ -1200,22 +1198,6 @@ public void setExampleSetFlag(boolean exampleSetFlag) { this.exampleSetFlag = exampleSetFlag; } - @OpenAPI31 - public Schema getDefaultSchema() { - return defaultSchema; - } - - @OpenAPI31 - public void setDefaultSchema(Schema defaultSchema) { - this.defaultSchema = defaultSchema; - } - - @OpenAPI31 - public Schema defaultSchema(Schema defaultSchema) { - this.defaultSchema = defaultSchema; - return this; - } - @OpenAPI31 public List getPrefixItems() { return prefixItems; @@ -1550,7 +1532,6 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.oneOf, schema.oneOf) && Objects.equals(this._const, schema._const) && Objects.equals(this._default, schema._default) && - Objects.equals(this.defaultSchema, schema.defaultSchema) && Objects.equals(this.contentEncoding, schema.contentEncoding) && Objects.equals(this.contentMediaType, schema.contentMediaType) && Objects.equals(this.contentSchema, schema.contentSchema) && @@ -1581,7 +1562,7 @@ public int hashCode() { discriminator, _enum, _default, patternProperties, $id, $anchor, $schema, types, allOf, anyOf, oneOf, _const, contentEncoding, contentMediaType, contentSchema, propertyNames, unevaluatedProperties, maxContains, minContains, additionalItems, unevaluatedItems, _if, _else, then, dependentRequired, dependentSchemas, - $comment, examples, defaultSchema, prefixItems); + $comment, examples, prefixItems); } public java.util.Map getExtensions() { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java index 746181aa3d..b6d56a3566 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java @@ -20,7 +20,6 @@ import io.swagger.v3.oas.models.examples.Example; import io.swagger.v3.oas.models.media.Content; import io.swagger.v3.oas.models.media.Schema; -import io.swagger.v3.oas.models.responses.ApiResponse; import java.util.LinkedHashMap; import java.util.Map; @@ -36,10 +35,6 @@ public class Parameter { private String name = null; private String in = null; private String description = null; - - @OpenAPI31 - private String summary = null; - private Boolean required = null; private Boolean deprecated = null; private Boolean allowEmptyValue = null; @@ -138,22 +133,6 @@ public Parameter description(String description) { return this; } - @OpenAPI31 - public String getSummary() { - return summary; - } - - @OpenAPI31 - public void setSummary(String summary) { - this.summary = summary; - } - - @OpenAPI31 - public Parameter summary(String summary) { - this.summary = summary; - return this; - } - /** * returns the required property from a Parameter instance. * @@ -391,13 +370,12 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.example, parameter.example) && Objects.equals(this.content, parameter.content) && Objects.equals(this.$ref, parameter.$ref) && - Objects.equals(this.extensions, parameter.extensions) && - Objects.equals(this.summary, parameter.summary); + Objects.equals(this.extensions, parameter.extensions); } @Override public int hashCode() { - return Objects.hash(name, in, description, required, deprecated, allowEmptyValue, style, explode, allowReserved, schema, examples, example, content, $ref, extensions, summary); + return Objects.hash(name, in, description, required, deprecated, allowEmptyValue, style, explode, allowReserved, schema, examples, example, content, $ref, extensions); } public java.util.Map getExtensions() { @@ -439,7 +417,6 @@ public String toString() { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" in: ").append(toIndentedString(in)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); sb.append(" required: ").append(toIndentedString(required)).append("\n"); sb.append(" deprecated: ").append(toIndentedString(deprecated)).append("\n"); sb.append(" allowEmptyValue: ").append(toIndentedString(allowEmptyValue)).append("\n"); diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java index aed54934e1..947eaabf9a 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java @@ -27,10 +27,6 @@ public class RequestBody { private String description = null; - - @OpenAPI31 - private String summary = null; - private Content content = null; private Boolean required = null; private java.util.Map extensions = null; @@ -55,22 +51,6 @@ public RequestBody description(String description) { return this; } - @OpenAPI31 - public String getSummary() { - return summary; - } - - @OpenAPI31 - public void setSummary(String summary) { - this.summary = summary; - } - - @OpenAPI31 - public RequestBody summary(String summary) { - this.summary = summary; - return this; - } - /** * returns the content property from a RequestBody instance. * @@ -179,9 +159,6 @@ public boolean equals(Object o) { if (extensions != null ? !extensions.equals(that.extensions) : that.extensions != null) { return false; } - if (summary != null ? !summary.equals(that.summary) : that.summary != null) { - return false; - } return $ref != null ? $ref.equals(that.$ref) : that.$ref == null; } @@ -193,7 +170,6 @@ public int hashCode() { result = 31 * result + (required != null ? required.hashCode() : 0); result = 31 * result + (extensions != null ? extensions.hashCode() : 0); result = 31 * result + ($ref != null ? $ref.hashCode() : 0); - result = 31 * result + (summary != null ? summary.hashCode() : 0); return result; } @@ -203,7 +179,6 @@ public String toString() { sb.append("class RequestBody {\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); sb.append(" content: ").append(toIndentedString(content)).append("\n"); sb.append(" required: ").append(toIndentedString(required)).append("\n"); sb.append("}"); diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java index 825de6423f..cc6087a0a3 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java @@ -33,10 +33,6 @@ public class ApiResponse { private String description = null; - - @OpenAPI31 - private String summary = null; - private Map headers = null; private Content content = null; private java.util.Map links = null; @@ -62,22 +58,6 @@ public ApiResponse description(String description) { return this; } - @OpenAPI31 - public String getSummary() { - return summary; - } - - @OpenAPI31 - public void setSummary(String summary) { - this.summary = summary; - } - - @OpenAPI31 - public ApiResponse summary(String summary) { - this.summary = summary; - return this; - } - /** * returns the headers property from a ApiResponse instance. * @@ -151,6 +131,10 @@ public ApiResponse addLink(String name, Link link) { return this; } + public ApiResponse link(String name, Link link) { + return this.addLink(name, link); + } + /** * returns the $ref property from an ApiResponse instance. * @@ -186,13 +170,12 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.content, apiResponse.content) && Objects.equals(this.links, apiResponse.links) && Objects.equals(this.extensions, apiResponse.extensions) && - Objects.equals(this.$ref, apiResponse.$ref) && - Objects.equals(this.summary, apiResponse.summary); + Objects.equals(this.$ref, apiResponse.$ref); } @Override public int hashCode() { - return Objects.hash(description, headers, content, links, extensions, $ref, summary); + return Objects.hash(description, headers, content, links, extensions, $ref); } public java.util.Map getExtensions() { @@ -232,7 +215,6 @@ public String toString() { sb.append("class ApiResponse {\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); sb.append(" content: ").append(toIndentedString(content)).append("\n"); sb.append(" links: ").append(toIndentedString(links)).append("\n"); diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java index 066f296f62..55c2aae5c7 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java @@ -18,9 +18,6 @@ import io.swagger.v3.oas.annotations.OpenAPI31; -import java.util.HashSet; -import java.util.Set; - /** * SecurityScheme * @@ -52,10 +49,6 @@ public String toString() { private Type type = null; private String description = null; - - @OpenAPI31 - private String summary = null; - private String name = null; private String $ref = null; @@ -126,22 +119,6 @@ public SecurityScheme description(String description) { return this; } - @OpenAPI31 - public String getSummary() { - return summary; - } - - @OpenAPI31 - public void setSummary(String summary) { - this.summary = summary; - } - - @OpenAPI31 - public SecurityScheme summary(String summary) { - this.summary = summary; - return this; - } - /** * returns the name property from a SecurityScheme instance. * @@ -346,9 +323,6 @@ public boolean equals(Object o) { if (openIdConnectUrl != null ? !openIdConnectUrl.equals(that.openIdConnectUrl) : that.openIdConnectUrl != null) { return false; } - if (summary != null ? !summary.equals(that.summary) : that.summary != null) { - return false; - } return extensions != null ? extensions.equals(that.extensions) : that.extensions == null; } @@ -364,7 +338,6 @@ public int hashCode() { result = 31 * result + (flows != null ? flows.hashCode() : 0); result = 31 * result + (openIdConnectUrl != null ? openIdConnectUrl.hashCode() : 0); result = 31 * result + (extensions != null ? extensions.hashCode() : 0); - result = 31 * result + (summary != null ? summary.hashCode() : 0); return result; } @@ -375,7 +348,6 @@ public String toString() { sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" in: ").append(toIndentedString(in)).append("\n"); sb.append(" scheme: ").append(toIndentedString(scheme)).append("\n"); From a60b584bad1ec35ad9d553d7caf0497bc3998ad3 Mon Sep 17 00:00:00 2001 From: frantuma Date: Mon, 21 Feb 2022 10:01:24 +0100 Subject: [PATCH 62/79] bump version to 2.2.0-SNAPSHOT --- README.md | 2 +- modules/swagger-annotations/pom.xml | 2 +- modules/swagger-core/pom.xml | 2 +- modules/swagger-eclipse-transformer-maven-plugin/pom.xml | 2 +- modules/swagger-gradle-plugin/gradle.properties | 2 +- .../main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java | 2 +- .../java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java | 2 +- modules/swagger-integration/pom.xml | 2 +- modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml | 2 +- modules/swagger-jaxrs2-servlet-initializer/pom.xml | 2 +- modules/swagger-jaxrs2/pom.xml | 2 +- modules/swagger-maven-plugin/pom.xml | 2 +- modules/swagger-models/pom.xml | 2 +- .../modules/swagger-annotations-jakarta/pom.xml | 2 +- .../modules/swagger-core-jakarta/pom.xml | 2 +- .../modules/swagger-integration-jakarta/pom.xml | 2 +- .../modules/swagger-jaxrs2-jakarta/pom.xml | 2 +- .../modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml | 2 +- .../swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml | 2 +- .../modules/swagger-maven-plugin-jakarta/pom.xml | 2 +- .../modules/swagger-models-jakarta/pom.xml | 2 +- modules/swagger-project-jakarta/pom.xml | 2 +- pom.xml | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 5e2c27e118..bd0eae4810 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ You need the following installed and available in your $PATH: * Jackson 2.4.5 or greater -### To build from source (currently 2.1.14-SNAPSHOT) +### To build from source (currently 2.2.0-SNAPSHOT) ``` # first time building locally mvn -N diff --git a/modules/swagger-annotations/pom.xml b/modules/swagger-annotations/pom.xml index b7a51bdf7a..e145110fe9 100644 --- a/modules/swagger-annotations/pom.xml +++ b/modules/swagger-annotations/pom.xml @@ -3,7 +3,7 @@ io.swagger.core.v3 swagger-project - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-core/pom.xml b/modules/swagger-core/pom.xml index f7de61f09f..1b67144d0a 100644 --- a/modules/swagger-core/pom.xml +++ b/modules/swagger-core/pom.xml @@ -3,7 +3,7 @@ io.swagger.core.v3 swagger-project - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml index b4097e22ca..117c1fad9e 100644 --- a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml +++ b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-gradle-plugin/gradle.properties b/modules/swagger-gradle-plugin/gradle.properties index d31f621c50..479185eef5 100644 --- a/modules/swagger-gradle-plugin/gradle.properties +++ b/modules/swagger-gradle-plugin/gradle.properties @@ -1,2 +1,2 @@ -version=2.1.14-SNAPSHOT +version=2.2.0-SNAPSHOT jettyVersion=9.4.43.v20210629 diff --git a/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java b/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java index bc4d96f75b..6c6adc7707 100644 --- a/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java +++ b/modules/swagger-gradle-plugin/src/main/java/io/swagger/v3/plugins/gradle/SwaggerPlugin.java @@ -16,7 +16,7 @@ public void apply(Project project) { config.defaultDependencies(new Action() { public void execute(DependencySet dependencies) { dependencies.add(project.getDependencies().create("org.apache.commons:commons-lang3:3.7")); - dependencies.add(project.getDependencies().create("io.swagger.core.v3:swagger-jaxrs2:2.1.14-SNAPSHOT")); + dependencies.add(project.getDependencies().create("io.swagger.core.v3:swagger-jaxrs2:2.2.0-SNAPSHOT")); dependencies.add(project.getDependencies().create("javax.ws.rs:javax.ws.rs-api:2.1")); dependencies.add(project.getDependencies().create("javax.servlet:javax.servlet-api:3.1.0")); } diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java index 387b887aaf..8f7638253b 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/SwaggerResolveTest.java @@ -81,7 +81,7 @@ public void testSwaggerResolveTask() throws IOException { " mavenCentral()\n" + "}\n" + "dependencies { \n" + - " compile group: 'io.swagger.core.v3', name: 'swagger-jaxrs2', version:'2.1.14-SNAPSHOT'\n" + + " compile group: 'io.swagger.core.v3', name: 'swagger-jaxrs2', version:'2.2.0-SNAPSHOT'\n" + " compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version:'2.1'\n" + " compile group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'\n" + " testCompile group: 'com.github.tomakehurst', name: 'wiremock', version:'2.27.2'\n" + diff --git a/modules/swagger-integration/pom.xml b/modules/swagger-integration/pom.xml index 39796cb272..d9c49a2622 100644 --- a/modules/swagger-integration/pom.xml +++ b/modules/swagger-integration/pom.xml @@ -6,7 +6,7 @@ io.swagger.core.v3 swagger-project - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../.. swagger-integration diff --git a/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml b/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml index 365b1dbfbd..c7b862df26 100644 --- a/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml +++ b/modules/swagger-jaxrs2-servlet-initializer-v2/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../../ 4.0.0 diff --git a/modules/swagger-jaxrs2-servlet-initializer/pom.xml b/modules/swagger-jaxrs2-servlet-initializer/pom.xml index b400fd90fd..dd8acf4698 100644 --- a/modules/swagger-jaxrs2-servlet-initializer/pom.xml +++ b/modules/swagger-jaxrs2-servlet-initializer/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../../ 4.0.0 diff --git a/modules/swagger-jaxrs2/pom.xml b/modules/swagger-jaxrs2/pom.xml index 1baaf29c4f..11f8a11dd5 100644 --- a/modules/swagger-jaxrs2/pom.xml +++ b/modules/swagger-jaxrs2/pom.xml @@ -5,7 +5,7 @@ swagger-project io.swagger.core.v3 - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../../ 4.0.0 diff --git a/modules/swagger-maven-plugin/pom.xml b/modules/swagger-maven-plugin/pom.xml index 50d097d346..b676a08791 100644 --- a/modules/swagger-maven-plugin/pom.xml +++ b/modules/swagger-maven-plugin/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-models/pom.xml b/modules/swagger-models/pom.xml index 3fcf82074d..531d371a7a 100644 --- a/modules/swagger-models/pom.xml +++ b/modules/swagger-models/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml index 19da802b42..5cd77e475d 100644 --- a/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-annotations-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml index 6dd67914cd..6631112496 100644 --- a/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-core-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml index e25228c533..8acb8c809b 100644 --- a/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-integration-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml index d537aa8a3d..5e3fd214a1 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml index 442c93cddc..d05e5ffe66 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml index f79667d5a4..e40be7b1c0 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-servlet-initializer-v2-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml index 71c3b55b45..e910623799 100644 --- a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml index f26174a411..85ad10f7fd 100644 --- a/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-models-jakarta/pom.xml @@ -4,7 +4,7 @@ io.swagger.core.v3 swagger-project-jakarta - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-project-jakarta/pom.xml b/modules/swagger-project-jakarta/pom.xml index 7d361e6fb9..256a68b5db 100644 --- a/modules/swagger-project-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/pom.xml @@ -6,7 +6,7 @@ pom swagger-project-jakarta swagger-project-jakarta - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT https://github.com/swagger-api/swagger-core scm:git:git@github.com:swagger-api/swagger-core.git diff --git a/pom.xml b/pom.xml index 1ab5b0ad4c..08b62e4a76 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ pom swagger-project swagger-project - 2.1.14-SNAPSHOT + 2.2.0-SNAPSHOT https://github.com/swagger-api/swagger-core scm:git:git@github.com:swagger-api/swagger-core.git From bdf8a76ea917e7147d9e2f9622e3fbca8b45dedb Mon Sep 17 00:00:00 2001 From: frantuma Date: Tue, 22 Feb 2022 16:43:05 +0100 Subject: [PATCH 63/79] refs #3633, #2891, #3433, #3547 - properties and additionalProperties in annotations --- .../v3/oas/annotations/media/Content.java | 16 + .../v3/oas/annotations/media/Schema.java | 20 +- .../v3/core/util/AnnotationsUtils.java | 60 +++- .../java/io/swagger/v3/jaxrs2/ReaderTest.java | 151 ++++++++ .../resources/SchemaPropertiesResource.java | 167 +++++++++ .../io/swagger/v3/oas/models/Components.java | 4 +- .../io/swagger/v3/oas/models/OpenAPI.java | 4 +- .../io/swagger/v3/oas/models/info/Info.java | 4 +- .../swagger/v3/oas/models/info/License.java | 4 +- .../v3/oas/models/media/Discriminator.java | 4 +- .../swagger/v3/oas/models/media/Schema.java | 336 +++++++++++++++++- 11 files changed, 751 insertions(+), 19 deletions(-) create mode 100644 modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/SchemaPropertiesResource.java diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Content.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Content.java index c4468e26b1..583f53149b 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Content.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Content.java @@ -62,6 +62,22 @@ **/ Schema schema() default @Schema(); + /** + * The schema properties defined for schema provided in @Schema + * + * @since 2.2.0 + * @return the schema properties + */ + SchemaProperty[] schemaProperties() default {}; + + /** + * The schema properties defined for schema provided in @Schema + * + * @since 2.2.0 + * @return the schema properties + */ + Schema additionalPropertiesSchema() default @Schema(); + /** * The schema of the array that defines the type used for the content. * diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Schema.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Schema.java index 244d3fe92c..3e6c989020 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Schema.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Schema.java @@ -23,7 +23,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import java.nio.file.AccessMode; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.TYPE; @@ -329,10 +328,29 @@ */ Extension[] extensions() default {}; + /** + * Allows to specify the additionalProperties value + * + * AdditionalPropertiesValue.TRUE: set to TRUE + * AdditionalPropertiesValue.FALSE: set to FALSE + * AdditionalPropertiesValue.USE_ADDITIONAL_PROPERTIES_ANNOTATION: resolve from @Content.additionalPropertiesSchema + * + * @since 2.2.0 + * @return the accessMode for this schema (property) + * + */ + AdditionalPropertiesValue additionalProperties() default AdditionalPropertiesValue.USE_ADDITIONAL_PROPERTIES_ANNOTATION; + enum AccessMode { AUTO, READ_ONLY, WRITE_ONLY, READ_WRITE; } + + enum AdditionalPropertiesValue { + TRUE, + FALSE, + USE_ADDITIONAL_PROPERTIES_ANNOTATION; + } } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java index 10ecfe84a1..677ba11dfe 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java @@ -13,6 +13,7 @@ import io.swagger.v3.oas.annotations.links.LinkParameter; import io.swagger.v3.oas.annotations.media.DiscriminatorMapping; import io.swagger.v3.oas.annotations.media.ExampleObject; +import io.swagger.v3.oas.annotations.media.SchemaProperty; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.ExternalDocumentation; import io.swagger.v3.oas.models.examples.Example; @@ -97,6 +98,7 @@ public static boolean hasSchemaAnnotation(io.swagger.v3.oas.annotations.media.Sc && schema.extensions().length == 0 && !schema.hidden() && !schema.enumAsRef() + && schema.additionalProperties().equals(io.swagger.v3.oas.annotations.media.Schema.AdditionalPropertiesValue.USE_ADDITIONAL_PROPERTIES_ANNOTATION) ) { return false; } @@ -284,6 +286,10 @@ else if (thisSchema == null || thatSchema == null) { if (!Arrays.equals(thisSchema.extensions(), thatSchema.extensions())) { return false; } + if (!thisSchema.additionalProperties().equals(thatSchema.additionalProperties())) { + return false; + } + return true; } @@ -539,7 +545,11 @@ public static Optional getSchemaFromAnnotation(io.swagger.v3.oas.annotat ((ComposedSchema) schemaObject).addAllOfItem(allOfSchemaObject); } } - + if (schema.additionalProperties().equals(io.swagger.v3.oas.annotations.media.Schema.AdditionalPropertiesValue.TRUE)) { + schemaObject.additionalProperties(true); + } else if (schema.additionalProperties().equals(io.swagger.v3.oas.annotations.media.Schema.AdditionalPropertiesValue.FALSE)) { + schemaObject.additionalProperties(false); + } return Optional.of(schemaObject); } @@ -1044,6 +1054,46 @@ public static Optional getContent(io.swagger.v3.oas.annotations.media.C MediaType mediaType = new MediaType(); if (components != null) { getSchema(annotationContent, components, jsonViewAnnotation).ifPresent(mediaType::setSchema); + if (annotationContent.schemaProperties().length > 0) { + if (mediaType.getSchema() == null) { + mediaType.schema(new Schema().type("object")); + } + Schema oSchema = mediaType.getSchema(); + for (SchemaProperty sp: annotationContent.schemaProperties()) { + Class schemaImplementation = sp.schema().implementation(); + boolean isArray = false; + if (schemaImplementation == Void.class) { + schemaImplementation = sp.array().schema().implementation(); + if (schemaImplementation != Void.class) { + isArray = true; + } + } + getSchema(sp.schema(), sp.array(), isArray, schemaImplementation, components, jsonViewAnnotation) + .ifPresent(s -> { + if ("array".equals(oSchema.getType())) { + oSchema.getItems().addProperty(sp.name(), s); + } else { + oSchema.addProperty(sp.name(), s); + } + }); + + } + } + if ( + hasSchemaAnnotation(annotationContent.additionalPropertiesSchema()) && + mediaType.getSchema() != null && + !Boolean.TRUE.equals(mediaType.getSchema().getAdditionalProperties()) && + !Boolean.FALSE.equals(mediaType.getSchema().getAdditionalProperties())) { + getSchemaFromAnnotation(annotationContent.additionalPropertiesSchema(), components, jsonViewAnnotation) + .ifPresent(s -> { + if ("array".equals(mediaType.getSchema().getType())) { + mediaType.getSchema().getItems().additionalProperties(s); + } else { + mediaType.getSchema().additionalProperties(s); + } + } + ); + } } else { mediaType.setSchema(schema); } @@ -1726,6 +1776,14 @@ public Extension[] extensions() { public Class annotationType() { return io.swagger.v3.oas.annotations.media.Schema.class; } + + @Override + public AdditionalPropertiesValue additionalProperties() { + if (!master.additionalProperties().equals(AdditionalPropertiesValue.USE_ADDITIONAL_PROPERTIES_ANNOTATION) || patch.additionalProperties().equals(AdditionalPropertiesValue.USE_ADDITIONAL_PROPERTIES_ANNOTATION)) { + return master.additionalProperties(); + } + return patch.additionalProperties(); + } }; return (io.swagger.v3.oas.annotations.media.Schema)schema; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/ReaderTest.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/ReaderTest.java index 65b33fa195..6098ee5746 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/ReaderTest.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/ReaderTest.java @@ -13,6 +13,7 @@ import io.swagger.v3.core.model.ApiDescription; import io.swagger.v3.core.util.PrimitiveType; import io.swagger.v3.jaxrs2.matchers.SerializationMatchers; +import io.swagger.v3.jaxrs2.resources.SchemaPropertiesResource; import io.swagger.v3.jaxrs2.resources.SingleExampleResource; import io.swagger.v3.jaxrs2.resources.BasicFieldsResource; import io.swagger.v3.jaxrs2.resources.BookStoreTicket2646; @@ -2811,4 +2812,154 @@ public void testTicket3731() { openAPI = reader.read(Ticket3731BisResource.class); SerializationMatchers.assertEqualsToYaml(openAPI, yaml); } + + @Test(description = "Test SchemaProperties and additionalProperties annotations") + public void testSchemaProperties() { + Reader reader = new Reader(new OpenAPI()); + + OpenAPI openAPI = reader.read(SchemaPropertiesResource.class); + String yaml = "openapi: 3.0.1\n" + + "paths:\n" + + " /:\n" + + " get:\n" + + " summary: Simple get operation\n" + + " description: Defines a simple get operation with no inputs and a complex output\n" + + " object\n" + + " operationId: getWithPayloadResponse\n" + + " responses:\n" + + " \"200\":\n" + + " description: voila!\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " type: object\n" + + " properties:\n" + + " foo:\n" + + " maximum: 1\n" + + " type: integer\n" + + " default:\n" + + " description: boo\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " maxProperties: 3\n" + + " type: object\n" + + " properties:\n" + + " foo:\n" + + " maximum: 1\n" + + " type: integer\n" + + " description: various properties\n" + + " \"400\":\n" + + " description: additionalProperties schema\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " maxProperties: 2\n" + + " type: object\n" + + " additionalProperties:\n" + + " type: string\n" + + " \"401\":\n" + + " description: additionalProperties boolean\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " maxProperties: 2\n" + + " type: object\n" + + " additionalProperties: false\n" + + " deprecated: true\n" + + " /one:\n" + + " get:\n" + + " operationId: requestBodySchemaPropertyNoSchema\n" + + " requestBody:\n" + + " content:\n" + + " application/yaml:\n" + + " schema:\n" + + " type: object\n" + + " properties:\n" + + " foo:\n" + + " type: string\n" + + " responses:\n" + + " default:\n" + + " description: default response\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " $ref: '#/components/schemas/MultipleBaseBean'\n" + + " /two:\n" + + " get:\n" + + " operationId: requestBodySchemaPropertySchema\n" + + " requestBody:\n" + + " content:\n" + + " application/yaml:\n" + + " schema:\n" + + " required:\n" + + " - foo\n" + + " type: object\n" + + " properties:\n" + + " foo:\n" + + " type: string\n" + + " responses:\n" + + " default:\n" + + " description: default response\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " $ref: '#/components/schemas/MultipleBaseBean'\n" + + " /three:\n" + + " get:\n" + + " operationId: requestBodySchemaPropertySchemaArray\n" + + " requestBody:\n" + + " content:\n" + + " application/yaml:\n" + + " schema:\n" + + " type: array\n" + + " items:\n" + + " required:\n" + + " - foo\n" + + " type: object\n" + + " properties:\n" + + " foo:\n" + + " type: string\n" + + " responses:\n" + + " default:\n" + + " description: default response\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " $ref: '#/components/schemas/MultipleBaseBean'\n" + + "components:\n" + + " schemas:\n" + + " MultipleBaseBean:\n" + + " type: object\n" + + " properties:\n" + + " beanType:\n" + + " type: string\n" + + " a:\n" + + " type: integer\n" + + " format: int32\n" + + " b:\n" + + " type: string\n" + + " description: MultipleBaseBean\n" + + " MultipleSub1Bean:\n" + + " type: object\n" + + " description: MultipleSub1Bean\n" + + " allOf:\n" + + " - $ref: '#/components/schemas/MultipleBaseBean'\n" + + " - type: object\n" + + " properties:\n" + + " c:\n" + + " type: integer\n" + + " format: int32\n" + + " MultipleSub2Bean:\n" + + " type: object\n" + + " description: MultipleSub2Bean\n" + + " allOf:\n" + + " - $ref: '#/components/schemas/MultipleBaseBean'\n" + + " - type: object\n" + + " properties:\n" + + " d:\n" + + " type: integer\n" + + " format: int32\n"; + SerializationMatchers.assertEqualsToYaml(openAPI, yaml); + } } diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/SchemaPropertiesResource.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/SchemaPropertiesResource.java new file mode 100644 index 0000000000..761e35fd1c --- /dev/null +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/SchemaPropertiesResource.java @@ -0,0 +1,167 @@ +package io.swagger.v3.jaxrs2.resources; + +import io.swagger.v3.jaxrs2.resources.model.MultipleBaseBean; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.SchemaProperty; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import io.swagger.v3.oas.annotations.responses.ApiResponse; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +public class SchemaPropertiesResource { + + @GET + @Path("/") + @Operation( + summary = "Simple get operation", + description = "Defines a simple get operation with no inputs and a complex output object", + operationId = "getWithPayloadResponse", + deprecated = true, + responses = { + @ApiResponse( + responseCode = "200", + description = "voila!", + content = @Content( + mediaType = "application/json", + schemaProperties = { + @SchemaProperty( + name = "foo", + schema = @Schema( + type = "integer", + maximum = "1" + ) + ) + } + ) + ), + @ApiResponse( + description = "boo", + content = @Content( + schema = @Schema( + type = "object", + description = "various properties", + maxProperties = 3 + ), + mediaType = "application/json", + schemaProperties = { + @SchemaProperty( + name = "foo", + schema = @Schema( + type = "integer", + maximum = "1" + ) + ) + } + ) + ), + @ApiResponse( + responseCode = "400", + description = "additionalProperties schema", + content = @Content( + mediaType = "application/json", + schema = @Schema( + type = "object", + maxProperties = 2 + ), + additionalPropertiesSchema = @Schema( + type = "string" + ) + ) + ), + @ApiResponse( + responseCode = "401", + description = "additionalProperties boolean", + content = @Content( + mediaType = "application/json", + schema = @Schema( + type = "object", + maxProperties = 2, + additionalProperties = Schema.AdditionalPropertiesValue.FALSE + ) + ) + ) + } + ) + public void getResponses() { + } + + @GET + @Path("/one") + @Produces({MediaType.APPLICATION_JSON}) + public MultipleBaseBean requestBodySchemaPropertyNoSchema( + @RequestBody( + content = @Content( + mediaType = "application/yaml", + schemaProperties = { + @SchemaProperty( + name = "foo", + schema = @Schema( + type = "string" + ) + ) + } + ) + ) Object body) { + return null; + } + + @GET + @Path("/two") + @Produces({MediaType.APPLICATION_JSON}) + public MultipleBaseBean requestBodySchemaPropertySchema( + @RequestBody( + content = @Content( + mediaType = "application/yaml", + schema = @Schema( + type = "object", + requiredProperties = { + "foo" + } + ), + schemaProperties= { + @SchemaProperty( + name = "foo", + schema = @Schema( + type = "string" + ) + ) + } + ) + ) Object body) { + return null; + } + + @GET + @Path("/three") + @Produces({MediaType.APPLICATION_JSON}) + public MultipleBaseBean requestBodySchemaPropertySchemaArray( + @RequestBody( + content = @Content( + mediaType = "application/yaml", + array = @ArraySchema( + schema = @Schema( + type = "object", + requiredProperties = { + "foo" + } + ) + ), + schemaProperties = { + @SchemaProperty( + name = "foo", + schema = @Schema( + type = "string" + ) + ) + } + ) + ) Object body) { + return null; + } +} diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java index ccfd156397..662d6e54cd 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java @@ -55,7 +55,7 @@ public class Components { private java.util.Map extensions = null; /** - * @since 2.1.11 (OpenAPI 3.1.0) + * @since 2.2.0 (OpenAPI 3.1.0) */ @OpenAPI31 private Map pathItems; @@ -306,7 +306,7 @@ public Components addCallbacks(String key, Callback callbacksItem) { /** * returns the path items property from a Components instance. * - * @since 2.1.11 (OpenAPI 3.1.0) + * @since 2.2.0 (OpenAPI 3.1.0) * @return Map<String, PathItem> pathItems **/ @OpenAPI31 diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java index b6f0954959..76e21d5b59 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java @@ -70,7 +70,7 @@ public OpenAPI specVersion(SpecVersion specVersion) { } /** - * @since 2.1.8 (OpenAPI 3.1.0) + * @since 2.2.0 (OpenAPI 3.1.0) */ @OpenAPI31 private java.util.Map webhooks = null; @@ -283,7 +283,7 @@ public OpenAPI schemaRequirement(String name, SecurityScheme securityScheme) { /** * returns the webhooks property from a OpenAPI instance. * - * @since 2.1.10 (OpenAPI 3.1.0) + * @since 2.2.0 (OpenAPI 3.1.0) * @return Map<String, PathItem> webhooks **/ diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java index c1cbd6369f..31193b8590 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java @@ -34,7 +34,7 @@ public class Info { private java.util.Map extensions = null; /** - * @since 2.1.11 (OpenAPI 3.1.0) + * @since 2.2.0 (OpenAPI 3.1.0) */ @OpenAPI31 private String summary = null; @@ -156,7 +156,7 @@ public Info version(String version) { /** * returns the summary property from a Info instance. * - * @since 2.1.11 (OpenAPI 3.1.0) + * @since 2.2.0 (OpenAPI 3.1.0) * @return String **/ @OpenAPI31 diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java index 11d7189350..f403e54e50 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java @@ -32,7 +32,7 @@ public class License { private String url = null; /** - * @since 2.1.8 + * @since 2.2.0 (OpenAPI 3.1.0) */ @OpenAPI31 private String identifier = null; @@ -79,7 +79,7 @@ public License url(String url) { /** * returns the identifier property from a License instance. * - * @since 2.1.8 + * @since 2.2.0 (OpenAPI 3.1.0) * @return String identifier **/ @OpenAPI31 diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Discriminator.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Discriminator.java index 4643ae121a..b3b09ef4c2 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Discriminator.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Discriminator.java @@ -11,7 +11,7 @@ public class Discriminator { private Map mapping; /** - * @since 2.1.11 (OpenAPI 3.1.0) + * @since 2.2.0 (OpenAPI 3.1.0) */ @OpenAPI31 private Map extensions; @@ -53,7 +53,7 @@ public void setMapping(Map mapping) { /** * returns the specific extensions from a Discriminator instance. * - * @since 2.1.11 (OpenAPI 3.1.0) + * @since 2.2.0 (OpenAPI 3.1.0) * @return Map<String, Object> extensions **/ @OpenAPI31 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 361b65daf5..626a2dfd98 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 @@ -167,41 +167,73 @@ public Schema specVersion(SpecVersion specVersion) { @OpenAPI31 private List examples; + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema getContains() { return contains; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setContains(Schema contains) { this.contains = contains; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public String get$id() { return $id; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void set$id(String $id) { this.$id = $id; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public String get$schema() { return $schema; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void set$schema(String $schema) { this.$schema = $schema; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public String get$anchor() { return $anchor; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void set$anchor(String $anchor) { this.$anchor = $anchor; @@ -210,7 +242,7 @@ public void setContains(Schema contains) { /** * returns the exclusiveMaximumValue property from a Schema instance for OpenAPI 3.1.x * - * @since 2.1.8 + * @since 2.2.0 (OpenAPI 3.1.0) * @return BigDecimal exclusiveMaximumValue * **/ @@ -219,11 +251,19 @@ public BigDecimal getExclusiveMaximumValue() { return exclusiveMaximumValue; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setExclusiveMaximumValue(BigDecimal exclusiveMaximumValue) { this.exclusiveMaximumValue = exclusiveMaximumValue; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema exclusiveMaximumValue(BigDecimal exclusiveMaximumValue) { this.exclusiveMaximumValue = exclusiveMaximumValue; @@ -233,7 +273,7 @@ public Schema exclusiveMaximumValue(BigDecimal exclusiveMaximumValue) { /** * returns the exclusiveMinimumValue property from a Schema instance for OpenAPI 3.1.x * - * @since 2.1.8 + * @since 2.2.0 (OpenAPI 3.1.0) * @return BigDecimal exclusiveMinimumValue * **/ @@ -241,10 +281,20 @@ public Schema exclusiveMaximumValue(BigDecimal exclusiveMaximumValue) { public BigDecimal getExclusiveMinimumValue() { return exclusiveMinimumValue; } + + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setExclusiveMinimumValue(BigDecimal exclusiveMinimumValue) { this.exclusiveMinimumValue = exclusiveMinimumValue; } + + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema exclusiveMinimumValue(BigDecimal exclusiveMinimumValue) { this.exclusiveMinimumValue = exclusiveMinimumValue; @@ -254,25 +304,37 @@ public Schema exclusiveMinimumValue(BigDecimal exclusiveMinimumValue) { /** * returns the patternProperties property from a Schema instance. * - * @since 2.1.8 + * @since 2.2.0 (OpenAPI 3.1.0) * @return Map<String, Schema> patternProperties **/ - @OpenAPI31 public Map getPatternProperties() { return patternProperties; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ + @OpenAPI31 public void setPatternProperties(Map patternProperties) { this.patternProperties = patternProperties; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema patternProperties(Map patternProperties) { this.patternProperties = patternProperties; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema addPatternProperty(String key, Schema patternPropertiesItem) { if (this.patternProperties == null) { @@ -282,29 +344,48 @@ public Schema addPatternProperty(String key, Schema patternPropertiesItem) { return this; } - + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema contains(Schema contains) { this.contains = contains; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema $id(String $id) { this.$id = $id; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Set getTypes() { return types; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setTypes(Set types) { this.types = types; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public boolean addType(String type) { if (types == null) { @@ -313,18 +394,30 @@ public boolean addType(String type) { return types.add(type); } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema $schema(String $schema) { this.$schema = $schema; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema $anchor(String $anchor) { this.$anchor = $anchor; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema types(Set types) { this.types = types; @@ -955,11 +1048,20 @@ public Schema properties(Map properties) { return this; } - public Schema addProperties(String key, Schema propertiesItem) { + @Deprecated + public Schema addProperties(String key, Schema property) { + return addProperty(key, property); + } + + /** + * + * @since 2.2.0 + */ + public Schema addProperty(String key, Schema property) { if (this.properties == null) { this.properties = new LinkedHashMap<>(); } - this.properties.put(key, propertiesItem); + this.properties.put(key, property); return this; } @@ -1198,278 +1300,486 @@ public void setExampleSetFlag(boolean exampleSetFlag) { this.exampleSetFlag = exampleSetFlag; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public List getPrefixItems() { return prefixItems; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setPrefixItems(List prefixItems) { this.prefixItems = prefixItems; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema prefixItems(List prefixItems) { this.prefixItems = prefixItems; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public String getContentEncoding() { return contentEncoding; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setContentEncoding(String contentEncoding) { this.contentEncoding = contentEncoding; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema contentEncoding(String contentEncoding) { this.contentEncoding = contentEncoding; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public String getContentMediaType() { return contentMediaType; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setContentMediaType(String contentMediaType) { this.contentMediaType = contentMediaType; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema contentMediaType(String contentMediaType) { this.contentMediaType = contentMediaType; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema getContentSchema() { return contentSchema; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setContentSchema(Schema contentSchema) { this.contentSchema = contentSchema; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema contentSchema(Schema contentSchema) { this.contentSchema = contentSchema; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema getPropertyNames() { return propertyNames; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setPropertyNames(Schema propertyNames) { this.propertyNames = propertyNames; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema propertyNames(Schema propertyNames) { this.propertyNames = propertyNames; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Object getUnevaluatedProperties() { return unevaluatedProperties; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setUnevaluatedProperties(Object unevaluatedProperties) { this.unevaluatedProperties = unevaluatedProperties; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema unevaluatedProperties(Object unevaluatedProperties) { this.unevaluatedProperties = unevaluatedProperties; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Integer getMaxContains() { return maxContains; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setMaxContains(Integer maxContains) { this.maxContains = maxContains; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema maxContains(Integer maxContains) { this.maxContains = maxContains; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Integer getMinContains() { return minContains; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setMinContains(Integer minContains) { this.minContains = minContains; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema minContains(Integer minContains) { this.minContains = minContains; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema getAdditionalItems() { return additionalItems; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setAdditionalItems(Schema additionalItems) { this.additionalItems = additionalItems; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema additionalItems(Schema additionalItems) { this.additionalItems = additionalItems; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema getUnevaluatedItems() { return unevaluatedItems; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setUnevaluatedItems(Schema unevaluatedItems) { this.unevaluatedItems = unevaluatedItems; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema unevaluatedItems(Schema unevaluatedItems) { this.unevaluatedItems = unevaluatedItems; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema getIf() { return _if; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setIf(Schema _if) { this._if = _if; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema _if(Schema _if) { this._if = _if; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema getElse() { return _else; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setElse(Schema _else) { this._else = _else; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema _else(Schema _else) { this._else = _else; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema getThen() { return then; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setThen(Schema then) { this.then = then; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema then(Schema then) { this.then = then; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Map getDependentSchemas() { return dependentSchemas; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setDependentSchemas(Map dependentSchemas) { this.dependentSchemas = dependentSchemas; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema dependentSchemas(Map dependentSchemas) { this.dependentSchemas = dependentSchemas; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Map> getDependentRequired() { return dependentRequired; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setDependentRequired(Map> dependentRequired) { this.dependentRequired = dependentRequired; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema dependentRequired(Map> dependentRequired) { this.dependentRequired = dependentRequired; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public String get$comment() { return $comment; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void set$comment(String $comment) { this.$comment = $comment; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema $comment(String $comment) { this.$comment = $comment; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public List getExamples() { return examples; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setExamples(List examples) { this.examples = examples; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema examples(List examples) { this.examples = examples; return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void addExample(T example) { if (this.examples == null) { @@ -1679,14 +1989,26 @@ public Schema exampleSetFlag(boolean exampleSetFlag) { return this; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ public T getConst() { return _const; } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ public void setConst(Object _const) { this._const = cast(_const); } + /** + * + * @since 2.2.0 (OpenAPI 3.1.0) + */ public Schema _const(Object _const) { this._const = cast(_const); return this; From abeabedb2c060462d9c0300c5c723245abcbc211 Mon Sep 17 00:00:00 2001 From: frantuma Date: Tue, 22 Feb 2022 17:58:47 +0100 Subject: [PATCH 64/79] refs #3870 - enhanced response schema resolving --- .../annotations/responses/ApiResponse.java | 7 ++ .../java/io/swagger/v3/jaxrs2/Reader.java | 55 +++++++++++++-- .../java/io/swagger/v3/jaxrs2/ReaderTest.java | 68 +++++++++++++++++++ .../resources/ResponseReturnTypeResource.java | 42 ++++++++++++ 4 files changed, 167 insertions(+), 5 deletions(-) create mode 100644 modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/ResponseReturnTypeResource.java diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/responses/ApiResponse.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/responses/ApiResponse.java index 9a9ed97ba4..5a5af16036 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/responses/ApiResponse.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/responses/ApiResponse.java @@ -96,4 +96,11 @@ **/ String ref() default ""; + /** + * Set to true to resolve the response schema from method return type + * + * @since 2.2.0 + **/ + boolean useReturnTypeSchema() default false; + } diff --git a/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/Reader.java b/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/Reader.java index e48ff1cb12..95098f0427 100644 --- a/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/Reader.java +++ b/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/Reader.java @@ -1076,10 +1076,11 @@ protected Operation parseMethod( } final Class subResource = getSubResourceWithJaxRsSubresourceLocatorSpecs(method); + Schema returnTypeSchema = null; if (!shouldIgnoreClass(returnType.getTypeName()) && !method.getGenericReturnType().equals(subResource)) { ResolvedSchema resolvedSchema = ModelConverters.getInstance().resolveAsResolvedSchema(new AnnotatedType(returnType).resolveAsRef(true).jsonViewAnnotation(jsonViewAnnotation)); if (resolvedSchema.schema != null) { - Schema returnTypeSchema = resolvedSchema.schema; + returnTypeSchema = resolvedSchema.schema; Content content = new Content(); MediaType mediaType = new MediaType().schema(returnTypeSchema); AnnotationsUtils.applyTypes(classProduces == null ? new String[0] : classProduces.value(), @@ -1112,18 +1113,62 @@ protected Operation parseMethod( } } if (operation.getResponses() == null || operation.getResponses().isEmpty()) { - Content content = new Content(); - MediaType mediaType = new MediaType(); - AnnotationsUtils.applyTypes(classProduces == null ? new String[0] : classProduces.value(), - methodProduces == null ? new String[0] : methodProduces.value(), content, mediaType); + Content content = resolveEmptyContent(classProduces, methodProduces); ApiResponse apiResponseObject = new ApiResponse().description(DEFAULT_DESCRIPTION).content(content); operation.setResponses(new ApiResponses()._default(apiResponseObject)); } + if (returnTypeSchema != null) { + resolveResponseSchemaFromReturnType(operation, classResponses, returnTypeSchema, classProduces, methodProduces); + if (apiResponses != null) { + resolveResponseSchemaFromReturnType( + operation, + apiResponses.stream().toArray(io.swagger.v3.oas.annotations.responses.ApiResponse[]::new), + returnTypeSchema, + classProduces, + methodProduces); + } + } + return operation; } + protected Content resolveEmptyContent(Produces classProduces, Produces methodProduces) { + Content content = new Content(); + MediaType mediaType = new MediaType(); + AnnotationsUtils.applyTypes(classProduces == null ? new String[0] : classProduces.value(), + methodProduces == null ? new String[0] : methodProduces.value(), content, mediaType); + return content; + } + + protected void resolveResponseSchemaFromReturnType( + Operation operation, + io.swagger.v3.oas.annotations.responses.ApiResponse[] responses, + Schema schema, + Produces classProduces, Produces methodProduces) { + if (responses != null) { + for (io.swagger.v3.oas.annotations.responses.ApiResponse response: responses) { + if (response.useReturnTypeSchema()) { + ApiResponse opResponse = operation.getResponses().get(response.responseCode()); + if (opResponse != null) { + if (opResponse.getContent() != null) { + for (MediaType mediaType : opResponse.getContent().values()) { + mediaType.schema(schema); + } + } else { + Content content = resolveEmptyContent(classProduces, methodProduces); + for (MediaType mediaType : content.values()) { + mediaType.schema(schema); + } + opResponse.content(content); + } + } + } + } + } + } + private boolean shouldIgnoreClass(String className) { if (StringUtils.isBlank(className)) { return true; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/ReaderTest.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/ReaderTest.java index 6098ee5746..742141b118 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/ReaderTest.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/ReaderTest.java @@ -13,6 +13,7 @@ import io.swagger.v3.core.model.ApiDescription; import io.swagger.v3.core.util.PrimitiveType; import io.swagger.v3.jaxrs2.matchers.SerializationMatchers; +import io.swagger.v3.jaxrs2.resources.ResponseReturnTypeResource; import io.swagger.v3.jaxrs2.resources.SchemaPropertiesResource; import io.swagger.v3.jaxrs2.resources.SingleExampleResource; import io.swagger.v3.jaxrs2.resources.BasicFieldsResource; @@ -2962,4 +2963,71 @@ public void testSchemaProperties() { " format: int32\n"; SerializationMatchers.assertEqualsToYaml(openAPI, yaml); } + + @Test(description = "Responses schema resolved from return type") + public void testResponseReturnType() { + Reader reader = new Reader(new OpenAPI()); + + OpenAPI openAPI = reader.read(ResponseReturnTypeResource.class); + String yaml = "openapi: 3.0.1\n" + + "paths:\n" + + " /sample/{id}:\n" + + " get:\n" + + " summary: Find by id\n" + + " description: Find by id operation\n" + + " operationId: find\n" + + " parameters:\n" + + " - name: id\n" + + " in: path\n" + + " description: ID\n" + + " required: true\n" + + " schema:\n" + + " type: integer\n" + + " format: int32\n" + + " responses:\n" + + " \"200\":\n" + + " description: Ok\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " $ref: '#/components/schemas/TestDTO'\n" + + " \"201\":\n" + + " description: \"201\"\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " $ref: '#/components/schemas/TestDTO'\n" + + " \"204\":\n" + + " description: No Content\n" + + " content:\n" + + " application/json: {}\n" + + " /sample/{id}/default:\n" + + " get:\n" + + " summary: Find by id (default)\n" + + " description: Find by id operation (default)\n" + + " operationId: findDefault\n" + + " parameters:\n" + + " - name: id\n" + + " in: path\n" + + " description: ID\n" + + " required: true\n" + + " schema:\n" + + " type: integer\n" + + " format: int32\n" + + " responses:\n" + + " default:\n" + + " description: default response\n" + + " content:\n" + + " application/json:\n" + + " schema:\n" + + " $ref: '#/components/schemas/TestDTO'\n" + + "components:\n" + + " schemas:\n" + + " TestDTO:\n" + + " type: object\n" + + " properties:\n" + + " foo:\n" + + " type: string"; + SerializationMatchers.assertEqualsToYaml(openAPI, yaml); + } } diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/ResponseReturnTypeResource.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/ResponseReturnTypeResource.java new file mode 100644 index 0000000000..1bb16211fc --- /dev/null +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/ResponseReturnTypeResource.java @@ -0,0 +1,42 @@ +package io.swagger.v3.jaxrs2.resources; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Consumes(MediaType.APPLICATION_JSON) +@Produces(MediaType.APPLICATION_JSON) +@Path("/sample") +public interface ResponseReturnTypeResource { + + @GET + @Path("/{id}") + @Operation(summary = "Find by id", description = "Find by id operation") + @ApiResponse(responseCode = "200", description = "Ok", useReturnTypeSchema = true) + @ApiResponse(responseCode = "201", + description = "201", + useReturnTypeSchema = true, + content = @Content(mediaType = "application/json")) + @ApiResponse(responseCode = "204", + description = "No Content", + content = @Content(mediaType = "application/json", schema = @Schema(implementation = Void.class))) + TestDTO find(@Parameter(description = "ID") @PathParam("id") Integer id); + + @GET + @Path("/{id}/default") + @Operation(summary = "Find by id (default)", description = "Find by id operation (default)") + TestDTO findDefault(@Parameter(description = "ID") @PathParam("id") Integer id); + + class TestDTO { + public String foo; + } +} From 2ffbe66774f3c514481d8747cff27738f2d5d615 Mon Sep 17 00:00:00 2001 From: frantuma Date: Tue, 22 Feb 2022 18:22:58 +0100 Subject: [PATCH 65/79] wrap owasp plugin within profile --- pom.xml | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index 08b62e4a76..62f7e0893a 100644 --- a/pom.xml +++ b/pom.xml @@ -88,21 +88,6 @@ target ${project.artifactId}-${project.version} - - org.owasp - dependency-check-maven - 6.5.3 - - true - - - - - check - - - - maven-compiler-plugin 3.8.1 @@ -369,6 +354,28 @@ + + security + + + + org.owasp + dependency-check-maven + 6.5.3 + + true + + + + + check + + + + + + + release From 3626f1d7422933422e3438fb63404538ee0f3954 Mon Sep 17 00:00:00 2001 From: frantuma Date: Wed, 23 Feb 2022 09:33:34 +0100 Subject: [PATCH 66/79] update maven and wrapper versions --- .mvn/wrapper/MavenWrapperDownloader.java | 2 +- .mvn/wrapper/maven-wrapper.properties | 4 ++-- modules/swagger-eclipse-transformer-maven-plugin/pom.xml | 6 +++--- modules/swagger-maven-plugin/pom.xml | 6 +++--- .../modules/swagger-maven-plugin-jakarta/pom.xml | 6 +++--- modules/swagger-project-jakarta/pom.xml | 2 +- mvnw | 6 +++--- mvnw.cmd | 6 +++--- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java index b20a55a7a9..8f9ff40168 100644 --- a/.mvn/wrapper/MavenWrapperDownloader.java +++ b/.mvn/wrapper/MavenWrapperDownloader.java @@ -20,7 +20,7 @@ public class MavenWrapperDownloader { - private static final String WRAPPER_VERSION = "0.5.3"; + private static final String WRAPPER_VERSION = "0.5.6"; /** * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. */ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 84472b532a..6cbe900624 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,2 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.6.jar diff --git a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml index 117c1fad9e..a544b2e64d 100644 --- a/modules/swagger-eclipse-transformer-maven-plugin/pom.xml +++ b/modules/swagger-eclipse-transformer-maven-plugin/pom.xml @@ -13,7 +13,7 @@ swagger-eclipse-transformer-maven-plugin maven-plugin - 3.6.3 + 3.8.4 0.20 3.3.0 1.2.6 @@ -39,7 +39,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.6.0 + 3.6.4 transform @@ -94,7 +94,7 @@ org.apache.maven.plugin-tools maven-plugin-annotations - 3.6.0 + 3.6.4 provided diff --git a/modules/swagger-maven-plugin/pom.xml b/modules/swagger-maven-plugin/pom.xml index b676a08791..eb9de0d632 100644 --- a/modules/swagger-maven-plugin/pom.xml +++ b/modules/swagger-maven-plugin/pom.xml @@ -29,7 +29,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.6.0 + 3.6.4 io.swagger.core.v3 @@ -88,7 +88,7 @@ org.apache.maven.plugin-tools maven-plugin-annotations - 3.6.0 + 3.6.4 provided @@ -290,7 +290,7 @@ UTF-8 - 3.6.3 + 3.8.4 4.13.1 9.4.43.v20210629 1.21 diff --git a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml index e910623799..d0f8a86c7b 100644 --- a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/pom.xml @@ -87,7 +87,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.6.0 + 3.6.4 true @@ -140,7 +140,7 @@ org.apache.maven.plugin-tools maven-plugin-annotations - 3.6.0 + 3.6.4 provided @@ -175,6 +175,6 @@ UTF-8 - 3.6.3 + 3.8.4 diff --git a/modules/swagger-project-jakarta/pom.xml b/modules/swagger-project-jakarta/pom.xml index 256a68b5db..4c3946e611 100644 --- a/modules/swagger-project-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/pom.xml @@ -589,7 +589,7 @@ UTF-8 https://oss.sonatype.org/content/repositories/snapshots/ - 3.6.3 + 3.8.4 1.21 diff --git a/mvnw b/mvnw index 34d9dae8d0..d1e14b0eef 100755 --- a/mvnw +++ b/mvnw @@ -212,9 +212,9 @@ else echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." fi if [ -n "$MVNW_REPOURL" ]; then - jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar" + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" else - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar" + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" fi while IFS="=" read key value; do case "$key" in (wrapperUrl) jarUrl="$value"; break ;; @@ -246,7 +246,7 @@ else else curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f fi - + else if [ "$MVNW_VERBOSE" = true ]; then echo "Falling back to using Java to download" diff --git a/mvnw.cmd b/mvnw.cmd index 77b451d837..6925114e69 100644 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -120,7 +120,7 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar" +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/mavrapper-0.5.6.jar" FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B @@ -132,11 +132,11 @@ if exist %WRAPPER_JAR% ( echo Found %WRAPPER_JAR% ) else ( if not "%MVNW_REPOURL%" == "" ( - SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar" + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" ) echo Couldn't find %WRAPPER_JAR%, downloading it ... echo Downloading from: %DOWNLOAD_URL% - + powershell -Command "&{"^ "$webclient = new-object System.Net.WebClient;"^ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ From 67e3a3fad68a2903d2c3911cb6144409801a4894 Mon Sep 17 00:00:00 2001 From: frantuma Date: Tue, 22 Mar 2022 11:00:20 +0100 Subject: [PATCH 67/79] refs #4138 - update jackson to 2.13.2 --- .../modules/swagger-jaxrs2-jakarta/pom.xml | 5 ++--- .../maven/jakarta/JakartaTransformer.java | 17 +++++++++-------- modules/swagger-project-jakarta/pom.xml | 19 ++++++++++--------- pom.xml | 2 +- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml index 5e3fd214a1..9b9e36621e 100644 --- a/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/modules/swagger-jaxrs2-jakarta/pom.xml @@ -72,9 +72,8 @@ jackson-databind - com.fasterxml.jackson.jaxrs - jackson-jaxrs-json-provider - jakarta + com.fasterxml.jackson.jakarta.rs + jackson-jakarta-rs-json-provider ${jackson-version} diff --git a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/src/main/java/io/swagger/v3/plugin/maven/jakarta/JakartaTransformer.java b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/src/main/java/io/swagger/v3/plugin/maven/jakarta/JakartaTransformer.java index 26eac9d93e..832bad509b 100644 --- a/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/src/main/java/io/swagger/v3/plugin/maven/jakarta/JakartaTransformer.java +++ b/modules/swagger-project-jakarta/modules/swagger-maven-plugin-jakarta/src/main/java/io/swagger/v3/plugin/maven/jakarta/JakartaTransformer.java @@ -73,9 +73,8 @@ public class JakartaTransformer { private static final String jakartaValidationRegex = "^.*(.*jakarta\\.validation((?!).)*).*$"; private static final String jacksonJsonDep = "\n" + - " com.fasterxml.jackson.jaxrs\n" + - " jackson-jaxrs-json-provider\n" + - " jakarta\n" + + " com.fasterxml.jackson.jakarta.rs\n" + + " jackson-jakarta-rs-json-provider\n" + " VERSION\n" + " \n" + " \n" + @@ -92,9 +91,8 @@ public class JakartaTransformer { private static final String jacksonJsonRegex = "^.*(.*jackson\\-jaxrs\\-json((?!).)*).*$"; private static final String jacksonBaseDep = "\n" + - " com.fasterxml.jackson.jaxrs\n" + - " jackson-jaxrs-base\n" + - " jakarta\n" + + " com.fasterxml.jackson.jakarta.rs\n" + + " jackson-jakarta-rs-base\n" + " VERSION\n" + " "; @@ -102,8 +100,7 @@ public class JakartaTransformer { private static final String jacksonJaxbDep = "\n" + " com.fasterxml.jackson.module\n" + - " jackson-module-jaxb-annotations\n" + - " jakarta\n" + + " jackson-module-jakarta-xmlbind-annotations\n" + " VERSION\n" + " \n" + " \n" + @@ -114,6 +111,10 @@ public class JakartaTransformer { " jakarta.xml.bind\n" + " jakarta.xml.bind-api\n" + " \n" + + " \n" + + " com.sun.activation\n" + + " jakarta.activation\n" + + " " + " \n" + " "; diff --git a/modules/swagger-project-jakarta/pom.xml b/modules/swagger-project-jakarta/pom.xml index 4c3946e611..021ddc751a 100644 --- a/modules/swagger-project-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/pom.xml @@ -506,9 +506,8 @@ ${jackson-version} - com.fasterxml.jackson.jaxrs - jackson-jaxrs-json-provider - jakarta + com.fasterxml.jackson.jakarta.rs + jackson-jakarta-rs-json-provider ${jackson-version} @@ -522,15 +521,13 @@ - com.fasterxml.jackson.jaxrs - jackson-jaxrs-base - jakarta + com.fasterxml.jackson.jakarta.rs + jackson-jakarta-rs-base ${jackson-version} com.fasterxml.jackson.module - jackson-module-jaxb-annotations - jakarta + jackson-module-jakarta-xmlbind-annotations ${jackson-version} @@ -541,6 +538,10 @@ jakarta.xml.bind jakarta.xml.bind-api + + com.sun.activation + jakarta.activation + @@ -563,7 +564,7 @@ 5.0.0 3.0.1 4.13.1 - 2.12.1 + 2.13.2 1.2.9 4.8.138 31.0.1-jre diff --git a/pom.xml b/pom.xml index 62f7e0893a..8257e5f836 100644 --- a/pom.xml +++ b/pom.xml @@ -646,7 +646,7 @@ 4.0.3 2.26 4.13.1 - 2.12.1 + 2.13.2 1.2.9 4.8.138 31.0.1-jre From 3fdca98540f5f17cdbd8d2146008136f644025df Mon Sep 17 00:00:00 2001 From: frantuma Date: Tue, 22 Mar 2022 11:46:45 +0100 Subject: [PATCH 68/79] refs #3853 - fix composed schemas ref with fqn TypeNameResolver --- .../src/main/java/io/swagger/v3/core/jackson/ModelResolver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java index 3137167397..0178cfb423 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java @@ -1428,7 +1428,7 @@ private boolean resolveSubtypes(Schema model, BeanDescription bean, ModelConvert } else { composedSchema = (ComposedSchema) subtypeModel; } - Schema refSchema = new Schema().$ref(model.getName()); + Schema refSchema = new Schema().$ref(Components.COMPONENTS_SCHEMAS_REF + model.getName()); // allOf could have already being added during type resolving when @Schema(allOf..) is declared if (composedSchema.getAllOf() == null || !composedSchema.getAllOf().contains(refSchema)) { composedSchema.addAllOfItem(refSchema); From 1d6b12ad8173ccf889b2ce6423cab23a40129834 Mon Sep 17 00:00:00 2001 From: fennekit Date: Tue, 22 Mar 2022 11:47:17 +0100 Subject: [PATCH 69/79] refs #3853 - test for composed schemas ref with fqn TypeNameResolver --- .../v3/core/resolving/Ticket3853Test.java | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/Ticket3853Test.java diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/Ticket3853Test.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/Ticket3853Test.java new file mode 100644 index 0000000000..4282ff103c --- /dev/null +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/Ticket3853Test.java @@ -0,0 +1,73 @@ +package io.swagger.v3.core.resolving; + +import static org.testng.Assert.assertNotNull; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.v3.core.converter.AnnotatedType; +import io.swagger.v3.core.converter.ModelConverterContextImpl; +import io.swagger.v3.core.jackson.ModelResolver; +import io.swagger.v3.core.jackson.TypeNameResolver; +import io.swagger.v3.core.matchers.SerializationMatchers; +import io.swagger.v3.oas.models.media.Schema; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + +public class Ticket3853Test extends SwaggerTestBase { + + private ModelResolver modelResolver; + private ModelConverterContextImpl context; + + @BeforeTest + public void setup() { + modelResolver = new ModelResolver(new ObjectMapper(), new FqnTypeNameResolver()); + context = new ModelConverterContextImpl(modelResolver); + } + + @Test + public void testTicket3853() { + final Schema model = context.resolve(new AnnotatedType(BaseClass.class)); + + assertNotNull(model); + String yaml = "io.swagger.v3.core.resolving.Ticket3853Test$BaseClass:\n" + + " type: object\n" + + " properties:\n" + + " property:\n" + + " type: string\n" + + " type:\n" + + " type: string\n" + + "io.swagger.v3.core.resolving.Ticket3853Test$SubClass:\n" + + " type: object\n" + + " allOf:\n" + + " - $ref: '#/components/schemas/io.swagger.v3.core.resolving.Ticket3853Test$BaseClass'\n" + + " - type: object\n" + + " properties:\n" + + " subClassProperty:\n" + + " type: string"; + + SerializationMatchers.assertEqualsToYaml(context.getDefinedModels(), yaml); + } + + static class SubClass extends BaseClass { + public String subClassProperty; + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME) + @JsonSubTypes({ + @JsonSubTypes.Type(value = SubClass.class, name = "SubClass"), + @JsonSubTypes.Type(value = BaseClass.class, name = "BaseClass"), + }) + static class BaseClass { + public String property; + public String type; + } + + static class FqnTypeNameResolver extends TypeNameResolver { + + @Override + protected String getNameOfClass(Class cls) { + return cls.getName(); + } + } +} From 0d21afcb3e00fe937852f4e63224c7ae37d83080 Mon Sep 17 00:00:00 2001 From: gracekarina Date: Thu, 3 Mar 2022 20:27:03 -0500 Subject: [PATCH 70/79] accept strings and convert to byte[] in ByteArraySchema --- .../main/java/io/swagger/v3/oas/models/media/BinarySchema.java | 2 ++ .../java/io/swagger/v3/oas/models/media/ByteArraySchema.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BinarySchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BinarySchema.java index fe5151ecf3..3adc7ccb3e 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BinarySchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BinarySchema.java @@ -52,6 +52,8 @@ protected byte[] cast(Object value) { try { if (value instanceof byte[]) { return (byte[]) value; + } else { + return value.toString().getBytes(); } } catch (Exception e) { } diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ByteArraySchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ByteArraySchema.java index 39813683c3..29011f1dae 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ByteArraySchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ByteArraySchema.java @@ -52,6 +52,8 @@ protected byte[] cast(Object value) { try { if (value instanceof byte[]) { return (byte[]) value; + } else { + return value.toString().getBytes(); } } catch (Exception e) { } From 636cff7d40bff46ce5ae5b2c3e76a2f9d01f6d9f Mon Sep 17 00:00:00 2001 From: frantuma Date: Fri, 25 Mar 2022 13:53:37 +0100 Subject: [PATCH 71/79] oas 3.1 - opinionated deterministic schema properties ordering --- .../v3/core/jackson/mixin/Schema31Mixin.java | 2 + .../SchemaSerializationTest.java | 60 +++++++++++++------ 2 files changed, 45 insertions(+), 17 deletions(-) diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java index 02170fc62e..67dcfd015c 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; @@ -15,6 +16,7 @@ import java.util.Map; import java.util.Set; +@JsonPropertyOrder(value = {"type", "format", "if", "then", "else"}, alphabetic = true) public abstract class Schema31Mixin { //@JsonValue diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/SchemaSerializationTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/SchemaSerializationTest.java index 00f63796ec..713f5f9da7 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/SchemaSerializationTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/SchemaSerializationTest.java @@ -3,45 +3,70 @@ import io.swagger.v3.core.matchers.SerializationMatchers; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.media.JsonSchema; import org.testng.annotations.Test; +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.HashSet; + public class SchemaSerializationTest { @Test public void serializeRefSchema3_1() { OpenAPI openAPI = new OpenAPI() .components(new Components() - .addSchemas("Pet", new Schema() - .addProperties("id", new Schema().type("integer")) - .addProperties("name", new Schema().type("string")) - .addProperties("tag", new Schema().type("string"))) - .addSchemas("AnotherPet", new Schema() + .addSchemas("Pet", new JsonSchema() + .types(new HashSet<>(Arrays.asList("object"))) + .format("whatever") + ._if(new JsonSchema().type("string").types(new HashSet<>(Arrays.asList("string")))) + .then(new JsonSchema().type("string").types(new HashSet<>(Arrays.asList("string")))) + ._else(new JsonSchema().type("string").types(new HashSet<>(Arrays.asList("string")))) + .minimum(BigDecimal.valueOf(1)) + .addProperties("id", new JsonSchema().type("integer").types(new HashSet<>(Arrays.asList("integer")))) + .addProperties("name", new JsonSchema().type("string").types(new HashSet<>(Arrays.asList("string")))) + .addProperties("tag", new JsonSchema().type("string").types(new HashSet<>(Arrays.asList("string"))))) + .addSchemas("AnotherPet", new JsonSchema() .title("Another Pet") .description("Another Pet for petstore referencing Pet schema") .$ref("#/components/schemas/Pet") - .addProperties("category", new Schema().type("string")) - .addProperties("photoUrl", new Schema().type("string")))); + .addProperties("category", new JsonSchema().types(new HashSet<>(Arrays.asList("string")))) + .addProperties("photoUrl", new JsonSchema().types(new HashSet<>(Arrays.asList("string")))))); SerializationMatchers.assertEqualsToYaml31(openAPI, "openapi: 3.0.1\n" + "components:\n" + " schemas:\n" + " Pet:\n" + + " type: object\n" + + " format: whatever\n" + + " if:\n" + + " type: string\n" + + " then:\n" + + " type: string\n" + + " else:\n" + + " type: string\n" + + " minimum: 1\n" + " properties:\n" + - " id: {}\n" + - " name: {}\n" + - " tag: {}\n" + + " id:\n" + + " type: integer\n" + + " name:\n" + + " type: string\n" + + " tag:\n" + + " type: string\n" + " AnotherPet:\n" + - " title: Another Pet\n" + - " properties:\n" + - " category: {}\n" + - " photoUrl: {}\n" + + " $ref: '#/components/schemas/Pet'\n" + " description: Another Pet for petstore referencing Pet schema\n" + - " $ref: '#/components/schemas/Pet'"); + " properties:\n" + + " category:\n" + + " type: string\n" + + " photoUrl:\n" + + " type: string\n" + + " title: Another Pet\n"); SerializationMatchers.assertEqualsToYaml(openAPI, "openapi: 3.0.1\n" + "components:\n" + " schemas:\n" + " Pet:\n" + + " minimum: 1\n" + " properties:\n" + " id:\n" + " type: integer\n" + @@ -49,7 +74,8 @@ public void serializeRefSchema3_1() { " type: string\n" + " tag:\n" + " type: string\n" + + " format: whatever\n" + " AnotherPet:\n" + - " $ref: '#/components/schemas/Pet'"); + " $ref: '#/components/schemas/Pet'\n"); } } From f17b48ce29485b2eba9084cdb0fbeaffc6318e05 Mon Sep 17 00:00:00 2001 From: Beppe Catanese Date: Sat, 26 Mar 2022 23:25:11 +0100 Subject: [PATCH 72/79] Set regex pattern on array --- .../v3/core/jackson/ModelResolver.java | 6 ++++ .../swagger/v3/core/converting/PojoTest.java | 30 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java index 0178cfb423..3dcecd29de 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java @@ -1340,9 +1340,15 @@ protected void applyBeanValidatorAnnotations(Schema property, Annotation[] annot } if (annos.containsKey("javax.validation.constraints.Pattern")) { Pattern pattern = (Pattern) annos.get("javax.validation.constraints.Pattern"); + if (property instanceof StringSchema) { property.setPattern(pattern.regexp()); } + + if(property.getItems() != null && property.getItems() instanceof StringSchema) { + property.getItems().setPattern(pattern.regexp()); + } + } } diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java index 7a3f6e36e8..0c8be930a2 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java @@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import org.testng.annotations.Test; +import javax.validation.constraints.Pattern; import java.io.IOException; import java.lang.reflect.Type; import java.util.Date; @@ -645,6 +646,35 @@ public void setIds(String[] ids) { } } + @Test(description = "Shows how to provide an array with specific format") + public void testArrayWithPattern() { + + String yaml = + "modelArrayWithPattern:\n" + + " type: object\n" + + " properties:\n" + + " ids:\n" + + " type: array\n" + + " items:\n" + + " pattern: \"[a-zA-Z]*\"\n" + + " type: string"; + Map schemaMap = readAll(modelArrayWithPattern.class); + SerializationMatchers.assertEqualsToYaml(schemaMap, yaml); + } + + static class modelArrayWithPattern { + @Pattern(regexp="[a-zA-Z]*") + private String[] ids; + + public String[] getIds() { + return ids; + } + + public void setIds(String[] ids) { + this.ids = ids; + } + } + @Test(description = "Show how to completely override an object example") public void testModelExampleOverride() { From 0685b2c05d10afc903d189871eaef369ca207e3e Mon Sep 17 00:00:00 2001 From: Beppe Catanese Date: Mon, 28 Mar 2022 09:44:23 +0200 Subject: [PATCH 73/79] Add test with booleans --- .../swagger/v3/core/converting/PojoTest.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java index 0c8be930a2..65863f5ee7 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/PojoTest.java @@ -704,4 +704,50 @@ public void setId(String id) { } } + @Test + public void testModelWithBoolean() { + + String yaml = "ClassWithBoolean:\n" + + " required:\n" + + " - booleanObject\n" + + " - booleanType\n" + + " type: object\n" + + " properties:\n" + + " booleanObject:\n" + + " type: boolean\n" + + " description: my Boolean object field\n" + + " booleanType:\n" + + " type: boolean\n" + + " description: my boolean type field\n"; + SerializationMatchers.assertEqualsToYaml(read(ClassWithBoolean.class), yaml); + + } + + @Schema + static class ClassWithBoolean { + + @Schema(required = true, description = "my Boolean object field") + private Boolean booleanObject; + + @Schema(required = true, description = "my boolean type field") + private boolean booleanType; + + public Boolean getBooleanObject() { + return booleanObject; + } + + public void setBooleanObject(Boolean booleanObject) { + this.booleanObject = booleanObject; + } + + public boolean getBooleanType() { + return booleanType; + } + + public void setBooleanType(boolean booleanType) { + this.booleanType = booleanType; + } + } + + } From 8a7196b2620528464f3461e8a88d9b568774b727 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Fri, 4 Mar 2022 21:38:52 -0500 Subject: [PATCH 74/79] corrected @since annotations for newly introduced fields --- .../io/swagger/v3/oas/models/OpenAPI.java | 9 ++ .../io/swagger/v3/oas/models/info/Info.java | 6 + .../swagger/v3/oas/models/media/Schema.java | 125 +++++++++++++++++- 3 files changed, 138 insertions(+), 2 deletions(-) diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java index 76e21d5b59..0e4b8203e5 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java @@ -48,6 +48,9 @@ public class OpenAPI { private Components components = null; private java.util.Map extensions = null; + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private String jsonSchemaDialect; @@ -312,11 +315,17 @@ public OpenAPI addWebhooks(String key, PathItem pathItem) { return this; } + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public String getJsonSchemaDialect() { return jsonSchemaDialect; } + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setJsonSchemaDialect(String jsonSchemaDialect) { this.jsonSchemaDialect = jsonSchemaDialect; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java index 31193b8590..50a83c0399 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java @@ -164,11 +164,17 @@ public String getSummary() { return summary; } + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setSummary(String summary) { this.summary = summary; } + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Info summary(String summary) { this.summary = summary; 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 626a2dfd98..eb97a9c459 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 @@ -82,6 +82,10 @@ public class Schema { private Discriminator discriminator = null; private boolean exampleSetFlag; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private List prefixItems = null; private List allOf = null; @@ -113,57 +117,147 @@ public Schema specVersion(SpecVersion specVersion) { @OpenAPI31 fields and accessors */ - + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private Set types; + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private Map patternProperties = null; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private BigDecimal exclusiveMaximumValue = null; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private BigDecimal exclusiveMinimumValue = null; - + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private Schema contains = null; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private String $id; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private String $schema; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private String $anchor; + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private String contentEncoding; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private String contentMediaType; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private Schema contentSchema; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private Schema propertyNames; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private Object unevaluatedProperties; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private Integer maxContains; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private Integer minContains; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private Schema additionalItems; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private Schema unevaluatedItems; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private Schema _if; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private Schema _else; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private Schema then; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private Map dependentSchemas; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private Map> dependentRequired; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private String $comment; + + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 private List examples; @@ -428,38 +522,62 @@ public Schema types(Set types) { INTERNAL MEMBERS @OpenAPI31 */ + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 protected Map jsonSchema = null; + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Map getJsonSchema() { return jsonSchema; } + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setJsonSchema(Map jsonSchema) { this.jsonSchema = jsonSchema; } + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema jsonSchema(Map jsonSchema) { this.jsonSchema = jsonSchema; return this; } + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 protected transient Object jsonSchemaImpl = null; + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Object getJsonSchemaImpl() { return jsonSchemaImpl; } + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public void setJsonSchemaImpl(Object jsonSchemaImpl) { this.jsonSchemaImpl = jsonSchemaImpl; } + /** + * @since 2.2.0 (OpenAPI 3.1.0) + */ @OpenAPI31 public Schema jsonSchemaImpl(Object jsonSchemaImpl) { setJsonSchemaImpl(jsonSchemaImpl); @@ -1993,6 +2111,7 @@ public Schema exampleSetFlag(boolean exampleSetFlag) { * * @since 2.2.0 (OpenAPI 3.1.0) */ + @OpenAPI31 public T getConst() { return _const; } @@ -2001,6 +2120,7 @@ public T getConst() { * * @since 2.2.0 (OpenAPI 3.1.0) */ + @OpenAPI31 public void setConst(Object _const) { this._const = cast(_const); } @@ -2009,6 +2129,7 @@ public void setConst(Object _const) { * * @since 2.2.0 (OpenAPI 3.1.0) */ + @OpenAPI31 public Schema _const(Object _const) { this._const = cast(_const); return this; From 1dd6ce3f89a87bcbc629eab2ef19de92c3396b26 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Sat, 5 Mar 2022 03:18:25 -0500 Subject: [PATCH 75/79] added @see annotation on swagger-modules classes, pointing to 3.1.0 page --- .../src/main/java/io/swagger/v3/oas/models/Components.java | 1 + .../java/io/swagger/v3/oas/models/ExternalDocumentation.java | 1 + .../src/main/java/io/swagger/v3/oas/models/OpenAPI.java | 1 + .../src/main/java/io/swagger/v3/oas/models/Operation.java | 1 + .../src/main/java/io/swagger/v3/oas/models/PathItem.java | 1 + .../src/main/java/io/swagger/v3/oas/models/Paths.java | 1 + .../main/java/io/swagger/v3/oas/models/callbacks/Callback.java | 1 + .../main/java/io/swagger/v3/oas/models/examples/Example.java | 3 +++ .../src/main/java/io/swagger/v3/oas/models/headers/Header.java | 1 + .../src/main/java/io/swagger/v3/oas/models/info/Contact.java | 1 + .../src/main/java/io/swagger/v3/oas/models/info/Info.java | 1 + .../src/main/java/io/swagger/v3/oas/models/links/Link.java | 1 + .../java/io/swagger/v3/oas/models/parameters/Parameter.java | 1 + .../java/io/swagger/v3/oas/models/parameters/RequestBody.java | 1 + .../java/io/swagger/v3/oas/models/responses/ApiResponse.java | 1 + .../java/io/swagger/v3/oas/models/responses/ApiResponses.java | 1 + .../main/java/io/swagger/v3/oas/models/security/OAuthFlow.java | 1 + .../java/io/swagger/v3/oas/models/security/OAuthFlows.java | 1 + .../io/swagger/v3/oas/models/security/SecurityRequirement.java | 1 + .../java/io/swagger/v3/oas/models/security/SecurityScheme.java | 1 + .../src/main/java/io/swagger/v3/oas/models/servers/Server.java | 1 + .../java/io/swagger/v3/oas/models/servers/ServerVariable.java | 1 + .../src/main/java/io/swagger/v3/oas/models/tags/Tag.java | 1 + 23 files changed, 25 insertions(+) diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java index 662d6e54cd..f32a607f59 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java @@ -35,6 +35,7 @@ * Components * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#componentsObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#componentsObject" */ public class Components { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java index e1fe227a12..85ed62dc88 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java @@ -24,6 +24,7 @@ * ExternalDocumentation * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#externalDocumentationObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#externalDocumentationObject" */ public class ExternalDocumentation { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java index 0e4b8203e5..04fcc0c5cb 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java @@ -35,6 +35,7 @@ * OpenAPI * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md" */ public class OpenAPI { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java index e7e641e1a0..76b7e3134d 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java @@ -34,6 +34,7 @@ * Operation * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#operationObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#operationObject" */ public class Operation { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java index b44d1c1b40..fb6492c58c 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java @@ -29,6 +29,7 @@ * PathItem * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#pathItemObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#pathItemObject" */ public class PathItem { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java index af9e45a209..d787e68b12 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java @@ -25,6 +25,7 @@ * Paths * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#pathsObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#pathsObject" */ public class Paths extends LinkedHashMap { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java index cda3eb83e6..27f3cdd928 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java @@ -26,6 +26,7 @@ * Callback * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#callbackObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#callbackObject" */ public class Callback extends LinkedHashMap { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java index 211ddbabf9..556a68bf0e 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java @@ -20,6 +20,9 @@ /** * Example + * + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#exampleObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#exampleObject" */ public class Example { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java index 6d380f7f31..b7f38a0cdd 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java @@ -28,6 +28,7 @@ * Header * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#headerObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#headerObject" */ public class Header { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java index 172988ade2..c81024e384 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java @@ -24,6 +24,7 @@ * Contact * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#contactObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#contactObject" */ public class Contact { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java index 50a83c0399..bff4a59d6b 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java @@ -22,6 +22,7 @@ /** * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#infoObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#infoObject" */ public class Info { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java index aa2f75430c..abe5bc53fe 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java @@ -27,6 +27,7 @@ * Link * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#linkObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#linkObject" */ public class Link { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java index b6d56a3566..19b16bf827 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java @@ -29,6 +29,7 @@ * Parameter * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#parameterObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#parameterObject" */ public class Parameter { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java index 947eaabf9a..f906b6bab2 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java @@ -23,6 +23,7 @@ * RequestBody * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#requestBodyObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#requestBodyObject" */ public class RequestBody { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java index cc6087a0a3..6f59cf2dcd 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java @@ -29,6 +29,7 @@ * ApiResponse * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#responseObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#responseObject" */ public class ApiResponse { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java index 03c2a4c18e..e118a169f2 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java @@ -25,6 +25,7 @@ * ApiResponses * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#responsesObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#responsesObject" */ public class ApiResponses extends LinkedHashMap { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java index 0c2329e730..0adeb3ef4e 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java @@ -24,6 +24,7 @@ * OAuthFlow * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#oauthFlowsObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#oauthFlowsObject" */ public class OAuthFlow { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java index 7d31965273..b3d4343e60 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java @@ -24,6 +24,7 @@ * OAuthFlows * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#oauthFlowsObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#oauthFlowsObject" */ public class OAuthFlows { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityRequirement.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityRequirement.java index 5ccc7cae83..4119498792 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityRequirement.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityRequirement.java @@ -26,6 +26,7 @@ * SecurityRequirement * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#securityRequirementObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#securityRequirementObject" */ public class SecurityRequirement extends LinkedHashMap> { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java index 55c2aae5c7..f42e71ec3c 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java @@ -22,6 +22,7 @@ * SecurityScheme * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#securitySchemeObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#securitySchemeObject" */ public class SecurityScheme { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java index 5ada32920c..a3dc20cca3 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java @@ -24,6 +24,7 @@ * Server * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#serverObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#serverObject" */ public class Server { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java index aeff3dbaf2..37dfd2f8e1 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java @@ -26,6 +26,7 @@ * ServerVariable * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#serverVariableObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#serverVariableObject" */ public class ServerVariable { diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java index 1e5cc6a041..bed0faf23c 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java @@ -25,6 +25,7 @@ * Tag * * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#tagObject" + * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#tagObject" */ public class Tag { From d9e0a90168db07b9a2a3bd7749542353583ef8de Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Mon, 7 Mar 2022 04:26:01 +0100 Subject: [PATCH 76/79] removed commented code and unused imports on swagger-core modules --- .../swagger/v3/core/jackson/ModelResolver.java | 7 ------- .../swagger/v3/core/jackson/SwaggerModule.java | 6 ------ .../v3/core/jackson/mixin/MediaTypeMixin.java | 16 ++++++++++++++++ .../v3/core/jackson/mixin/Schema31Mixin.java | 1 - .../swagger/v3/core/util/AnnotationsUtils.java | 6 +----- .../v3/core/util/Callback31Deserializer.java | 13 ------------- .../v3/core/converting/ModelConverterTest.java | 1 - .../core/converting/SwaggerSerializerTest.java | 4 ---- .../override/SnakeCaseConverterTest.java | 3 --- .../v3/core/matchers/SerializationMatchers.java | 3 --- .../java/io/swagger/v3/core/oas/models/Cat.java | 2 +- .../io/swagger/v3/core/oas/models/Employee.java | 8 ++------ .../v3/core/resolving/ComplexPropertyTest.java | 6 ------ .../v3/core/resolving/HiddenFieldTest.java | 1 - .../v3/core/resolving/InheritedBeanTest.java | 8 ++------ .../properties/PropertySerializationTest.java | 1 - .../oas/integration/GenericOpenApiContext.java | 2 -- .../v3/oas/integration/IntegrationTest.java | 2 -- .../main/java/io/swagger/v3/jaxrs2/Reader.java | 1 - .../io/swagger/v3/jaxrs2/util/ServletUtils.java | 1 - .../com/my/sorted/resources/SortedThing.java | 2 -- .../ContainerTypeSchemaTicket2636Test.java | 1 - .../test/java/io/swagger/v3/jaxrs2/EnumTest.java | 2 -- .../v3/jaxrs2/integration/SortedOutputTest.java | 2 -- .../jaxrs2/it/resources/OctetStreamResource.java | 2 -- .../petstore/operation/OperationResource.java | 1 - .../petstore/responses/NoResponseResource.java | 3 --- .../v3/jaxrs2/resources/RefExamplesResource.java | 4 ---- .../jaxrs2/resources/RefRequestBodyResource.java | 3 --- .../v3/jaxrs2/resources/Ticket2340Resource.java | 1 - .../v3/jaxrs2/resources/Ticket2806Resource.java | 3 --- .../v3/jaxrs2/resources/UserAnnotation.java | 3 --- .../maven/petstore/petstore/PetResource.java | 1 - .../OpenAPIDefinitionResource.java | 12 ------------ .../v3/plugin/maven/resources/MyFilter.java | 2 -- .../maven/resources/model/ExtensionUser.java | 1 - .../v3/plugin/maven/resources/model/User.java | 1 - 37 files changed, 22 insertions(+), 114 deletions(-) diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java index 3dcecd29de..3a718f711f 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java @@ -328,9 +328,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context } if (isPrimitive) { - if (annotatedType.isSchemaProperty()) { - //model.name(name); - } XML xml = resolveXml(beanDesc.getClassInfo(), annotatedType.getCtxAnnotations(), resolvedSchemaAnnotation); if (xml != null) { model.xml(xml); @@ -435,7 +432,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context Schema mapModel = new MapSchema().additionalProperties(addPropertiesSchema); mapModel.name(name); model = mapModel; - //return model; } else if (valueType != null) { if (ReflectionUtils.isSystemType(type) && !annotatedType.isSchemaProperty() && !annotatedType.isResolveAsRef()) { context.resolve(new AnnotatedType().type(valueType).jsonViewAnnotation(annotatedType.getJsonViewAnnotation())); @@ -634,7 +630,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context AnnotatedType aType = new AnnotatedType() .type(propType) .ctxAnnotations(annotations) - //.name(propName) .parent(model) .resolveAsRef(annotatedType.isResolveAsRef()) .jsonViewAnnotation(annotatedType.getJsonViewAnnotation()) @@ -654,8 +649,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context return null; } else { return new Schema(); - //t.jsonUnwrappedHandler(null); - //return context.resolve(t); } }); property = clone(context.resolve(aType)); diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/SwaggerModule.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/SwaggerModule.java index 9de072e838..695391a031 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/SwaggerModule.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/SwaggerModule.java @@ -5,12 +5,6 @@ public class SwaggerModule extends SimpleModule { private static final long serialVersionUID = 1L; - /* - /********************************************************** - /* Life-cycle - /********************************************************** - */ - public SwaggerModule() { super(PackageVersion.VERSION); } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/MediaTypeMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/MediaTypeMixin.java index a189022694..6d19989572 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/MediaTypeMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/MediaTypeMixin.java @@ -1,3 +1,19 @@ +/** + * Copyright 2021 SmartBear Software + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.swagger.v3.core.jackson.mixin; import com.fasterxml.jackson.annotation.JsonAnyGetter; diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java index 67dcfd015c..78ad16bfa4 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java @@ -19,7 +19,6 @@ @JsonPropertyOrder(value = {"type", "format", "if", "then", "else"}, alphabetic = true) public abstract class Schema31Mixin { - //@JsonValue @JsonIgnore public abstract Map getJsonSchema(); diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java index 677ba11dfe..f63b82961b 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java @@ -942,10 +942,7 @@ public static Optional

getHeader(io.swagger.v3.oas.annotations.headers.H if (header.schema() != null) { if (header.schema().implementation().equals(Void.class)) { AnnotationsUtils.getSchemaFromAnnotation(header.schema(), jsonViewAnnotation).ifPresent( - headerObject::setSchema - //schema inline no need to add to components - //components.addSchemas(schema.getType(), schema); - ); + headerObject::setSchema); } } @@ -1445,7 +1442,6 @@ else if (tS != null && cS == null && cA == null) { } else if (tS != null && cS != null) { - //return mergeSchemaAnnotations(cS, tS); return mergeSchemaAnnotations(tS, cS); } diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Callback31Deserializer.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Callback31Deserializer.java index aae9fd1bf1..136f15ee99 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Callback31Deserializer.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/Callback31Deserializer.java @@ -1,18 +1,5 @@ package io.swagger.v3.core.util; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import io.swagger.v3.oas.models.PathItem; - -import javax.security.auth.callback.Callback; -import java.io.IOException; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; - public class Callback31Deserializer extends CallbackDeserializer { public Callback31Deserializer() { diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/ModelConverterTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/ModelConverterTest.java index dd03bf992c..aa6f886519 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/ModelConverterTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/ModelConverterTest.java @@ -182,7 +182,6 @@ public void processModelWithPairProperties() { ModelConverters.getInstance().addConverter(asPropertyConverter); final Map asProperty = readAll(ModelWithTuple2.class); ModelConverters.getInstance().removeConverter(asPropertyConverter); - //assertEquals(asProperty.size(), 2); Map values = asProperty.get("ModelWithTuple2").getProperties(); Yaml.prettyPrint(values); for (Map.Entry entry : values.entrySet()) { diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/SwaggerSerializerTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/SwaggerSerializerTest.java index 0a73bcfd03..75a6860688 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/SwaggerSerializerTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/SwaggerSerializerTest.java @@ -159,8 +159,6 @@ public void writeSpecWithParameterReferences() throws IOException { final OpenAPI swagger = new OpenAPI() .info(info) .addServersItem(new Server().url("http://petstore.swagger.io")) - //.consumes("application/json") - //.produces("application/json") .schema("Person", personModel); final QueryParameter parameter = (QueryParameter) new QueryParameter() @@ -169,10 +167,8 @@ public void writeSpecWithParameterReferences() throws IOException { .schema(new IntegerSchema()); final Operation get = new Operation() - //.produces("application/json") .summary("finds pets in the system") .description("a longer description") - //.tag("Pet Operations") .operationId("get pet by id") .addParametersItem(new Parameter().$ref("#/parameters/Foo")); diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/override/SnakeCaseConverterTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/override/SnakeCaseConverterTest.java index 2fe5710fdd..7ebc2cdfe3 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/override/SnakeCaseConverterTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/converting/override/SnakeCaseConverterTest.java @@ -13,13 +13,10 @@ import org.testng.annotations.Test; import javax.xml.bind.annotation.XmlRootElement; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; -import java.util.function.BiFunction; import static io.swagger.v3.core.util.RefUtils.constructRef; import static io.swagger.v3.core.util.RefUtils.extractSimpleName; diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/matchers/SerializationMatchers.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/matchers/SerializationMatchers.java index 75771ba588..9588434c96 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/matchers/SerializationMatchers.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/matchers/SerializationMatchers.java @@ -1,6 +1,5 @@ package io.swagger.v3.core.matchers; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.NumericNode; @@ -46,7 +45,6 @@ private static void apply(Object objectToSerialize, String str, ObjectMapper map } if (!lhs.equals(new ObjectNodeComparator(), rhs)) { assertEquals(Yaml.pretty(lhs), Yaml.pretty(rhs)); - //fail(String.format("Serialized object:\n%s\ndoes not equal to expected serialized string:\n%s", lhs, rhs)); } } @@ -60,7 +58,6 @@ private static void apply31(Object objectToSerialize, String str, ObjectMapper m } if (!lhs.equals(new ObjectNodeComparator(), rhs)) { assertEquals(Yaml31.pretty(lhs), Yaml31.pretty(rhs)); - //fail(String.format("Serialized object:\n%s\ndoes not equal to expected serialized string:\n%s", lhs, rhs)); } } diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/oas/models/Cat.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/oas/models/Cat.java index 32f937fe37..88a37c0f61 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/oas/models/Cat.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/oas/models/Cat.java @@ -3,7 +3,7 @@ import io.swagger.v3.core.oas.models.composition.Pet; import io.swagger.v3.oas.annotations.media.Schema; -@Schema//(parent = Pet.class) +@Schema public interface Cat extends Pet { Integer getClawCount(); diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/oas/models/Employee.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/oas/models/Employee.java index 8064f8c4ea..268588e8b7 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/oas/models/Employee.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/oas/models/Employee.java @@ -37,9 +37,7 @@ public Employee() { @XmlElement @JsonProperty - @Schema( -// access = "public", - description = "Note, this is server generated.", title = "Read-only") + @Schema(description = "Note, this is server generated.", title = "Read-only") public int getId() { return id; } @@ -50,9 +48,7 @@ public void setId(int id) { @XmlElement @JsonProperty - @Schema( -// access = "public", - required = true) + @Schema(required = true) public String getFirstName() { return firstName; } diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/ComplexPropertyTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/ComplexPropertyTest.java index 7c2277f9ad..0a77b6905e 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/ComplexPropertyTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/ComplexPropertyTest.java @@ -24,12 +24,6 @@ static class OuterBean { public InnerBean inner; } - /* - /********************************************************** - /* Test methods - /********************************************************** - */ - static class InnerBean { public int d; public int a; diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/HiddenFieldTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/HiddenFieldTest.java index 0c89bd3613..a0e9ccca00 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/HiddenFieldTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/HiddenFieldTest.java @@ -3,7 +3,6 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.core.converter.ModelConverters; -import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.models.media.IntegerSchema; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.StringSchema; diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/InheritedBeanTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/InheritedBeanTest.java index b9fa569308..5a276f5f4f 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/InheritedBeanTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/InheritedBeanTest.java @@ -218,9 +218,7 @@ static class Sub1Bean extends BaseBean { @JsonTypeInfo(include = JsonTypeInfo.As.PROPERTY, use = JsonTypeInfo.Id.NAME, property = "type", visible = true) @JsonSubTypes({@JsonSubTypes.Type(value = Sub2Bean.class, name = "sub2")}) - @io.swagger.v3.oas.annotations.media.Schema(description = "BaseBean2" -// , discriminator = "type", subTypes = {Sub1Bean.class} - ) + @io.swagger.v3.oas.annotations.media.Schema(description = "BaseBean2") static class BaseBean2 { public String type; public int a; @@ -377,9 +375,7 @@ private void assertSub2PropertiesValid(Map subProperties) { @JsonSubTypes.Type(value = MultipleSub1Bean.class, name = "multipleSub1"), @JsonSubTypes.Type(value = MultipleSub2Bean.class, name = "multipleSub2") }) - @io.swagger.v3.oas.annotations.media.Schema(description = "MultipleBaseBean" -// , discriminator = "type", subTypes = {MultipleSub1Bean.class, MultipleSub2Bean.class} - ) + @io.swagger.v3.oas.annotations.media.Schema(description = "MultipleBaseBean") static class MultipleBaseBean { public String type; public int a; diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/properties/PropertySerializationTest.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/properties/PropertySerializationTest.java index 1ca98f4bf2..719b936be1 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/properties/PropertySerializationTest.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/serialization/properties/PropertySerializationTest.java @@ -6,7 +6,6 @@ import io.swagger.v3.oas.models.media.BooleanSchema; import io.swagger.v3.oas.models.media.DateSchema; import io.swagger.v3.oas.models.media.DateTimeSchema; -import io.swagger.v3.oas.models.media.FileSchema; import io.swagger.v3.oas.models.media.IntegerSchema; import io.swagger.v3.oas.models.media.MapSchema; import io.swagger.v3.oas.models.media.NumberSchema; diff --git a/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/GenericOpenApiContext.java b/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/GenericOpenApiContext.java index a62b20c3e7..6e33dd04b9 100644 --- a/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/GenericOpenApiContext.java +++ b/modules/swagger-integration/src/main/java/io/swagger/v3/oas/integration/GenericOpenApiContext.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -709,7 +708,6 @@ static abstract class SortedSchemaMixin31 { @JsonPropertyOrder(alphabetic = true) public abstract Map getExtensions(); - //@JsonValue @JsonIgnore public abstract Map getJsonSchema(); diff --git a/modules/swagger-integration/src/test/java/io/swagger/v3/oas/integration/IntegrationTest.java b/modules/swagger-integration/src/test/java/io/swagger/v3/oas/integration/IntegrationTest.java index dcbe551b7d..b061aaa7ee 100644 --- a/modules/swagger-integration/src/test/java/io/swagger/v3/oas/integration/IntegrationTest.java +++ b/modules/swagger-integration/src/test/java/io/swagger/v3/oas/integration/IntegrationTest.java @@ -28,8 +28,6 @@ public void shouldInitialize() throws Exception { OpenApiContext ctx = new GenericOpenApiContext() .openApiConfiguration(config) - //.openApiReader() - //.openApiReader() .init(); OpenAPI openApi = ctx.read(); diff --git a/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/Reader.java b/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/Reader.java index 95098f0427..c15689ca92 100644 --- a/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/Reader.java +++ b/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/Reader.java @@ -758,7 +758,6 @@ protected void processRequestBody(Parameter requestBodyParameter, Operation oper isRequestBodyEmpty = false; } if (!isRequestBodyEmpty) { - //requestBody.setExtensions(extensions); operation.setRequestBody(requestBody); } } diff --git a/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/util/ServletUtils.java b/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/util/ServletUtils.java index 5abfeeef9e..2865ddafda 100644 --- a/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/util/ServletUtils.java +++ b/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/util/ServletUtils.java @@ -1,6 +1,5 @@ package io.swagger.v3.jaxrs2.util; -import io.swagger.v3.jaxrs2.integration.OpenApiServlet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/swagger-jaxrs2/src/test/java/com/my/sorted/resources/SortedThing.java b/modules/swagger-jaxrs2/src/test/java/com/my/sorted/resources/SortedThing.java index cd3fa9a2b5..38febff4e3 100644 --- a/modules/swagger-jaxrs2/src/test/java/com/my/sorted/resources/SortedThing.java +++ b/modules/swagger-jaxrs2/src/test/java/com/my/sorted/resources/SortedThing.java @@ -2,11 +2,9 @@ import io.swagger.v3.jaxrs2.resources.model.Pet; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; import javax.ws.rs.GET; import javax.ws.rs.Path; -import java.util.ArrayList; @Path("/sorted") public class SortedThing { diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/ContainerTypeSchemaTicket2636Test.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/ContainerTypeSchemaTicket2636Test.java index 557807821b..0d8a5720a7 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/ContainerTypeSchemaTicket2636Test.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/ContainerTypeSchemaTicket2636Test.java @@ -1,7 +1,6 @@ package io.swagger.v3.jaxrs2; import io.swagger.v3.jaxrs2.annotations.AbstractAnnotationTest; -import io.swagger.v3.jaxrs2.matchers.SerializationMatchers; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/EnumTest.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/EnumTest.java index 25bfbfcce4..a0d90c52b6 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/EnumTest.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/EnumTest.java @@ -2,8 +2,6 @@ import io.swagger.v3.jaxrs2.matchers.SerializationMatchers; import io.swagger.v3.jaxrs2.resources.EnumParameterResource; -import io.swagger.v3.jaxrs2.resources.JsonIdentityCyclicResource; -import io.swagger.v3.jaxrs2.resources.JsonIdentityResource; import io.swagger.v3.oas.models.OpenAPI; import org.testng.annotations.Test; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/integration/SortedOutputTest.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/integration/SortedOutputTest.java index 7c8074e5f7..5ca7b8ebb9 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/integration/SortedOutputTest.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/integration/SortedOutputTest.java @@ -11,10 +11,8 @@ import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import io.swagger.v3.core.jackson.PathsSerializer; -import io.swagger.v3.core.util.Yaml; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.integration.GenericOpenApiContext; import io.swagger.v3.oas.integration.SwaggerConfiguration; import io.swagger.v3.oas.integration.api.ObjectMapperProcessor; import io.swagger.v3.oas.integration.api.OpenApiContext; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/it/resources/OctetStreamResource.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/it/resources/OctetStreamResource.java index ac8f049ac2..9fb3316667 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/it/resources/OctetStreamResource.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/it/resources/OctetStreamResource.java @@ -5,8 +5,6 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; import javax.ws.rs.Consumes; -import javax.ws.rs.FormParam; -import javax.ws.rs.GET; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.Produces; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/petstore/operation/OperationResource.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/petstore/operation/OperationResource.java index f460e8e744..f7860c1257 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/petstore/operation/OperationResource.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/petstore/operation/OperationResource.java @@ -7,7 +7,6 @@ import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.HEAD; import javax.ws.rs.NotFoundException; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/petstore/responses/NoResponseResource.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/petstore/responses/NoResponseResource.java index c3cf94f66b..259eef5ceb 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/petstore/responses/NoResponseResource.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/petstore/responses/NoResponseResource.java @@ -1,14 +1,11 @@ package io.swagger.v3.jaxrs2.petstore.responses; import io.swagger.v3.jaxrs2.resources.exception.NotFoundException; -import io.swagger.v3.jaxrs2.resources.model.Pet; import io.swagger.v3.jaxrs2.resources.model.User; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.responses.ApiResponse; import javax.ws.rs.GET; import javax.ws.rs.Path; -import javax.ws.rs.core.Response; /** * Resource with a Response at Method Level diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/RefExamplesResource.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/RefExamplesResource.java index 9b34ac0b20..43745f1c0b 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/RefExamplesResource.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/RefExamplesResource.java @@ -1,16 +1,12 @@ package io.swagger.v3.jaxrs2.resources; import io.swagger.v3.jaxrs2.petstore.example.SubscriptionResponse; -import io.swagger.v3.jaxrs2.resources.model.User; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.enums.ParameterStyle; -import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.parameters.RequestBody; -import io.swagger.v3.oas.annotations.responses.ApiResponse; import javax.ws.rs.POST; import javax.ws.rs.Path; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/RefRequestBodyResource.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/RefRequestBodyResource.java index 5cdb2d2d1c..b2f9d92717 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/RefRequestBodyResource.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/RefRequestBodyResource.java @@ -2,10 +2,7 @@ import io.swagger.v3.jaxrs2.resources.model.User; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.parameters.RequestBody; -import io.swagger.v3.oas.annotations.responses.ApiResponse; import javax.ws.rs.GET; import javax.ws.rs.Path; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/Ticket2340Resource.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/Ticket2340Resource.java index f3efa18bec..87b1a2a3bf 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/Ticket2340Resource.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/Ticket2340Resource.java @@ -31,7 +31,6 @@ public String getAnimal(Animal animal) { @JsonSubTypes.Type(value = Cat.class, name = "cat") }) public static class Animal { - //public String type; } @JsonTypeName("dog") diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/Ticket2806Resource.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/Ticket2806Resource.java index c329d40c5e..f35981c225 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/Ticket2806Resource.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/Ticket2806Resource.java @@ -1,13 +1,10 @@ package io.swagger.v3.jaxrs2.resources; import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; import javax.ws.rs.GET; import javax.ws.rs.Path; -import javax.ws.rs.core.MediaType; public class Ticket2806Resource { diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/UserAnnotation.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/UserAnnotation.java index 3efc6aa063..9cb41e4025 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/UserAnnotation.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/UserAnnotation.java @@ -17,12 +17,9 @@ package io.swagger.v3.jaxrs2.resources; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.extensions.Extension; -import io.swagger.v3.oas.annotations.info.Info; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Operation(tags = {"test"}) diff --git a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/petstore/petstore/PetResource.java b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/petstore/petstore/PetResource.java index e6b2be94dc..2cebf2303f 100644 --- a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/petstore/petstore/PetResource.java +++ b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/petstore/petstore/PetResource.java @@ -25,7 +25,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.plugin.maven.resources.QueryResultBean; import javax.ws.rs.BeanParam; import javax.ws.rs.Consumes; diff --git a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/petstore/petstore/openapidefintion/OpenAPIDefinitionResource.java b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/petstore/petstore/openapidefintion/OpenAPIDefinitionResource.java index a6a2b6604e..8c6e90483c 100644 --- a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/petstore/petstore/openapidefintion/OpenAPIDefinitionResource.java +++ b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/petstore/petstore/openapidefintion/OpenAPIDefinitionResource.java @@ -6,8 +6,6 @@ import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.info.License; import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.servers.Server; -import io.swagger.v3.oas.annotations.servers.ServerVariable; import io.swagger.v3.oas.annotations.tags.Tag; /** @@ -32,16 +30,6 @@ @SecurityRequirement(name = "req 1", scopes = {"a", "b"}), @SecurityRequirement(name = "req 2", scopes = {"b", "c"}) } -/* , - servers = { - @Server( - description = "server 1", - url = "http://foo", - variables = { - @ServerVariable(name = "var1", description = "var 1", defaultValue = "1", allowableValues = {"1", "2"}), - @ServerVariable(name = "var2", description = "var 2", defaultValue = "1", allowableValues = {"1", "2"}) - }) - }*/ ) public class OpenAPIDefinitionResource { public void foo() { diff --git a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/MyFilter.java b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/MyFilter.java index a76aaef01f..bb8eb86e63 100644 --- a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/MyFilter.java +++ b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/MyFilter.java @@ -22,8 +22,6 @@ public Optional filterOpenAPI( Map> headers) { openAPI.getInfo().setTitle("UPDATEDBYFILTER"); return Optional.of(openAPI); - // some processing - //return super.filterOpenAPI(openAPI, params, cookies, headers); } @Override diff --git a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/ExtensionUser.java b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/ExtensionUser.java index 210c56a332..5256c7c764 100644 --- a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/ExtensionUser.java +++ b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/ExtensionUser.java @@ -108,7 +108,6 @@ public void setPhone(String phone) { } @XmlElement(name = "userStatus") - //@Schema(description = "User Status", type = "string", allowableValues = {"1-registered", "2-active", "3-closed"}) @Schema( description = "User Status", allowableValues = "1-registered,2-active,3-closed", diff --git a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/User.java b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/User.java index 248d713160..4538556503 100644 --- a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/User.java +++ b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/User.java @@ -96,7 +96,6 @@ public void setPhone(String phone) { } @XmlElement(name = "userStatus") - //@Schema(description = "User Status", type = "string", allowableValues = {"1-registered", "2-active", "3-closed"}) @Schema(description = "User Status", allowableValues = "1-registered,2-active,3-closed") public int getUserStatus() { return userStatus; From dc149220f3e4ca09935364125088558d69b516ca Mon Sep 17 00:00:00 2001 From: frantuma Date: Mon, 28 Mar 2022 21:32:15 +0200 Subject: [PATCH 77/79] update LICENSE and NOTICE --- LICENSE | 3 +- NOTICE | 4 + modules/swagger-project-jakarta/LICENSE | 202 ++++++++++++++++++++++++ modules/swagger-project-jakarta/NOTICE | 4 + modules/swagger-project-jakarta/pom.xml | 10 ++ pom.xml | 8 + 6 files changed, 230 insertions(+), 1 deletion(-) create mode 100644 NOTICE create mode 100644 modules/swagger-project-jakarta/LICENSE create mode 100644 modules/swagger-project-jakarta/NOTICE diff --git a/LICENSE b/LICENSE index 01abb442b9..afdeac5bfa 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,4 @@ + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -186,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 SmartBear Software Inc. + Copyright (c) 2015. SmartBear Software Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000000..b338555543 --- /dev/null +++ b/NOTICE @@ -0,0 +1,4 @@ +Swagger Core +Copyright (c) 2015. SmartBear Software Inc. +Swagger Core is licensed under Apache 2.0 license. +Copy of the Apache 2.0 license can be found in `LICENSE` file. diff --git a/modules/swagger-project-jakarta/LICENSE b/modules/swagger-project-jakarta/LICENSE new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/modules/swagger-project-jakarta/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/modules/swagger-project-jakarta/NOTICE b/modules/swagger-project-jakarta/NOTICE new file mode 100644 index 0000000000..b338555543 --- /dev/null +++ b/modules/swagger-project-jakarta/NOTICE @@ -0,0 +1,4 @@ +Swagger Core +Copyright (c) 2015. SmartBear Software Inc. +Swagger Core is licensed under Apache 2.0 license. +Copy of the Apache 2.0 license can be found in `LICENSE` file. diff --git a/modules/swagger-project-jakarta/pom.xml b/modules/swagger-project-jakarta/pom.xml index 021ddc751a..25760aa8d4 100644 --- a/modules/swagger-project-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/pom.xml @@ -54,6 +54,16 @@ install target ${project.artifactId}-${project.version} + + + META-INF + . + + NOTICE + LICENSE + + + maven-compiler-plugin diff --git a/pom.xml b/pom.xml index 8257e5f836..92c5d781e2 100644 --- a/pom.xml +++ b/pom.xml @@ -66,6 +66,14 @@ logback.xml + + META-INF + . + + NOTICE + LICENSE + + From 364932726b2b9f2e00db763ccd5ed4a1d0ddd270 Mon Sep 17 00:00:00 2001 From: frantuma Date: Mon, 28 Mar 2022 21:49:30 +0200 Subject: [PATCH 78/79] remove copyright header --- .../oas/annotations/ExternalDocumentation.java | 16 ---------------- .../io/swagger/v3/oas/annotations/Hidden.java | 16 ---------------- .../v3/oas/annotations/OpenAPIDefinition.java | 16 ---------------- .../swagger/v3/oas/annotations/Operation.java | 16 ---------------- .../swagger/v3/oas/annotations/Parameter.java | 16 ---------------- .../swagger/v3/oas/annotations/Parameters.java | 15 --------------- .../v3/oas/annotations/callbacks/Callback.java | 16 ---------------- .../oas/annotations/callbacks/Callbacks.java | 18 +----------------- .../oas/annotations/extensions/Extensions.java | 18 +----------------- .../v3/oas/annotations/headers/Header.java | 16 ---------------- .../v3/oas/annotations/info/Contact.java | 16 ---------------- .../swagger/v3/oas/annotations/info/Info.java | 16 ---------------- .../v3/oas/annotations/info/License.java | 16 ---------------- .../swagger/v3/oas/annotations/links/Link.java | 16 ---------------- .../oas/annotations/links/LinkParameter.java | 16 ---------------- .../v3/oas/annotations/media/Content.java | 16 ---------------- .../media/DiscriminatorMapping.java | 16 ---------------- .../v3/oas/annotations/media/Encoding.java | 16 ---------------- .../oas/annotations/media/ExampleObject.java | 16 ---------------- .../annotations/media/PatternProperties.java | 16 ---------------- .../oas/annotations/media/PatternProperty.java | 16 ---------------- .../v3/oas/annotations/media/Schema.java | 16 ---------------- .../annotations/media/SchemaProperties.java | 16 ---------------- .../oas/annotations/media/SchemaProperty.java | 16 ---------------- .../annotations/parameters/RequestBody.java | 18 +----------------- .../oas/annotations/responses/ApiResponse.java | 16 ---------------- .../annotations/responses/ApiResponses.java | 18 +----------------- .../v3/oas/annotations/security/OAuthFlow.java | 16 ---------------- .../oas/annotations/security/OAuthFlows.java | 16 ---------------- .../oas/annotations/security/OAuthScope.java | 16 ---------------- .../security/SecurityRequirement.java | 16 ---------------- .../security/SecurityRequirements.java | 18 +----------------- .../annotations/security/SecurityScheme.java | 16 ---------------- .../annotations/security/SecuritySchemes.java | 18 +----------------- .../v3/oas/annotations/servers/Server.java | 16 ---------------- .../annotations/servers/ServerVariable.java | 16 ---------------- .../v3/oas/annotations/servers/Servers.java | 15 --------------- .../swagger/v3/oas/annotations/tags/Tag.java | 16 ---------------- .../swagger/v3/oas/annotations/tags/Tags.java | 16 ---------------- .../v3/core/jackson/mixin/MediaTypeMixin.java | 16 ---------------- .../v3/core/resolving/v31/model/Category.java | 16 ---------------- .../resolving/v31/model/ExtensionUser.java | 16 ---------------- .../v3/core/resolving/v31/model/Tag.java | 16 ---------------- .../v3/core/resolving/v31/model/User.java | 16 ---------------- .../plugins/gradle/petstore/PetResource.java | 16 ---------------- .../gradle/resources/QueryResultBean.java | 16 ---------------- .../plugins/gradle/resources/data/PetData.java | 18 +----------------- .../gradle/resources/data/UserData.java | 18 +----------------- .../resources/exception/ApiException.java | 16 ---------------- .../resources/exception/NotFoundException.java | 16 ---------------- .../gradle/resources/model/Category.java | 18 +----------------- .../gradle/resources/model/ExtensionUser.java | 18 +----------------- .../v3/plugins/gradle/resources/model/Tag.java | 18 +----------------- .../plugins/gradle/resources/model/User.java | 18 +----------------- .../annotations/encoding/EncodingTest.java | 11 ----------- .../v3/jaxrs2/petstore/PetResource.java | 16 ---------------- .../resources/HiddenAnnotatedUserResource.java | 16 ---------------- .../jaxrs2/resources/HiddenUserResource.java | 16 ---------------- .../v3/jaxrs2/resources/PetResource.java | 16 ---------------- .../resources/PetResourceSlashesinPath.java | 16 ---------------- .../v3/jaxrs2/resources/QueryResultBean.java | 16 ---------------- .../jaxrs2/resources/SimpleUserResource.java | 16 ---------------- .../v3/jaxrs2/resources/UserAnnotation.java | 16 ---------------- .../v3/jaxrs2/resources/UserResource.java | 16 ---------------- .../v3/jaxrs2/resources/data/PetData.java | 18 +----------------- .../v3/jaxrs2/resources/data/UserData.java | 18 +----------------- .../resources/exception/ApiException.java | 16 ---------------- .../resources/exception/NotFoundException.java | 16 ---------------- .../v3/jaxrs2/resources/model/Category.java | 18 +----------------- .../jaxrs2/resources/model/ExtensionUser.java | 18 +----------------- .../swagger/v3/jaxrs2/resources/model/Tag.java | 18 +----------------- .../v3/jaxrs2/resources/model/User.java | 18 +----------------- .../maven/petstore/petstore/PetResource.java | 16 ---------------- .../maven/resources/QueryResultBean.java | 16 ---------------- .../plugin/maven/resources/data/PetData.java | 18 +----------------- .../plugin/maven/resources/data/UserData.java | 18 +----------------- .../resources/exception/ApiException.java | 16 ---------------- .../resources/exception/NotFoundException.java | 16 ---------------- .../plugin/maven/resources/model/Category.java | 18 +----------------- .../maven/resources/model/ExtensionUser.java | 18 +----------------- .../v3/plugin/maven/resources/model/Tag.java | 18 +----------------- .../v3/plugin/maven/resources/model/User.java | 18 +----------------- .../swagger/v3/oas/annotations/OpenAPI30.java | 16 ---------------- .../swagger/v3/oas/annotations/OpenAPI31.java | 16 ---------------- .../io/swagger/v3/oas/models/Components.java | 16 ---------------- .../v3/oas/models/ExternalDocumentation.java | 16 ---------------- .../java/io/swagger/v3/oas/models/OpenAPI.java | 16 ---------------- .../io/swagger/v3/oas/models/Operation.java | 16 ---------------- .../io/swagger/v3/oas/models/PathItem.java | 16 ---------------- .../java/io/swagger/v3/oas/models/Paths.java | 16 ---------------- .../v3/oas/models/callbacks/Callback.java | 16 ---------------- .../v3/oas/models/examples/Example.java | 16 ---------------- .../swagger/v3/oas/models/headers/Header.java | 16 ---------------- .../io/swagger/v3/oas/models/info/Contact.java | 16 ---------------- .../io/swagger/v3/oas/models/info/Info.java | 16 ---------------- .../io/swagger/v3/oas/models/info/License.java | 16 ---------------- .../io/swagger/v3/oas/models/links/Link.java | 16 ---------------- .../v3/oas/models/links/LinkParameter.java | 16 ---------------- .../v3/oas/models/media/ArraySchema.java | 16 ---------------- .../v3/oas/models/media/BinarySchema.java | 16 ---------------- .../v3/oas/models/media/BooleanSchema.java | 16 ---------------- .../v3/oas/models/media/ByteArraySchema.java | 16 ---------------- .../v3/oas/models/media/ComposedSchema.java | 16 ---------------- .../swagger/v3/oas/models/media/Content.java | 16 ---------------- .../v3/oas/models/media/DateSchema.java | 16 ---------------- .../v3/oas/models/media/DateTimeSchema.java | 16 ---------------- .../v3/oas/models/media/EmailSchema.java | 16 ---------------- .../swagger/v3/oas/models/media/Encoding.java | 16 ---------------- .../v3/oas/models/media/EncodingProperty.java | 16 ---------------- .../v3/oas/models/media/FileSchema.java | 16 ---------------- .../v3/oas/models/media/IntegerSchema.java | 16 ---------------- .../v3/oas/models/media/JsonSchema.java | 16 ---------------- .../swagger/v3/oas/models/media/MapSchema.java | 16 ---------------- .../swagger/v3/oas/models/media/MediaType.java | 16 ---------------- .../v3/oas/models/media/NumberSchema.java | 16 ---------------- .../v3/oas/models/media/ObjectSchema.java | 16 ---------------- .../v3/oas/models/media/PasswordSchema.java | 16 ---------------- .../io/swagger/v3/oas/models/media/Schema.java | 16 ---------------- .../v3/oas/models/media/StringSchema.java | 16 ---------------- .../v3/oas/models/media/UUIDSchema.java | 16 ---------------- .../io/swagger/v3/oas/models/media/XML.java | 16 ---------------- .../oas/models/parameters/CookieParameter.java | 16 ---------------- .../oas/models/parameters/HeaderParameter.java | 16 ---------------- .../v3/oas/models/parameters/Parameter.java | 16 ---------------- .../oas/models/parameters/PathParameter.java | 16 ---------------- .../oas/models/parameters/QueryParameter.java | 16 ---------------- .../v3/oas/models/parameters/RequestBody.java | 16 ---------------- .../v3/oas/models/responses/ApiResponse.java | 16 ---------------- .../v3/oas/models/responses/ApiResponses.java | 16 ---------------- .../v3/oas/models/security/OAuthFlow.java | 16 ---------------- .../v3/oas/models/security/OAuthFlows.java | 16 ---------------- .../swagger/v3/oas/models/security/Scopes.java | 16 ---------------- .../models/security/SecurityRequirement.java | 16 ---------------- .../v3/oas/models/security/SecurityScheme.java | 16 ---------------- .../swagger/v3/oas/models/servers/Server.java | 16 ---------------- .../v3/oas/models/servers/ServerVariable.java | 16 ---------------- .../v3/oas/models/servers/ServerVariables.java | 16 ---------------- .../io/swagger/v3/oas/models/tags/Tag.java | 16 ---------------- .../io/swagger/v3/oas/models/PathsTest.java | 16 ---------------- .../v3/oas/models/links/LinkParameterTest.java | 16 ---------------- 140 files changed, 24 insertions(+), 2257 deletions(-) diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/ExternalDocumentation.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/ExternalDocumentation.java index 95743950e1..f99ac8b8fc 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/ExternalDocumentation.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/ExternalDocumentation.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Hidden.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Hidden.java index 2793704dc9..622fe20d6c 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Hidden.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Hidden.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations; import java.lang.annotation.Retention; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/OpenAPIDefinition.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/OpenAPIDefinition.java index 23a4adadc8..e795a32555 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/OpenAPIDefinition.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/OpenAPIDefinition.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Operation.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Operation.java index 3dc8d0fd84..0b84450ffc 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Operation.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Operation.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Parameter.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Parameter.java index 4e3f6ca9ca..3cfd741f79 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Parameter.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Parameter.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations; import io.swagger.v3.oas.annotations.enums.Explode; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Parameters.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Parameters.java index 73d01eb9ee..e4a2c62484 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Parameters.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/Parameters.java @@ -1,18 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ package io.swagger.v3.oas.annotations; import java.lang.annotation.Inherited; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/callbacks/Callback.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/callbacks/Callback.java index ff3579aa46..32768c9282 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/callbacks/Callback.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/callbacks/Callback.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.callbacks; import io.swagger.v3.oas.annotations.Operation; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/callbacks/Callbacks.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/callbacks/Callbacks.java index d73e599be5..1328c22892 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/callbacks/Callbacks.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/callbacks/Callbacks.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.callbacks; import java.lang.annotation.Inherited; @@ -40,4 +24,4 @@ **/ Callback[] value() default {}; -} \ No newline at end of file +} diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/extensions/Extensions.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/extensions/Extensions.java index ef5020f896..f43e4b2aed 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/extensions/Extensions.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/extensions/Extensions.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.extensions; import java.lang.annotation.Inherited; @@ -43,4 +27,4 @@ **/ Extension[] value() default {}; -} \ No newline at end of file +} diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/headers/Header.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/headers/Header.java index 5a607e7efb..f4562ad2f8 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/headers/Header.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/headers/Header.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.headers; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/info/Contact.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/info/Contact.java index 725a44c814..5d4435bdad 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/info/Contact.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/info/Contact.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.info; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/info/Info.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/info/Info.java index 983a5773b5..70f2bb9bf6 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/info/Info.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/info/Info.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.info; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/info/License.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/info/License.java index 809e457108..8d958d85df 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/info/License.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/info/License.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.info; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/links/Link.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/links/Link.java index 7a2a5a0999..f5696974c5 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/links/Link.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/links/Link.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.links; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/links/LinkParameter.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/links/LinkParameter.java index 02f6f4f6c0..09c7e84e46 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/links/LinkParameter.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/links/LinkParameter.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.links; import java.lang.annotation.Inherited; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Content.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Content.java index 583f53149b..981740a0cd 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Content.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Content.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.media; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/DiscriminatorMapping.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/DiscriminatorMapping.java index 7abd2c33eb..f30dee7a03 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/DiscriminatorMapping.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/DiscriminatorMapping.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.media; import java.lang.annotation.Inherited; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Encoding.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Encoding.java index 0db8b05ca4..5c1c55a0cc 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Encoding.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Encoding.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.media; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/ExampleObject.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/ExampleObject.java index 5e1a178392..b8a5dd3d5c 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/ExampleObject.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/ExampleObject.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.media; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperties.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperties.java index 4b93a3cb12..15409e1319 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperties.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperties.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.media; import java.lang.annotation.Inherited; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperty.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperty.java index 10ee8f1adf..5da902f6b7 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperty.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/PatternProperty.java @@ -1,19 +1,3 @@ -/** - * Copyright 2021 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.media; import java.lang.annotation.Inherited; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Schema.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Schema.java index 3e6c989020..e4a4f26312 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Schema.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/Schema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.media; import io.swagger.v3.oas.annotations.ExternalDocumentation; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperties.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperties.java index 62ff05b84e..502d1a0b7f 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperties.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperties.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.media; import java.lang.annotation.Inherited; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperty.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperty.java index 33dd07617c..16e10a91af 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperty.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/media/SchemaProperty.java @@ -1,19 +1,3 @@ -/** - * Copyright 2021 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.media; import java.lang.annotation.Inherited; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/parameters/RequestBody.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/parameters/RequestBody.java index a7cb507fa5..552e4182a9 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/parameters/RequestBody.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/parameters/RequestBody.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.parameters; import io.swagger.v3.oas.annotations.extensions.Extension; @@ -67,7 +51,7 @@ * @return an optional array of extensions */ Extension[] extensions() default {}; - + /** * A reference to a RequestBody defined in components RequestBodies. * diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/responses/ApiResponse.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/responses/ApiResponse.java index 5a5af16036..b704266b06 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/responses/ApiResponse.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/responses/ApiResponse.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.responses; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/responses/ApiResponses.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/responses/ApiResponses.java index 7dca91f7f1..88440c5591 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/responses/ApiResponses.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/responses/ApiResponses.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.responses; import io.swagger.v3.oas.annotations.extensions.Extension; @@ -50,4 +34,4 @@ */ Extension[] extensions() default {}; -} \ No newline at end of file +} diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/OAuthFlow.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/OAuthFlow.java index ad127c9bc2..0210426a63 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/OAuthFlow.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/OAuthFlow.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.security; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/OAuthFlows.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/OAuthFlows.java index 2d41706013..948f7da947 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/OAuthFlows.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/OAuthFlows.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.security; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/OAuthScope.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/OAuthScope.java index d2eddfdba2..8e30f3f4c2 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/OAuthScope.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/OAuthScope.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.security; import java.lang.annotation.Inherited; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecurityRequirement.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecurityRequirement.java index 46271564ea..320b10c3d3 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecurityRequirement.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecurityRequirement.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.security; import java.lang.annotation.Inherited; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecurityRequirements.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecurityRequirements.java index b27fb6b221..02f756c303 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecurityRequirements.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecurityRequirements.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.security; import java.lang.annotation.Inherited; @@ -41,4 +25,4 @@ **/ SecurityRequirement[] value() default {}; -} \ No newline at end of file +} diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecurityScheme.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecurityScheme.java index 3d9e10fe3e..ceceb184dc 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecurityScheme.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecurityScheme.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.security; import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecuritySchemes.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecuritySchemes.java index 0d7b155a98..768b193f6e 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecuritySchemes.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/security/SecuritySchemes.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.security; import java.lang.annotation.Inherited; @@ -40,4 +24,4 @@ **/ SecurityScheme[] value() default {}; -} \ No newline at end of file +} diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/servers/Server.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/servers/Server.java index 481f77dab2..8d3a83e065 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/servers/Server.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/servers/Server.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.servers; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/servers/ServerVariable.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/servers/ServerVariable.java index 1ece13b550..1ea85ff6c0 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/servers/ServerVariable.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/servers/ServerVariable.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.servers; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/servers/Servers.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/servers/Servers.java index c5ddbe25e4..1912fcfce4 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/servers/Servers.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/servers/Servers.java @@ -1,18 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ package io.swagger.v3.oas.annotations.servers; import java.lang.annotation.Inherited; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/tags/Tag.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/tags/Tag.java index 9790da13d1..73719b18ed 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/tags/Tag.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/tags/Tag.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.tags; import io.swagger.v3.oas.annotations.ExternalDocumentation; diff --git a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/tags/Tags.java b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/tags/Tags.java index f5e40b6835..042b311309 100644 --- a/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/tags/Tags.java +++ b/modules/swagger-annotations/src/main/java/io/swagger/v3/oas/annotations/tags/Tags.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations.tags; import java.lang.annotation.Inherited; diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/MediaTypeMixin.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/MediaTypeMixin.java index 6d19989572..a189022694 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/MediaTypeMixin.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/MediaTypeMixin.java @@ -1,19 +1,3 @@ -/** - * Copyright 2021 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.core.jackson.mixin; import com.fasterxml.jackson.annotation.JsonAnyGetter; diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Category.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Category.java index df3c2a5ac0..77c98a4979 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Category.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Category.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.core.resolving.v31.model; import javax.xml.bind.annotation.XmlElement; diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ExtensionUser.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ExtensionUser.java index 24647d7e82..77cc8a8c6a 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ExtensionUser.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/ExtensionUser.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.core.resolving.v31.model; import io.swagger.v3.oas.annotations.extensions.Extension; diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Tag.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Tag.java index 1d24a79c67..b05a72a340 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Tag.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/Tag.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.core.resolving.v31.model; import javax.xml.bind.annotation.XmlElement; diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/User.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/User.java index 27ce93f0d6..dc99ba451c 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/User.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/User.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.core.resolving.v31.model; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/petstore/PetResource.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/petstore/PetResource.java index a0d713071d..ed3d916422 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/petstore/PetResource.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/petstore/PetResource.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugins.gradle.petstore; import io.swagger.v3.oas.annotations.Operation; diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/QueryResultBean.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/QueryResultBean.java index 4ce4ed7528..fb5c22b95c 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/QueryResultBean.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/QueryResultBean.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugins.gradle.resources; import javax.ws.rs.QueryParam; diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/data/PetData.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/data/PetData.java index e221796180..66f6f2b76e 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/data/PetData.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/data/PetData.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugins.gradle.resources.data; import io.swagger.v3.plugins.gradle.resources.model.Category; @@ -148,4 +132,4 @@ static Category createCategory(long id, String name) { category.setName(name); return category; } -} \ No newline at end of file +} diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/data/UserData.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/data/UserData.java index a23afc1ded..3825654d9f 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/data/UserData.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/data/UserData.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugins.gradle.resources.data; import io.swagger.v3.plugins.gradle.resources.model.User; @@ -95,4 +79,4 @@ private static User createUser(long id, String username, String firstName, user.setUserStatus(userStatus); return user; } -} \ No newline at end of file +} diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/exception/ApiException.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/exception/ApiException.java index 5fd6be63d7..331ba77529 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/exception/ApiException.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/exception/ApiException.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugins.gradle.resources.exception; public class ApiException extends Exception { diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/exception/NotFoundException.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/exception/NotFoundException.java index 545e6a9940..d87318b689 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/exception/NotFoundException.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/exception/NotFoundException.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugins.gradle.resources.exception; public class NotFoundException extends ApiException { diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/Category.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/Category.java index a973cb86d4..7a592e1c4e 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/Category.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/Category.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugins.gradle.resources.model; import javax.xml.bind.annotation.XmlElement; @@ -48,4 +32,4 @@ public Category() { public Category(String name) { this.name = name; } -} \ No newline at end of file +} diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/ExtensionUser.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/ExtensionUser.java index 9615b3b170..5d99676071 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/ExtensionUser.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/ExtensionUser.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugins.gradle.resources.model; import io.swagger.v3.oas.annotations.extensions.Extension; @@ -127,4 +111,4 @@ public int getUserStatus() { public void setUserStatus(int userStatus) { this.userStatus = userStatus; } -} \ No newline at end of file +} diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/Tag.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/Tag.java index 107de03ebf..c04fd01264 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/Tag.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/Tag.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugins.gradle.resources.model; import javax.xml.bind.annotation.XmlElement; @@ -41,4 +25,4 @@ public String getName() { public void setName(String name) { this.name = name; } -} \ No newline at end of file +} diff --git a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/User.java b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/User.java index ae67103476..476485eba8 100644 --- a/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/User.java +++ b/modules/swagger-gradle-plugin/src/test/java/io/swagger/v3/plugins/gradle/resources/model/User.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugins.gradle.resources.model; import io.swagger.v3.oas.annotations.media.Schema; @@ -105,4 +89,4 @@ public int getUserStatus() { public void setUserStatus(int userStatus) { this.userStatus = userStatus; } -} \ No newline at end of file +} diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/annotations/encoding/EncodingTest.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/annotations/encoding/EncodingTest.java index 1c82be26ff..da96efbc6a 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/annotations/encoding/EncodingTest.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/annotations/encoding/EncodingTest.java @@ -1,14 +1,3 @@ -/* -* IBM Confidential -* -* OCO Source Materials -* -* WLP Copyright IBM Corp. 2017 -* -* The source code for this program is not published or otherwise divested -* of its trade secrets, irrespective of what has been deposited with the -* U.S. Copyright Office. -*/ package io.swagger.v3.jaxrs2.annotations.encoding; import io.swagger.v3.jaxrs2.annotations.AbstractAnnotationTest; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/petstore/PetResource.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/petstore/PetResource.java index cff0d9f674..064163ab92 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/petstore/PetResource.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/petstore/PetResource.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.petstore; import io.swagger.v3.jaxrs2.resources.QueryResultBean; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/HiddenAnnotatedUserResource.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/HiddenAnnotatedUserResource.java index 9ebe67b911..ebf3f0469b 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/HiddenAnnotatedUserResource.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/HiddenAnnotatedUserResource.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources; import io.swagger.v3.jaxrs2.resources.data.UserData; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/HiddenUserResource.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/HiddenUserResource.java index 978930fb01..0d4ec7c430 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/HiddenUserResource.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/HiddenUserResource.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources; import io.swagger.v3.jaxrs2.resources.data.UserData; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/PetResource.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/PetResource.java index d53275326b..bfa33d524d 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/PetResource.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/PetResource.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources; import io.swagger.v3.jaxrs2.resources.data.PetData; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/PetResourceSlashesinPath.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/PetResourceSlashesinPath.java index 48aec80a1c..a0008d8917 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/PetResourceSlashesinPath.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/PetResourceSlashesinPath.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources; import io.swagger.v3.jaxrs2.resources.data.PetData; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/QueryResultBean.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/QueryResultBean.java index bdbca13018..4e98dee82c 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/QueryResultBean.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/QueryResultBean.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources; import javax.ws.rs.QueryParam; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/SimpleUserResource.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/SimpleUserResource.java index 55ac350053..c9a83a1a80 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/SimpleUserResource.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/SimpleUserResource.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources; import io.swagger.v3.jaxrs2.resources.data.UserData; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/UserAnnotation.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/UserAnnotation.java index 9cb41e4025..fc09799db4 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/UserAnnotation.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/UserAnnotation.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources; import io.swagger.v3.oas.annotations.Operation; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/UserResource.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/UserResource.java index c3cf3a2872..acf5e2e12b 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/UserResource.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/UserResource.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources; import io.swagger.v3.jaxrs2.resources.data.UserData; diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/data/PetData.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/data/PetData.java index 03d76dfdb1..1004d95bb4 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/data/PetData.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/data/PetData.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources.data; import io.swagger.v3.jaxrs2.resources.model.Category; @@ -148,4 +132,4 @@ static Category createCategory(long id, String name) { category.setName(name); return category; } -} \ No newline at end of file +} diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/data/UserData.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/data/UserData.java index 57408572cb..6c85eaaec3 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/data/UserData.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/data/UserData.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources.data; import io.swagger.v3.jaxrs2.resources.model.User; @@ -95,4 +79,4 @@ private static User createUser(long id, String username, String firstName, user.setUserStatus(userStatus); return user; } -} \ No newline at end of file +} diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/exception/ApiException.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/exception/ApiException.java index 1cf39a9685..ae1b795c1a 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/exception/ApiException.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/exception/ApiException.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources.exception; public class ApiException extends Exception { diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/exception/NotFoundException.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/exception/NotFoundException.java index 2e516512da..c91ade0e9d 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/exception/NotFoundException.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/exception/NotFoundException.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources.exception; public class NotFoundException extends ApiException { diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/Category.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/Category.java index 6b58bc241f..1c0fe76252 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/Category.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/Category.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources.model; import javax.xml.bind.annotation.XmlElement; @@ -48,4 +32,4 @@ public Category() { public Category(String name) { this.name = name; } -} \ No newline at end of file +} diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/ExtensionUser.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/ExtensionUser.java index 4bcda0c54e..cf55ad5c1a 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/ExtensionUser.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/ExtensionUser.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources.model; import io.swagger.v3.oas.annotations.extensions.Extension; @@ -125,4 +109,4 @@ public int getUserStatus() { public void setUserStatus(int userStatus) { this.userStatus = userStatus; } -} \ No newline at end of file +} diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/Tag.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/Tag.java index e5b78a4d27..33ba13e715 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/Tag.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/Tag.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources.model; import javax.xml.bind.annotation.XmlElement; @@ -41,4 +25,4 @@ public String getName() { public void setName(String name) { this.name = name; } -} \ No newline at end of file +} diff --git a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/User.java b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/User.java index ede0efa35a..5a1866b567 100644 --- a/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/User.java +++ b/modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/model/User.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.jaxrs2.resources.model; import io.swagger.v3.oas.annotations.media.Schema; @@ -104,4 +88,4 @@ public int getUserStatus() { public void setUserStatus(int userStatus) { this.userStatus = userStatus; } -} \ No newline at end of file +} diff --git a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/petstore/petstore/PetResource.java b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/petstore/petstore/PetResource.java index 2cebf2303f..511b18c797 100644 --- a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/petstore/petstore/PetResource.java +++ b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/petstore/petstore/PetResource.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugin.maven.petstore.petstore; import io.swagger.v3.plugin.maven.resources.QueryResultBean; diff --git a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/QueryResultBean.java b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/QueryResultBean.java index e64264e309..698f95ec29 100644 --- a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/QueryResultBean.java +++ b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/QueryResultBean.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugin.maven.resources; import javax.ws.rs.QueryParam; diff --git a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/data/PetData.java b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/data/PetData.java index a3999c8875..5a10a5e5b2 100644 --- a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/data/PetData.java +++ b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/data/PetData.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugin.maven.resources.data; import io.swagger.v3.plugin.maven.resources.model.Category; @@ -148,4 +132,4 @@ static Category createCategory(long id, String name) { category.setName(name); return category; } -} \ No newline at end of file +} diff --git a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/data/UserData.java b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/data/UserData.java index a745864832..2ace8b7697 100644 --- a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/data/UserData.java +++ b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/data/UserData.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugin.maven.resources.data; import io.swagger.v3.plugin.maven.resources.model.User; @@ -95,4 +79,4 @@ private static User createUser(long id, String username, String firstName, user.setUserStatus(userStatus); return user; } -} \ No newline at end of file +} diff --git a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/exception/ApiException.java b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/exception/ApiException.java index 9228e1e86e..9c983bb9c2 100644 --- a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/exception/ApiException.java +++ b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/exception/ApiException.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugin.maven.resources.exception; public class ApiException extends Exception { diff --git a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/exception/NotFoundException.java b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/exception/NotFoundException.java index 95c0775184..8989b0b7b5 100644 --- a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/exception/NotFoundException.java +++ b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/exception/NotFoundException.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugin.maven.resources.exception; public class NotFoundException extends ApiException { diff --git a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/Category.java b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/Category.java index 679f8bdbff..5f3b54a614 100644 --- a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/Category.java +++ b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/Category.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugin.maven.resources.model; import javax.xml.bind.annotation.XmlElement; @@ -48,4 +32,4 @@ public Category() { public Category(String name) { this.name = name; } -} \ No newline at end of file +} diff --git a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/ExtensionUser.java b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/ExtensionUser.java index 5256c7c764..f844faa6a5 100644 --- a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/ExtensionUser.java +++ b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/ExtensionUser.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugin.maven.resources.model; import io.swagger.v3.oas.annotations.extensions.Extension; @@ -126,4 +110,4 @@ public int getUserStatus() { public void setUserStatus(int userStatus) { this.userStatus = userStatus; } -} \ No newline at end of file +} diff --git a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/Tag.java b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/Tag.java index 6d3d128292..bc33213540 100644 --- a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/Tag.java +++ b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/Tag.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugin.maven.resources.model; import javax.xml.bind.annotation.XmlElement; @@ -41,4 +25,4 @@ public String getName() { public void setName(String name) { this.name = name; } -} \ No newline at end of file +} diff --git a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/User.java b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/User.java index 4538556503..12d673c4db 100644 --- a/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/User.java +++ b/modules/swagger-maven-plugin/src/test/java/io/swagger/v3/plugin/maven/resources/model/User.java @@ -1,19 +1,3 @@ -/** - * Copyright 2016 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.plugin.maven.resources.model; import io.swagger.v3.oas.annotations.media.Schema; @@ -104,4 +88,4 @@ public int getUserStatus() { public void setUserStatus(int userStatus) { this.userStatus = userStatus; } -} \ No newline at end of file +} diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/annotations/OpenAPI30.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/annotations/OpenAPI30.java index e1c7d63e98..e5ebf404f0 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/annotations/OpenAPI30.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/annotations/OpenAPI30.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations; import java.lang.annotation.Inherited; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/annotations/OpenAPI31.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/annotations/OpenAPI31.java index 35cec47814..1a9f3c5b1c 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/annotations/OpenAPI31.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/annotations/OpenAPI31.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.annotations; import java.lang.annotation.Inherited; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java index f32a607f59..b9a619cb82 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Components.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java index 85ed62dc88..cfca965161 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/ExternalDocumentation.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java index 04fcc0c5cb..4cd5205ace 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/OpenAPI.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models; import com.fasterxml.jackson.annotation.JsonIgnore; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java index 76b7e3134d..6eb4bf89a8 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Operation.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java index fb6492c58c..19e5454035 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/PathItem.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java index d787e68b12..d5ffda473c 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/Paths.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java index 27f3cdd928..244d8afca2 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/callbacks/Callback.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.callbacks; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java index 556a68bf0e..d484a9e377 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/examples/Example.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.examples; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java index b7f38a0cdd..11b6b973a0 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/headers/Header.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.headers; import io.swagger.v3.oas.models.examples.Example; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java index c81024e384..0ffef619f9 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Contact.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.info; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java index bff4a59d6b..e02615a560 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/Info.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.info; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java index f403e54e50..68292c68f3 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/info/License.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.info; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java index abe5bc53fe..f746d0f639 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/Link.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.links; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/LinkParameter.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/LinkParameter.java index 0b61f15a80..6319704131 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/LinkParameter.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/links/LinkParameter.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.links; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ArraySchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ArraySchema.java index 9ef004bee7..b894ecd429 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ArraySchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ArraySchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; /** diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BinarySchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BinarySchema.java index 3adc7ccb3e..627927da61 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BinarySchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BinarySchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import java.util.List; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BooleanSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BooleanSchema.java index 9d226b6cee..cc13e68520 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BooleanSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/BooleanSchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import java.util.ArrayList; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ByteArraySchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ByteArraySchema.java index 29011f1dae..d27a55799f 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ByteArraySchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ByteArraySchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import java.util.List; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ComposedSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ComposedSchema.java index 164a90866a..deea389061 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ComposedSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ComposedSchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; /** diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Content.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Content.java index 778a4c2d64..da0e443810 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Content.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Content.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import java.util.LinkedHashMap; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/DateSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/DateSchema.java index f68df79ae5..08c5d4af6c 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/DateSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/DateSchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import java.text.SimpleDateFormat; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/DateTimeSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/DateTimeSchema.java index 27c5f15eb5..b3c775cfe3 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/DateTimeSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/DateTimeSchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import java.time.OffsetDateTime; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EmailSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EmailSchema.java index 44ba7db296..a771bbed3a 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EmailSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EmailSchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import java.util.Objects; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java index 5ca9e45d47..9720ea188d 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/Encoding.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EncodingProperty.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EncodingProperty.java index ad45604a64..a0ec9cc0c0 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EncodingProperty.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/EncodingProperty.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/FileSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/FileSchema.java index ebbf2fe7f0..fb585fb7a0 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/FileSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/FileSchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import java.util.Objects; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/IntegerSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/IntegerSchema.java index c4bbc57d82..75a09bcf8b 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/IntegerSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/IntegerSchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import java.text.NumberFormat; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/JsonSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/JsonSchema.java index 065a3becdb..f3ecf19870 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/JsonSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/JsonSchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import io.swagger.v3.oas.models.SpecVersion; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MapSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MapSchema.java index afb5057b25..0af286e643 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MapSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MapSchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import java.util.Objects; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MediaType.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MediaType.java index 0b3800e45d..37b8b38f9a 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MediaType.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/MediaType.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/NumberSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/NumberSchema.java index fa9126c10d..a49d1fb79b 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/NumberSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/NumberSchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import java.math.BigDecimal; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ObjectSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ObjectSchema.java index e00a93ca85..dd613bf44c 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ObjectSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/ObjectSchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import java.util.Objects; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/PasswordSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/PasswordSchema.java index 5e8a8a9673..1a757d6809 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/PasswordSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/PasswordSchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import java.util.Objects; 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 eb97a9c459..7ca3c619af 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 @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import com.fasterxml.jackson.annotation.JsonIgnore; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/StringSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/StringSchema.java index 48a91436e2..9e65fa5c8a 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/StringSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/StringSchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import java.util.List; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/UUIDSchema.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/UUIDSchema.java index 6eb947f43c..aaa88e341e 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/UUIDSchema.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/UUIDSchema.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import java.util.List; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/XML.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/XML.java index 5cb50938a5..94966f9111 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/XML.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/media/XML.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.media; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/CookieParameter.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/CookieParameter.java index 7e85313644..587bac3368 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/CookieParameter.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/CookieParameter.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.parameters; import java.util.Objects; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/HeaderParameter.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/HeaderParameter.java index 0b349af781..609fa0f210 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/HeaderParameter.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/HeaderParameter.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.parameters; import java.util.Objects; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java index 19b16bf827..e5494e285c 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/Parameter.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.parameters; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/PathParameter.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/PathParameter.java index a37478fa29..2fe61388c2 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/PathParameter.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/PathParameter.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.parameters; import java.util.Objects; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/QueryParameter.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/QueryParameter.java index 5ea92c1317..233908d442 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/QueryParameter.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/QueryParameter.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.parameters; import java.util.Objects; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java index f906b6bab2..6c14dbb6a2 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/parameters/RequestBody.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.parameters; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java index 6f59cf2dcd..adb07466b7 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponse.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.responses; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java index e118a169f2..e842ab19ff 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/responses/ApiResponses.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.responses; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java index 0adeb3ef4e..03735cecb6 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlow.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.security; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java index b3d4343e60..927d35168c 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/OAuthFlows.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.security; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/Scopes.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/Scopes.java index a7543bf633..ef21d23876 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/Scopes.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/Scopes.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.security; import java.util.LinkedHashMap; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityRequirement.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityRequirement.java index 4119498792..e94ca4b05d 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityRequirement.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityRequirement.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.security; import java.util.ArrayList; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java index f42e71ec3c..418570ba8c 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/security/SecurityScheme.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.security; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java index a3dc20cca3..e233634316 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/Server.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.servers; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java index 37dfd2f8e1..ca0d6d150d 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariable.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.servers; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariables.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariables.java index fd28ead8fb..62ba9a529d 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariables.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/servers/ServerVariables.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.servers; import java.util.LinkedHashMap; diff --git a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java index bed0faf23c..b45c7ef993 100644 --- a/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java +++ b/modules/swagger-models/src/main/java/io/swagger/v3/oas/models/tags/Tag.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.tags; import io.swagger.v3.oas.annotations.OpenAPI31; diff --git a/modules/swagger-models/src/test/java/io/swagger/v3/oas/models/PathsTest.java b/modules/swagger-models/src/test/java/io/swagger/v3/oas/models/PathsTest.java index fa83ad5563..dd2dab3b0c 100644 --- a/modules/swagger-models/src/test/java/io/swagger/v3/oas/models/PathsTest.java +++ b/modules/swagger-models/src/test/java/io/swagger/v3/oas/models/PathsTest.java @@ -1,19 +1,3 @@ -/** - * Copyright 2017 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models; import java.util.HashMap; diff --git a/modules/swagger-models/src/test/java/io/swagger/v3/oas/models/links/LinkParameterTest.java b/modules/swagger-models/src/test/java/io/swagger/v3/oas/models/links/LinkParameterTest.java index 2201862372..541bc24d53 100644 --- a/modules/swagger-models/src/test/java/io/swagger/v3/oas/models/links/LinkParameterTest.java +++ b/modules/swagger-models/src/test/java/io/swagger/v3/oas/models/links/LinkParameterTest.java @@ -1,19 +1,3 @@ -/** - * Copyright 2019 SmartBear Software - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package io.swagger.v3.oas.models.links; import java.util.HashMap; From 0a16eb7c9be4475e90957e3b91b6e03ace5124f6 Mon Sep 17 00:00:00 2001 From: frantuma Date: Mon, 28 Mar 2022 22:19:05 +0200 Subject: [PATCH 79/79] update LICENSE and NOTICE in build --- NOTICE | 4 +- modules/swagger-core/pom.xml | 13 -- modules/swagger-project-jakarta/LICENSE | 202 ------------------------ modules/swagger-project-jakarta/NOTICE | 4 - modules/swagger-project-jakarta/pom.xml | 3 +- pom.xml | 3 +- 6 files changed, 6 insertions(+), 223 deletions(-) delete mode 100644 modules/swagger-project-jakarta/LICENSE delete mode 100644 modules/swagger-project-jakarta/NOTICE diff --git a/NOTICE b/NOTICE index b338555543..36ca80ba19 100644 --- a/NOTICE +++ b/NOTICE @@ -1,4 +1,4 @@ -Swagger Core +Swagger Core - ${pom.name} Copyright (c) 2015. SmartBear Software Inc. -Swagger Core is licensed under Apache 2.0 license. +Swagger Core - ${pom.name} is licensed under Apache 2.0 license. Copy of the Apache 2.0 license can be found in `LICENSE` file. diff --git a/modules/swagger-core/pom.xml b/modules/swagger-core/pom.xml index 1b67144d0a..d9a2c70464 100644 --- a/modules/swagger-core/pom.xml +++ b/modules/swagger-core/pom.xml @@ -13,19 +13,6 @@ src/main/java install - - - src/main/resources - - logback.xml - - - - - - src/test/resources - - biz.aQute.bnd diff --git a/modules/swagger-project-jakarta/LICENSE b/modules/swagger-project-jakarta/LICENSE deleted file mode 100644 index d645695673..0000000000 --- a/modules/swagger-project-jakarta/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/modules/swagger-project-jakarta/NOTICE b/modules/swagger-project-jakarta/NOTICE deleted file mode 100644 index b338555543..0000000000 --- a/modules/swagger-project-jakarta/NOTICE +++ /dev/null @@ -1,4 +0,0 @@ -Swagger Core -Copyright (c) 2015. SmartBear Software Inc. -Swagger Core is licensed under Apache 2.0 license. -Copy of the Apache 2.0 license can be found in `LICENSE` file. diff --git a/modules/swagger-project-jakarta/pom.xml b/modules/swagger-project-jakarta/pom.xml index 25760aa8d4..f75eb7e964 100644 --- a/modules/swagger-project-jakarta/pom.xml +++ b/modules/swagger-project-jakarta/pom.xml @@ -57,7 +57,8 @@ META-INF - . + ../../../.. + true NOTICE LICENSE diff --git a/pom.xml b/pom.xml index 92c5d781e2..0636699f1d 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,8 @@ META-INF - . + ../.. + true NOTICE LICENSE