From 2e3853adc68a2a0bab7029eb924bb03cb32c5315 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 12:12:09 +0200 Subject: [PATCH 01/25] build(deps): bump cyclonedx-maven-plugin from 2.7.5 to 2.7.6 (#505) Bumps [cyclonedx-maven-plugin](https://github.com/CycloneDX/cyclonedx-maven-plugin) from 2.7.5 to 2.7.6. - [Release notes](https://github.com/CycloneDX/cyclonedx-maven-plugin/releases) - [Commits](https://github.com/CycloneDX/cyclonedx-maven-plugin/compare/cyclonedx-maven-plugin-2.7.5...cyclonedx-maven-plugin-2.7.6) --- updated-dependencies: - dependency-name: org.cyclonedx:cyclonedx-maven-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 12b1b063..e02cfc34 100644 --- a/pom.xml +++ b/pom.xml @@ -344,7 +344,7 @@ org.cyclonedx cyclonedx-maven-plugin - 2.7.5 + 2.7.6 From 1de574d3ca447bc463740bc10c37851702974a00 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 12:12:17 +0200 Subject: [PATCH 02/25] build(deps): bump jacoco-maven-plugin from 0.8.8 to 0.8.9 (#504) Bumps [jacoco-maven-plugin](https://github.com/jacoco/jacoco) from 0.8.8 to 0.8.9. - [Release notes](https://github.com/jacoco/jacoco/releases) - [Commits](https://github.com/jacoco/jacoco/compare/v0.8.8...v0.8.9) --- updated-dependencies: - dependency-name: org.jacoco:jacoco-maven-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e02cfc34..8feb003a 100644 --- a/pom.xml +++ b/pom.xml @@ -334,7 +334,7 @@ org.jacoco jacoco-maven-plugin - 0.8.8 + 0.8.9 org.sonarsource.scanner.maven From 24ce7c17edafae080d56cef585693d1d3cbb728b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Apr 2023 20:56:37 +0200 Subject: [PATCH 03/25] build(deps): bump logback-classic from 1.3.0 to 1.3.7 (#509) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jochen Schalanda --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8feb003a..56c0b137 100644 --- a/pom.xml +++ b/pom.xml @@ -154,7 +154,7 @@ ch.qos.logback logback-classic - 1.3.0 + 1.3.7 org.assertj From 40643d0ecb811123ae33d90bf52b3db8ba557758 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Apr 2023 20:56:54 +0200 Subject: [PATCH 04/25] build(deps): bump cyclonedx-maven-plugin from 2.7.6 to 2.7.7 (#507) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 56c0b137..b68759ee 100644 --- a/pom.xml +++ b/pom.xml @@ -344,7 +344,7 @@ org.cyclonedx cyclonedx-maven-plugin - 2.7.6 + 2.7.7 From bcaadb8a2a2c682fe164b97485323b0b34b9f77e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Apr 2023 16:11:37 +0200 Subject: [PATCH 05/25] build(deps): bump jacoco-maven-plugin from 0.8.9 to 0.8.10 (#513) Bumps [jacoco-maven-plugin](https://github.com/jacoco/jacoco) from 0.8.9 to 0.8.10. - [Release notes](https://github.com/jacoco/jacoco/releases) - [Commits](https://github.com/jacoco/jacoco/compare/v0.8.9...v0.8.10) --- updated-dependencies: - dependency-name: org.jacoco:jacoco-maven-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b68759ee..b3df58b0 100644 --- a/pom.xml +++ b/pom.xml @@ -334,7 +334,7 @@ org.jacoco jacoco-maven-plugin - 0.8.9 + 0.8.10 org.sonarsource.scanner.maven From fa8ee3fc7e64733ecf5bc6ad8ab8c1776fd6c796 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Apr 2023 16:11:42 +0200 Subject: [PATCH 06/25] build(deps): bump junit-bom from 5.9.2 to 5.9.3 (#514) Bumps [junit-bom](https://github.com/junit-team/junit5) from 5.9.2 to 5.9.3. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.9.2...r5.9.3) --- updated-dependencies: - dependency-name: org.junit:junit-bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b3df58b0..4e0d82ef 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ org.junit junit-bom - 5.9.2 + 5.9.3 pom import From ac77ac9cf4fc1b04cda99a5737b909cfeb622d84 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Apr 2023 16:11:52 +0200 Subject: [PATCH 07/25] build(deps): bump cyclonedx-maven-plugin from 2.7.7 to 2.7.8 (#515) Bumps [cyclonedx-maven-plugin](https://github.com/CycloneDX/cyclonedx-maven-plugin) from 2.7.7 to 2.7.8. - [Release notes](https://github.com/CycloneDX/cyclonedx-maven-plugin/releases) - [Commits](https://github.com/CycloneDX/cyclonedx-maven-plugin/compare/cyclonedx-maven-plugin-2.7.7...cyclonedx-maven-plugin-2.7.8) --- updated-dependencies: - dependency-name: org.cyclonedx:cyclonedx-maven-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4e0d82ef..cab26944 100644 --- a/pom.xml +++ b/pom.xml @@ -344,7 +344,7 @@ org.cyclonedx cyclonedx-maven-plugin - 2.7.7 + 2.7.8 From bca0885246ce8bbfa5eed00da67154a541a6e46a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 May 2023 12:05:00 +0200 Subject: [PATCH 08/25] build(deps): bump maven-gpg-plugin from 3.0.1 to 3.1.0 (#518) Bumps [maven-gpg-plugin](https://github.com/apache/maven-gpg-plugin) from 3.0.1 to 3.1.0. - [Commits](https://github.com/apache/maven-gpg-plugin/compare/maven-gpg-plugin-3.0.1...maven-gpg-plugin-3.1.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-gpg-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cab26944..6a8b2224 100644 --- a/pom.xml +++ b/pom.xml @@ -313,7 +313,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.0.1 + 3.1.0 org.apache.maven.plugins From 12e44553c253b18b9981db0f335ecc291e5724f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 May 2023 12:05:07 +0200 Subject: [PATCH 09/25] build(deps): bump maven-surefire-plugin from 3.0.0 to 3.1.0 (#519) Bumps [maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.0.0 to 3.1.0. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.0.0...surefire-3.1.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-surefire-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6a8b2224..9e09e1c3 100644 --- a/pom.xml +++ b/pom.xml @@ -298,7 +298,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0 + 3.1.0 com.coveo From 9f6bd3f9717072f293164cc54b0985cce2e4b432 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 May 2023 13:59:34 +0200 Subject: [PATCH 10/25] build(deps): bump cyclonedx-maven-plugin from 2.7.8 to 2.7.9 (#524) Bumps [cyclonedx-maven-plugin](https://github.com/CycloneDX/cyclonedx-maven-plugin) from 2.7.8 to 2.7.9. - [Release notes](https://github.com/CycloneDX/cyclonedx-maven-plugin/releases) - [Commits](https://github.com/CycloneDX/cyclonedx-maven-plugin/compare/cyclonedx-maven-plugin-2.7.8...cyclonedx-maven-plugin-2.7.9) --- updated-dependencies: - dependency-name: org.cyclonedx:cyclonedx-maven-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9e09e1c3..76f2d173 100644 --- a/pom.xml +++ b/pom.xml @@ -344,7 +344,7 @@ org.cyclonedx cyclonedx-maven-plugin - 2.7.8 + 2.7.9 From 84c8b2f92ee7e7aef915a92f1a459ff93ebbd2d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 May 2023 13:59:44 +0200 Subject: [PATCH 11/25] build(deps): bump swagger-parser.version from 2.1.13 to 2.1.14 (#521) Bumps `swagger-parser.version` from 2.1.13 to 2.1.14. Updates `swagger-parser-v3` from 2.1.13 to 2.1.14 Updates `swagger-parser` from 2.1.13 to 2.1.14 - [Release notes](https://github.com/swagger-api/swagger-parser/releases) - [Commits](https://github.com/swagger-api/swagger-parser/compare/v2.1.13...v2.1.14) Updates `swagger-parser-v2-converter` from 2.1.13 to 2.1.14 --- updated-dependencies: - dependency-name: io.swagger.parser.v3:swagger-parser-v3 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: io.swagger.parser.v3:swagger-parser dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: io.swagger.parser.v3:swagger-parser-v2-converter dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 76f2d173..28254fb3 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ https://sonarcloud.io ${project.artifactId} - 2.1.13 + 2.1.14 2.0.7 From df52a1e9db740321224d4a84bd9fa4affb912807 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 May 2023 21:37:39 +0200 Subject: [PATCH 12/25] build(deps): bump maven-source-plugin from 3.2.1 to 3.3.0 (#526) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 28254fb3..4aa428a5 100644 --- a/pom.xml +++ b/pom.xml @@ -278,7 +278,7 @@ org.apache.maven.plugins maven-source-plugin - 3.2.1 + 3.3.0 org.apache.maven.plugins From 364d806f093398ddb56fbf70f1244e73556d1e3b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 May 2023 16:34:00 +0200 Subject: [PATCH 13/25] build(deps): bump swagger-parser.version from 2.1.14 to 2.1.15 (#527) Bumps `swagger-parser.version` from 2.1.14 to 2.1.15. Updates `swagger-parser-v3` from 2.1.14 to 2.1.15 Updates `swagger-parser` from 2.1.14 to 2.1.15 - [Release notes](https://github.com/swagger-api/swagger-parser/releases) - [Commits](https://github.com/swagger-api/swagger-parser/compare/v2.1.14...v2.1.15) Updates `swagger-parser-v2-converter` from 2.1.14 to 2.1.15 --- updated-dependencies: - dependency-name: io.swagger.parser.v3:swagger-parser-v3 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: io.swagger.parser.v3:swagger-parser dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: io.swagger.parser.v3:swagger-parser-v2-converter dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4aa428a5..85b02970 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ https://sonarcloud.io ${project.artifactId} - 2.1.14 + 2.1.15 2.0.7 From c9aeb7baea34fbaa12e32c387c6f871d7fa10d03 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Jun 2023 15:00:06 +0200 Subject: [PATCH 14/25] build(deps): bump maven-release-plugin from 3.0.0 to 3.0.1 (#529) Bumps [maven-release-plugin](https://github.com/apache/maven-release) from 3.0.0 to 3.0.1. - [Release notes](https://github.com/apache/maven-release/releases) - [Commits](https://github.com/apache/maven-release/compare/maven-release-3.0.0...maven-release-3.0.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-release-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 85b02970..5be6bc61 100644 --- a/pom.xml +++ b/pom.xml @@ -288,7 +288,7 @@ org.apache.maven.plugins maven-release-plugin - 3.0.0 + 3.0.1 org.apache.maven.plugins From e1d436a1b12b469643708d86eb0c835f39d81baa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Jun 2023 23:17:54 +0200 Subject: [PATCH 15/25] build(deps): bump maven-surefire-plugin from 3.1.0 to 3.1.2 (#530) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5be6bc61..df6ddd93 100644 --- a/pom.xml +++ b/pom.xml @@ -298,7 +298,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.1.0 + 3.1.2 com.coveo From c36e47bc9b5885716a6ad889715fb788e93c27e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Jun 2023 07:27:44 +0200 Subject: [PATCH 16/25] build(deps): bump logback-classic from 1.3.7 to 1.3.8 (#531) * build(deps): bump logback-classic from 1.3.7 to 1.4.8 Bumps [logback-classic](https://github.com/qos-ch/logback) from 1.3.7 to 1.4.8. - [Commits](https://github.com/qos-ch/logback/compare/v_1.3.7...v_1.4.8) --- updated-dependencies: - dependency-name: ch.qos.logback:logback-classic dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Upgrade to Logback 1.3.8 --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jochen Schalanda --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index df6ddd93..f0613534 100644 --- a/pom.xml +++ b/pom.xml @@ -154,7 +154,7 @@ ch.qos.logback logback-classic - 1.3.7 + 1.3.8 org.assertj From 431b81dd047f2346f5a3f04137bd9cad9e4798e5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Jun 2023 09:22:21 +0200 Subject: [PATCH 17/25] build(deps): bump maven-shade-plugin from 3.4.1 to 3.5.0 (#533) Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.4.1 to 3.5.0. - [Release notes](https://github.com/apache/maven-shade-plugin/releases) - [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.4.1...maven-shade-plugin-3.5.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-shade-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f0613534..a2536546 100644 --- a/pom.xml +++ b/pom.xml @@ -323,7 +323,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.4.1 + 3.5.0 org.sonatype.plugins From fa2b18f5e9e033bbd525dfc516cc16be153f1d94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Jun 2023 14:19:51 +0200 Subject: [PATCH 18/25] build(deps): bump swagger-parser.version from 2.1.15 to 2.1.16 (#536) Bumps `swagger-parser.version` from 2.1.15 to 2.1.16. Updates `swagger-parser-v3` from 2.1.15 to 2.1.16 Updates `swagger-parser` from 2.1.15 to 2.1.16 - [Release notes](https://github.com/swagger-api/swagger-parser/releases) - [Commits](https://github.com/swagger-api/swagger-parser/compare/v2.1.15...v2.1.16) Updates `swagger-parser-v2-converter` from 2.1.15 to 2.1.16 --- updated-dependencies: - dependency-name: io.swagger.parser.v3:swagger-parser-v3 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: io.swagger.parser.v3:swagger-parser dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: io.swagger.parser.v3:swagger-parser-v2-converter dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a2536546..290c81f2 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ https://sonarcloud.io ${project.artifactId} - 2.1.15 + 2.1.16 2.0.7 From e3cedbdf192debb02aeb7f36894eb3f32044c7c9 Mon Sep 17 00:00:00 2001 From: westse <10818305+westse@users.noreply.github.com> Date: Fri, 30 Jun 2023 08:58:12 -0600 Subject: [PATCH 19/25] Use Maven wrapper in pre-commit hook (#540) Closes #539 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 290c81f2..04879e4e 100644 --- a/pom.xml +++ b/pom.xml @@ -381,7 +381,7 @@ true - mvn com.coveo:fmt-maven-plugin:format + ./mvnw com.coveo:fmt-maven-plugin:format From c0fa0fe6ff1400ccd5cd04c89fb425919b8d4252 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Jul 2023 11:34:27 +0200 Subject: [PATCH 20/25] build(deps): bump org.junit:junit-bom from 5.9.3 to 5.10.0 (#548) Bumps [org.junit:junit-bom](https://github.com/junit-team/junit5) from 5.9.3 to 5.10.0. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.9.3...r5.10.0) --- updated-dependencies: - dependency-name: org.junit:junit-bom dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 04879e4e..f25d729f 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ org.junit junit-bom - 5.9.3 + 5.10.0 pom import From 5a54a6a98897795d7d5efb2031d35fec1e29250a Mon Sep 17 00:00:00 2001 From: westse <10818305+westse@users.noreply.github.com> Date: Tue, 25 Jul 2023 13:39:48 -0600 Subject: [PATCH 21/25] Improve backward-compatibility testing (#546) - Attempts to be exhaustive on backward-compatibility coverage to raise confidence that future refactors will not introduce unintended regressions. - Each incompatible condition is tested separately by comparing two spec files where the only difference is that fine-grained incompatible condition. - In some cases the current behavior appears incorrect. Tests are still added for these to avoid unintended regression, but are given TODO comments for later follow-up. - Pre-existing tests have been removed if they are redundant to avoid confusion and to follow the convention. Closes #545 --- .../core/model/ChangedSecurityScheme.java | 7 + .../core/BackwardCompatibilityTest.java | 49 ------ .../openapidiff/core/TestUtils.java | 15 ++ .../core/backcompat/ApiResponseBCTest.java | 26 +++ .../core/backcompat/ContentBCTest.java | 31 ++++ .../core/backcompat/EnumBCTest.java | 31 ++++ .../core/backcompat/HeaderBCTest.java | 37 ++++ .../core/backcompat/HeadersBCTest.java | 26 +++ .../core/backcompat/MaxLengthBCTest.java | 25 +++ .../core/backcompat/NumericRangeBCTest.java | 114 ++++++++++++ .../core/backcompat/OAuthFlowBCTest.java | 30 ++++ .../core/backcompat/OneOfBCTest.java | 31 ++++ .../core/backcompat/OpenApiBCTest.java | 26 +++ .../core/backcompat/OperationBCTest.java | 20 +++ .../core/backcompat/ParameterBCTest.java | 41 +++++ .../core/backcompat/ParametersBCTest.java | 31 ++++ .../core/backcompat/PathBCTest.java | 26 +++ .../core/backcompat/PathsBCTest.java | 26 +++ .../core/backcompat/ReadOnlyBCTest.java | 32 ++++ .../core/backcompat/RequestBodyBCTest.java | 20 +++ .../core/backcompat/RequiredBCTest.java | 32 ++++ .../core/backcompat/SchemaBCTest.java | 65 +++++++ .../backcompat/SecurityRequirementBCTest.java | 24 +++ .../SecurityRequirementsBCTest.java | 38 ++++ .../core/backcompat/SecuritySchemeBCTest.java | 51 ++++++ .../core/backcompat/WriteOnlyBCTest.java | 32 ++++ .../core/compare/ApiResponseDiffTest.java | 27 --- .../apiResponse_diff_1.yaml | 7 - .../apiResponse_diff_2.yaml | 15 -- .../resources/backwardCompatibility/bc_1.yaml | 132 -------------- .../resources/backwardCompatibility/bc_2.yaml | 150 ---------------- .../resources/backwardCompatibility/bc_3.yaml | 163 ------------------ .../resources/backwardCompatibility/bc_4.yaml | 155 ----------------- .../resources/backwardCompatibility/bc_5.yaml | 131 -------------- core/src/test/resources/bc_content_base.yaml | 29 ++++ .../bc_content_changed_but_compatible.yaml | 35 ++++ core/src/test/resources/bc_enum_base.yaml | 33 ++++ .../bc_enum_changed_but_compatible.yaml | 33 ++++ .../src/test/resources/bc_maxlength_base.yaml | 29 ++++ .../test/resources/bc_numericrange_base.yaml | 55 ++++++ ...c_numericrange_changed_but_compatible.yaml | 57 ++++++ ...c_oauthflow_authorization_url_changed.yaml | 28 +++ .../src/test/resources/bc_oauthflow_base.yaml | 28 +++ .../bc_oauthflow_refresh_url_changed.yaml | 28 +++ .../bc_oauthflow_token_url_changed.yaml | 28 +++ core/src/test/resources/bc_oneof_base.yaml | 48 ++++++ .../bc_oneof_changed_but_compatible.yaml | 48 ++++++ core/src/test/resources/bc_openapi_base.yaml | 25 +++ .../bc_openapi_changed_but_compatible.yaml | 35 ++++ .../bc_openapi_endpoints_decreased.yaml | 16 ++ .../src/test/resources/bc_operation_base.yaml | 16 ++ .../bc_operation_changed_but_compatible.yaml | 17 ++ core/src/test/resources/bc_path_base.yaml | 25 +++ .../bc_path_changed_but_compatible.yaml | 34 ++++ .../test/resources/bc_path_ops_decreased.yaml | 16 ++ core/src/test/resources/bc_paths_base.yaml | 26 +++ .../bc_paths_changed_but_compatible.yaml | 36 ++++ .../test/resources/bc_paths_decreased.yaml | 16 ++ core/src/test/resources/bc_readonly_base.yaml | 33 ++++ .../bc_readonly_changed_but_compatible.yaml | 32 ++++ .../test/resources/bc_request_body_base.yaml | 21 +++ .../bc_request_body_required_changed.yaml | 22 +++ .../bc_request_content_decreased.yaml | 26 +++ .../resources/bc_request_enum_decreased.yaml | 32 ++++ .../bc_request_maxlength_decreased.yaml | 30 ++++ ...st_numericrange_exclusive_max_created.yaml | 56 ++++++ ...equest_numericrange_exclusive_max_set.yaml | 55 ++++++ ...st_numericrange_exclusive_min_created.yaml | 56 ++++++ ...equest_numericrange_exclusive_min_set.yaml | 55 ++++++ .../bc_request_numericrange_max_added.yaml | 56 ++++++ ...bc_request_numericrange_max_decreased.yaml | 55 ++++++ .../bc_request_numericrange_min_added.yaml | 56 ++++++ ...bc_request_numericrange_min_increased.yaml | 55 ++++++ .../resources/bc_request_oneof_decreased.yaml | 47 +++++ ...quest_param_allowemptyvalue_decreased.yaml | 28 +++ .../test/resources/bc_request_param_base.yaml | 29 ++++ ..._request_param_changed_but_compatible.yaml | 30 ++++ .../bc_request_param_explode_changed.yaml | 30 ++++ .../bc_request_param_required_increased.yaml | 30 ++++ .../bc_request_param_style_changed.yaml | 30 ++++ .../resources/bc_request_params_base.yaml | 26 +++ ...request_params_changed_but_compatible.yaml | 30 ++++ .../bc_request_params_decreased.yaml | 22 +++ .../bc_request_params_required_increased.yaml | 31 ++++ .../bc_request_readonly_increased.yaml | 34 ++++ ...c_request_readonly_required_decreased.yaml | 32 ++++ .../bc_request_required_increased.yaml | 42 +++++ .../bc_request_schema_format_decreased.yaml | 115 ++++++++++++ .../bc_request_schema_format_increased.yaml | 115 ++++++++++++ ...bc_request_schema_props_put_increased.yaml | 117 +++++++++++++ core/src/test/resources/bc_required_base.yaml | 41 +++++ .../bc_required_changed_but_compatible.yaml | 41 +++++ .../bc_response_apiresponse_base.yaml | 18 ++ ...se_apiresponse_changed_but_compatible.yaml | 22 +++ .../bc_response_apiresponse_decreased.yaml | 16 ++ .../bc_response_content_decreased.yaml | 26 +++ .../resources/bc_response_enum_increased.yaml | 34 ++++ .../resources/bc_response_header_base.yaml | 21 +++ .../bc_response_header_deprecated.yaml | 22 +++ .../resources/bc_response_header_explode.yaml | 22 +++ .../bc_response_header_required_added.yaml | 22 +++ .../bc_response_header_required_deleted.yaml | 20 +++ .../resources/bc_response_headers_base.yaml | 21 +++ .../bc_response_headers_increased.yaml | 24 +++ .../bc_response_headers_missing.yaml | 18 ++ .../bc_response_maxlength_increased.yaml | 30 ++++ ...se_numericrange_exclusive_max_deleted.yaml | 54 ++++++ ...onse_numericrange_exclusive_max_unset.yaml | 55 ++++++ ...se_numericrange_exclusive_min_deleted.yaml | 54 ++++++ ...onse_numericrange_exclusive_min_unset.yaml | 55 ++++++ .../bc_response_numericrange_max_deleted.yaml | 53 ++++++ ...c_response_numericrange_max_increased.yaml | 55 ++++++ ...c_response_numericrange_min_decreased.yaml | 55 ++++++ .../bc_response_numericrange_min_deleted.yaml | 53 ++++++ .../bc_response_oneof_increased.yaml | 49 ++++++ .../bc_response_required_decreased.yaml | 40 +++++ .../bc_response_schema_format_decreased.yaml | 115 ++++++++++++ .../bc_response_schema_format_increased.yaml | 115 ++++++++++++ ...ponse_schema_props_required_decreased.yaml | 112 ++++++++++++ .../bc_response_writeonly_increased.yaml | 34 ++++ ...response_writeonly_required_decreased.yaml | 32 ++++ core/src/test/resources/bc_schema_base.yaml | 115 ++++++++++++ .../bc_schema_changed_but_compatible.yaml | 114 ++++++++++++ .../bc_schema_discriminator_changed.yaml | 115 ++++++++++++ .../resources/bc_schema_type_changed.yaml | 114 ++++++++++++ .../bc_security_requirement_base.yaml | 30 ++++ ...ty_requirement_changed_but_compatible.yaml | 29 ++++ ...ecurity_requirement_schemes_increased.yaml | 31 ++++ .../bc_security_requirements_base.yaml | 30 ++++ ...y_requirements_changed_but_compatible.yaml | 31 ++++ .../bc_security_requirements_decreased.yaml | 29 ++++ ...rity_requirements_scheme_type_changed.yaml | 31 ++++ .../resources/bc_security_scheme_base.yaml | 42 +++++ ...security_scheme_bearer_format_changed.yaml | 43 +++++ ...ecurity_scheme_changed_but_compatible.yaml | 41 +++++ .../bc_security_scheme_in_changed.yaml | 42 +++++ ...ty_scheme_open_id_connect_url_changed.yaml | 42 +++++ .../bc_security_scheme_scheme_changed.yaml | 43 +++++ .../bc_security_scheme_scopes_increased.yaml | 43 +++++ .../bc_security_scheme_type_changed.yaml | 42 +++++ .../src/test/resources/bc_writeonly_base.yaml | 33 ++++ .../bc_writeonly_changed_but_compatible.yaml | 32 ++++ 142 files changed, 5407 insertions(+), 829 deletions(-) delete mode 100644 core/src/test/java/org/openapitools/openapidiff/core/BackwardCompatibilityTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/ApiResponseBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/ContentBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/EnumBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/HeaderBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/HeadersBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/MaxLengthBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/NumericRangeBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/OAuthFlowBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/OneOfBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/OpenApiBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/OperationBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/ParameterBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/ParametersBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/PathBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/PathsBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/ReadOnlyBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/RequestBodyBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/RequiredBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/SchemaBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecurityRequirementBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecurityRequirementsBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecuritySchemeBCTest.java create mode 100644 core/src/test/java/org/openapitools/openapidiff/core/backcompat/WriteOnlyBCTest.java delete mode 100644 core/src/test/java/org/openapitools/openapidiff/core/compare/ApiResponseDiffTest.java delete mode 100644 core/src/test/resources/backwardCompatibility/apiResponse_diff_1.yaml delete mode 100644 core/src/test/resources/backwardCompatibility/apiResponse_diff_2.yaml delete mode 100644 core/src/test/resources/backwardCompatibility/bc_1.yaml delete mode 100644 core/src/test/resources/backwardCompatibility/bc_2.yaml delete mode 100644 core/src/test/resources/backwardCompatibility/bc_3.yaml delete mode 100644 core/src/test/resources/backwardCompatibility/bc_4.yaml delete mode 100644 core/src/test/resources/backwardCompatibility/bc_5.yaml create mode 100644 core/src/test/resources/bc_content_base.yaml create mode 100644 core/src/test/resources/bc_content_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_enum_base.yaml create mode 100644 core/src/test/resources/bc_enum_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_maxlength_base.yaml create mode 100644 core/src/test/resources/bc_numericrange_base.yaml create mode 100644 core/src/test/resources/bc_numericrange_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_oauthflow_authorization_url_changed.yaml create mode 100644 core/src/test/resources/bc_oauthflow_base.yaml create mode 100644 core/src/test/resources/bc_oauthflow_refresh_url_changed.yaml create mode 100644 core/src/test/resources/bc_oauthflow_token_url_changed.yaml create mode 100644 core/src/test/resources/bc_oneof_base.yaml create mode 100644 core/src/test/resources/bc_oneof_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_openapi_base.yaml create mode 100644 core/src/test/resources/bc_openapi_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_openapi_endpoints_decreased.yaml create mode 100644 core/src/test/resources/bc_operation_base.yaml create mode 100644 core/src/test/resources/bc_operation_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_path_base.yaml create mode 100644 core/src/test/resources/bc_path_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_path_ops_decreased.yaml create mode 100644 core/src/test/resources/bc_paths_base.yaml create mode 100644 core/src/test/resources/bc_paths_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_paths_decreased.yaml create mode 100644 core/src/test/resources/bc_readonly_base.yaml create mode 100644 core/src/test/resources/bc_readonly_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_request_body_base.yaml create mode 100644 core/src/test/resources/bc_request_body_required_changed.yaml create mode 100644 core/src/test/resources/bc_request_content_decreased.yaml create mode 100644 core/src/test/resources/bc_request_enum_decreased.yaml create mode 100644 core/src/test/resources/bc_request_maxlength_decreased.yaml create mode 100644 core/src/test/resources/bc_request_numericrange_exclusive_max_created.yaml create mode 100644 core/src/test/resources/bc_request_numericrange_exclusive_max_set.yaml create mode 100644 core/src/test/resources/bc_request_numericrange_exclusive_min_created.yaml create mode 100644 core/src/test/resources/bc_request_numericrange_exclusive_min_set.yaml create mode 100644 core/src/test/resources/bc_request_numericrange_max_added.yaml create mode 100644 core/src/test/resources/bc_request_numericrange_max_decreased.yaml create mode 100644 core/src/test/resources/bc_request_numericrange_min_added.yaml create mode 100644 core/src/test/resources/bc_request_numericrange_min_increased.yaml create mode 100644 core/src/test/resources/bc_request_oneof_decreased.yaml create mode 100644 core/src/test/resources/bc_request_param_allowemptyvalue_decreased.yaml create mode 100644 core/src/test/resources/bc_request_param_base.yaml create mode 100644 core/src/test/resources/bc_request_param_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_request_param_explode_changed.yaml create mode 100644 core/src/test/resources/bc_request_param_required_increased.yaml create mode 100644 core/src/test/resources/bc_request_param_style_changed.yaml create mode 100644 core/src/test/resources/bc_request_params_base.yaml create mode 100644 core/src/test/resources/bc_request_params_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_request_params_decreased.yaml create mode 100644 core/src/test/resources/bc_request_params_required_increased.yaml create mode 100644 core/src/test/resources/bc_request_readonly_increased.yaml create mode 100644 core/src/test/resources/bc_request_readonly_required_decreased.yaml create mode 100644 core/src/test/resources/bc_request_required_increased.yaml create mode 100644 core/src/test/resources/bc_request_schema_format_decreased.yaml create mode 100644 core/src/test/resources/bc_request_schema_format_increased.yaml create mode 100644 core/src/test/resources/bc_request_schema_props_put_increased.yaml create mode 100644 core/src/test/resources/bc_required_base.yaml create mode 100644 core/src/test/resources/bc_required_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_response_apiresponse_base.yaml create mode 100644 core/src/test/resources/bc_response_apiresponse_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_response_apiresponse_decreased.yaml create mode 100644 core/src/test/resources/bc_response_content_decreased.yaml create mode 100644 core/src/test/resources/bc_response_enum_increased.yaml create mode 100644 core/src/test/resources/bc_response_header_base.yaml create mode 100644 core/src/test/resources/bc_response_header_deprecated.yaml create mode 100644 core/src/test/resources/bc_response_header_explode.yaml create mode 100644 core/src/test/resources/bc_response_header_required_added.yaml create mode 100644 core/src/test/resources/bc_response_header_required_deleted.yaml create mode 100644 core/src/test/resources/bc_response_headers_base.yaml create mode 100644 core/src/test/resources/bc_response_headers_increased.yaml create mode 100644 core/src/test/resources/bc_response_headers_missing.yaml create mode 100644 core/src/test/resources/bc_response_maxlength_increased.yaml create mode 100644 core/src/test/resources/bc_response_numericrange_exclusive_max_deleted.yaml create mode 100644 core/src/test/resources/bc_response_numericrange_exclusive_max_unset.yaml create mode 100644 core/src/test/resources/bc_response_numericrange_exclusive_min_deleted.yaml create mode 100644 core/src/test/resources/bc_response_numericrange_exclusive_min_unset.yaml create mode 100644 core/src/test/resources/bc_response_numericrange_max_deleted.yaml create mode 100644 core/src/test/resources/bc_response_numericrange_max_increased.yaml create mode 100644 core/src/test/resources/bc_response_numericrange_min_decreased.yaml create mode 100644 core/src/test/resources/bc_response_numericrange_min_deleted.yaml create mode 100644 core/src/test/resources/bc_response_oneof_increased.yaml create mode 100644 core/src/test/resources/bc_response_required_decreased.yaml create mode 100644 core/src/test/resources/bc_response_schema_format_decreased.yaml create mode 100644 core/src/test/resources/bc_response_schema_format_increased.yaml create mode 100644 core/src/test/resources/bc_response_schema_props_required_decreased.yaml create mode 100644 core/src/test/resources/bc_response_writeonly_increased.yaml create mode 100644 core/src/test/resources/bc_response_writeonly_required_decreased.yaml create mode 100644 core/src/test/resources/bc_schema_base.yaml create mode 100644 core/src/test/resources/bc_schema_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_schema_discriminator_changed.yaml create mode 100644 core/src/test/resources/bc_schema_type_changed.yaml create mode 100644 core/src/test/resources/bc_security_requirement_base.yaml create mode 100644 core/src/test/resources/bc_security_requirement_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_security_requirement_schemes_increased.yaml create mode 100644 core/src/test/resources/bc_security_requirements_base.yaml create mode 100644 core/src/test/resources/bc_security_requirements_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_security_requirements_decreased.yaml create mode 100644 core/src/test/resources/bc_security_requirements_scheme_type_changed.yaml create mode 100644 core/src/test/resources/bc_security_scheme_base.yaml create mode 100644 core/src/test/resources/bc_security_scheme_bearer_format_changed.yaml create mode 100644 core/src/test/resources/bc_security_scheme_changed_but_compatible.yaml create mode 100644 core/src/test/resources/bc_security_scheme_in_changed.yaml create mode 100644 core/src/test/resources/bc_security_scheme_open_id_connect_url_changed.yaml create mode 100644 core/src/test/resources/bc_security_scheme_scheme_changed.yaml create mode 100644 core/src/test/resources/bc_security_scheme_scopes_increased.yaml create mode 100644 core/src/test/resources/bc_security_scheme_type_changed.yaml create mode 100644 core/src/test/resources/bc_writeonly_base.yaml create mode 100644 core/src/test/resources/bc_writeonly_changed_but_compatible.yaml diff --git a/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSecurityScheme.java b/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSecurityScheme.java index f4a1682f..2850e0f1 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSecurityScheme.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSecurityScheme.java @@ -44,6 +44,13 @@ public DiffResult isCoreChanged() { && !changedBearerFormat && !changedOpenIdConnectUrl && (changedScopes == null || changedScopes.getIncreased().isEmpty())) { + + // TODO: Dead code removal opportunity for changedType and changedIn. It appears that + // SecuritySchemaDiff will never be given the chance to detect differences TYPE and + // IN differences because that case has already been detected and filtered out by + // SecurityRequirementsDiff and recorded as a dropped requirement in + // ChangedSecurityRequirements. + return DiffResult.COMPATIBLE; } return DiffResult.INCOMPATIBLE; diff --git a/core/src/test/java/org/openapitools/openapidiff/core/BackwardCompatibilityTest.java b/core/src/test/java/org/openapitools/openapidiff/core/BackwardCompatibilityTest.java deleted file mode 100644 index 612700ca..00000000 --- a/core/src/test/java/org/openapitools/openapidiff/core/BackwardCompatibilityTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.openapitools.openapidiff.core; - -import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardCompatible; -import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; - -import org.junit.jupiter.api.Test; - -public class BackwardCompatibilityTest { - private final String OPENAPI_DOC1 = "backwardCompatibility/bc_1.yaml"; - private final String OPENAPI_DOC2 = "backwardCompatibility/bc_2.yaml"; - private final String OPENAPI_DOC3 = "backwardCompatibility/bc_3.yaml"; - private final String OPENAPI_DOC4 = "backwardCompatibility/bc_4.yaml"; - private final String OPENAPI_DOC5 = "backwardCompatibility/bc_5.yaml"; - - @Test - public void testNoChange() { - assertOpenApiBackwardCompatible(OPENAPI_DOC1, OPENAPI_DOC1, false); - } - - @Test - public void testApiAdded() { - assertOpenApiBackwardCompatible(OPENAPI_DOC1, OPENAPI_DOC2, true); - } - - @Test - public void testApiMissing() { - assertOpenApiBackwardIncompatible(OPENAPI_DOC2, OPENAPI_DOC1); - } - - @Test - public void testApiChangedOperationAdded() { - assertOpenApiBackwardCompatible(OPENAPI_DOC2, OPENAPI_DOC3, true); - } - - @Test - public void testApiChangedOperationMissing() { - assertOpenApiBackwardIncompatible(OPENAPI_DOC3, OPENAPI_DOC2); - } - - @Test - public void testApiOperationChanged() { - assertOpenApiBackwardCompatible(OPENAPI_DOC2, OPENAPI_DOC4, true); - } - - @Test - public void testApiReadWriteOnlyPropertiesChanged() { - assertOpenApiBackwardCompatible(OPENAPI_DOC1, OPENAPI_DOC5, true); - } -} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/TestUtils.java b/core/src/test/java/org/openapitools/openapidiff/core/TestUtils.java index 1180f288..5e07d0bc 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/TestUtils.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/TestUtils.java @@ -4,6 +4,7 @@ import static org.slf4j.LoggerFactory.getLogger; import org.openapitools.openapidiff.core.model.ChangedOpenApi; +import org.openapitools.openapidiff.core.model.DiffResult; import org.slf4j.Logger; public class TestUtils { @@ -25,6 +26,20 @@ public static void assertOpenApiChangedEndpoints(String oldSpec, String newSpec) assertThat(changedOpenApi.getChangedOperations()).isNotEmpty(); } + public static void assertSpecUnchanged(String oldSpec, String newSpec) { + ChangedOpenApi changedOpenApi = OpenApiCompare.fromLocations(oldSpec, newSpec); + LOG.info("Result: {}", changedOpenApi.isChanged().getValue()); + assertThat(changedOpenApi.isUnchanged()).isTrue(); + } + + public static void assertSpecChangedButCompatible(String oldSpec, String newSpec) { + ChangedOpenApi changedOpenApi = OpenApiCompare.fromLocations(oldSpec, newSpec); + DiffResult diffResult = changedOpenApi.isChanged(); + LOG.info("Result: {}", diffResult.getValue()); + assertThat(diffResult.isDifferent()).isTrue(); + assertThat(diffResult.isCompatible()).isTrue(); + } + public static void assertOpenApiBackwardCompatible( String oldSpec, String newSpec, boolean isDiff) { ChangedOpenApi changedOpenApi = OpenApiCompare.fromLocations(oldSpec, newSpec); diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ApiResponseBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ApiResponseBCTest.java new file mode 100644 index 00000000..c93bc5d4 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ApiResponseBCTest.java @@ -0,0 +1,26 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class ApiResponseBCTest { + private final String BASE = "bc_response_apiresponse_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_response_apiresponse_changed_but_compatible.yaml"); + } + + @Test + public void decreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_apiresponse_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ContentBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ContentBCTest.java new file mode 100644 index 00000000..130255b8 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ContentBCTest.java @@ -0,0 +1,31 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class ContentBCTest { + private final String BASE = "bc_content_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_content_changed_but_compatible.yaml"); + } + + @Test + public void requestDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_content_decreased.yaml"); + } + + @Test + public void responseDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_content_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/EnumBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/EnumBCTest.java new file mode 100644 index 00000000..3eecfda3 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/EnumBCTest.java @@ -0,0 +1,31 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class EnumBCTest { + private final String BASE = "bc_enum_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_enum_changed_but_compatible.yaml"); + } + + @Test + public void requestDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_enum_decreased.yaml"); + } + + @Test + public void responseIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_enum_increased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/HeaderBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/HeaderBCTest.java new file mode 100644 index 00000000..d97209d1 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/HeaderBCTest.java @@ -0,0 +1,37 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class HeaderBCTest { + private final String BASE = "bc_response_header_base.yaml"; + + @Test + public void responseHeaderUnchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void responseHeaderDeprecated() { + assertSpecChangedButCompatible(BASE, "bc_response_header_deprecated.yaml"); + } + + @Test + public void responseHeaderRequiredAdded() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_header_required_added.yaml"); + } + + @Test + public void responseHeaderRequiredDeleted() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_header_required_deleted.yaml"); + } + + @Test + public void responseHeaderExplode() { + String RESPONSE_HEADER_EXPLODE = "bc_response_header_explode.yaml"; + assertOpenApiBackwardIncompatible(BASE, RESPONSE_HEADER_EXPLODE); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/HeadersBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/HeadersBCTest.java new file mode 100644 index 00000000..b796a35e --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/HeadersBCTest.java @@ -0,0 +1,26 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class HeadersBCTest { + private final String BASE = "bc_response_headers_base.yaml"; + + @Test + public void responseHeadersUnchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void responseHeadersIncreased() { + assertSpecChangedButCompatible(BASE, "bc_response_headers_increased.yaml"); + } + + @Test + public void responseHeadersMissing() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_headers_missing.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/MaxLengthBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/MaxLengthBCTest.java new file mode 100644 index 00000000..96c019b4 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/MaxLengthBCTest.java @@ -0,0 +1,25 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class MaxLengthBCTest { + private final String BASE = "bc_maxlength_base.yaml"; + + @Test + public void maxLengthUnchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void requestMaxLengthDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_maxlength_decreased.yaml"); + } + + @Test + public void responseMaxLengthIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_maxlength_increased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/NumericRangeBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/NumericRangeBCTest.java new file mode 100644 index 00000000..1f713f98 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/NumericRangeBCTest.java @@ -0,0 +1,114 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class NumericRangeBCTest { + private final String BASE = "bc_numericrange_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + // TODO: Fix bug where response range-narrowing is deemed incompatible, then test here + assertSpecChangedButCompatible(BASE, "bc_numericrange_changed_but_compatible.yaml"); + } + + @Test + public void requestExclusiveMaxCreated() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_exclusive_max_created.yaml"); + } + + @Test + public void requestExclusiveMaxSet() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_exclusive_max_set.yaml"); + } + + @Test + public void requestExclusiveMinCreated() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_exclusive_min_created.yaml"); + } + + @Test + public void requestExclusiveMinSet() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_exclusive_min_set.yaml"); + } + + @Test + public void requestMaxAdded() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_max_added.yaml"); + } + + @Test + public void requestMaxDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_max_decreased.yaml"); + } + + @Test + public void requestMinAdded() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_min_added.yaml"); + } + + @Test + public void requestMinIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_numericrange_min_increased.yaml"); + } + + @Test + public void responseExclusiveMaxDeleted() { + // TODO: Should be incompatible because clients may be unprepared for wider range + // (test added to avoid unintentional regression) + assertSpecChangedButCompatible(BASE, "bc_response_numericrange_exclusive_max_deleted.yaml"); + } + + @Test + public void responseExclusiveMaxUnset() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_numericrange_exclusive_max_unset.yaml"); + } + + @Test + public void responseExclusiveMinDeleted() { + // TODO: Should be incompatible because clients may be unprepared for wider range + // (test added to avoid unintentional regression) + assertSpecChangedButCompatible(BASE, "bc_response_numericrange_exclusive_min_deleted.yaml"); + } + + @Test + public void responseExclusiveMinUnset() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_numericrange_exclusive_min_unset.yaml"); + } + + @Test + public void responseMaxDeleted() { + // TODO: Should be incompatible because clients may be unprepared for wider range + // (test added to avoid unintentional regression) + assertSpecChangedButCompatible(BASE, "bc_response_numericrange_max_deleted.yaml"); + } + + @Test + public void responseMaxIncreased() { + // TODO: Should be incompatible because clients may be unprepared + // (test added to avoid unintentional regression) + assertSpecChangedButCompatible(BASE, "bc_response_numericrange_max_increased.yaml"); + } + + @Test + public void responseMinDecreased() { + // TODO: Should be incompatible because clients may be unprepared for wider range + // (test added to avoid unintentional regression) + assertSpecChangedButCompatible(BASE, "bc_response_numericrange_min_decreased.yaml"); + } + + @Test + public void responseMinDeleted() { + // TODO: Should be incompatible because clients may be unprepared for wider range + // (test added to avoid unintentional regression) + assertSpecChangedButCompatible(BASE, "bc_response_numericrange_min_deleted.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OAuthFlowBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OAuthFlowBCTest.java new file mode 100644 index 00000000..62cf3b9a --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OAuthFlowBCTest.java @@ -0,0 +1,30 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class OAuthFlowBCTest { + private final String BASE = "bc_oauthflow_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void authorizationUrlChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_oauthflow_authorization_url_changed.yaml"); + } + + @Test + public void refreshUrlChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_oauthflow_refresh_url_changed.yaml"); + } + + @Test + public void tokenUrlChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_oauthflow_token_url_changed.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OneOfBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OneOfBCTest.java new file mode 100644 index 00000000..e42829cc --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OneOfBCTest.java @@ -0,0 +1,31 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class OneOfBCTest { + private final String BASE = "bc_oneof_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_oneof_changed_but_compatible.yaml"); + } + + @Test + public void requestOneOfDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_oneof_decreased.yaml"); + } + + @Test + public void responseOneOfIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_oneof_increased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OpenApiBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OpenApiBCTest.java new file mode 100644 index 00000000..0cb493aa --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OpenApiBCTest.java @@ -0,0 +1,26 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class OpenApiBCTest { + private final String BASE = "bc_openapi_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_openapi_changed_but_compatible.yaml"); + } + + @Test + public void endpointsDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_openapi_endpoints_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OperationBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OperationBCTest.java new file mode 100644 index 00000000..c95d8c9d --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/OperationBCTest.java @@ -0,0 +1,20 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class OperationBCTest { + private final String BASE = "bc_operation_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_operation_changed_but_compatible.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ParameterBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ParameterBCTest.java new file mode 100644 index 00000000..4f1d3085 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ParameterBCTest.java @@ -0,0 +1,41 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class ParameterBCTest { + private final String BASE = "bc_request_param_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_request_param_changed_but_compatible.yaml"); + } + + @Test + public void allowEmptyValueDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_param_allowemptyvalue_decreased.yaml"); + } + + @Test + public void explodeChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_param_explode_changed.yaml"); + } + + @Test + public void requiredIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_param_required_increased.yaml"); + } + + @Test + public void styleChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_param_style_changed.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ParametersBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ParametersBCTest.java new file mode 100644 index 00000000..1b913115 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ParametersBCTest.java @@ -0,0 +1,31 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class ParametersBCTest { + private final String BASE = "bc_request_params_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_request_params_changed_but_compatible.yaml"); + } + + @Test + public void decreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_params_decreased.yaml"); + } + + @Test + public void requiredIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_params_required_increased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/PathBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/PathBCTest.java new file mode 100644 index 00000000..b0b9ab39 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/PathBCTest.java @@ -0,0 +1,26 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class PathBCTest { + private final String BASE = "bc_path_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_path_changed_but_compatible.yaml"); + } + + @Test + public void opsDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_path_ops_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/PathsBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/PathsBCTest.java new file mode 100644 index 00000000..495739d1 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/PathsBCTest.java @@ -0,0 +1,26 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class PathsBCTest { + private final String BASE = "bc_paths_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_paths_changed_but_compatible.yaml"); + } + + @Test + public void decreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_paths_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ReadOnlyBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ReadOnlyBCTest.java new file mode 100644 index 00000000..579a7e17 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/ReadOnlyBCTest.java @@ -0,0 +1,32 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class ReadOnlyBCTest { + private final String BASE = "bc_readonly_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_readonly_changed_but_compatible.yaml"); + } + + @Test + public void requestReadOnlyIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_readonly_increased.yaml"); + } + + @Test + public void requestReadOnlyRequiredDecreased() { + // TODO: Document why desired or remove support (test added to avoid unintentional regression) + assertOpenApiBackwardIncompatible(BASE, "bc_request_readonly_required_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/RequestBodyBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/RequestBodyBCTest.java new file mode 100644 index 00000000..b02c0a3e --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/RequestBodyBCTest.java @@ -0,0 +1,20 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class RequestBodyBCTest { + private final String BASE = "bc_request_body_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void requiredChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_body_required_changed.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/RequiredBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/RequiredBCTest.java new file mode 100644 index 00000000..bda8b2d8 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/RequiredBCTest.java @@ -0,0 +1,32 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class RequiredBCTest { + + private final String BASE = "bc_required_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_required_changed_but_compatible.yaml"); + } + + @Test + public void requestRequiredIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_required_increased.yaml"); + } + + @Test + public void responseRequiredDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_required_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SchemaBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SchemaBCTest.java new file mode 100644 index 00000000..cec27bc7 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SchemaBCTest.java @@ -0,0 +1,65 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class SchemaBCTest { + private final String BASE = "bc_schema_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_schema_changed_but_compatible.yaml"); + } + + @Test + public void discriminatorChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_schema_discriminator_changed.yaml"); + } + + @Test + public void requestFormatDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_request_schema_format_decreased.yaml"); + } + + @Test + public void requestFormatIncreased() { + // TODO: Document why desired or remove support (test added to avoid unintentional regression) + assertOpenApiBackwardIncompatible(BASE, "bc_request_schema_format_increased.yaml"); + } + + @Test + public void requestPropsPutIncreased() { + // TODO: Document why desired or remove support (test added to avoid unintentional regression) + // See https://github.com/OpenAPITools/openapi-diff/issues/537 + assertOpenApiBackwardIncompatible(BASE, "bc_request_schema_props_put_increased.yaml"); + } + + @Test + public void responseFormatDecreased() { + // TODO: Document why desired or remove support (test added to avoid unintentional regression) + assertOpenApiBackwardIncompatible(BASE, "bc_response_schema_format_decreased.yaml"); + } + + @Test + public void responseFormatIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_schema_format_increased.yaml"); + } + + @Test + public void responsePropsRequiredDecreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_schema_props_required_decreased.yaml"); + } + + @Test + public void typeChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_schema_type_changed.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecurityRequirementBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecurityRequirementBCTest.java new file mode 100644 index 00000000..80c79cec --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecurityRequirementBCTest.java @@ -0,0 +1,24 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.*; + +import org.junit.jupiter.api.Test; + +public class SecurityRequirementBCTest { + private final String BASE = "bc_security_requirement_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_security_requirement_changed_but_compatible.yaml"); + } + + @Test + public void schemesIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_requirement_schemes_increased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecurityRequirementsBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecurityRequirementsBCTest.java new file mode 100644 index 00000000..a9df11df --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecurityRequirementsBCTest.java @@ -0,0 +1,38 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class SecurityRequirementsBCTest { + private final String BASE = "bc_security_requirements_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_security_requirements_changed_but_compatible.yaml"); + } + + // TODO: Dropping *all* security requirements should be compatible. Refactor or document + // reasoning. Context: OAS spec is clear that only one of the security requirement objects + // need to be satisfied so it makes sense why dropping one could break a client that may + // not yet support one of the remaining referenced security schemes. But dropping all + // requirements should be compatible. + @Test + public void decreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_requirements_decreased.yaml"); + } + + // TODO: A missing incompatible check seems to be if requirements increase from zero to 1 or more + + @Test + public void schemeTypeChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_requirements_scheme_type_changed.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecuritySchemeBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecuritySchemeBCTest.java new file mode 100644 index 00000000..b275523d --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SecuritySchemeBCTest.java @@ -0,0 +1,51 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class SecuritySchemeBCTest { + private final String BASE = "bc_security_scheme_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_security_scheme_changed_but_compatible.yaml"); + } + + @Test + public void bearerFormatChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_scheme_bearer_format_changed.yaml"); + } + + @Test + public void inChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_scheme_in_changed.yaml"); + } + + @Test + public void openIdConnectUrlChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_scheme_open_id_connect_url_changed.yaml"); + } + + @Test + public void schemeChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_scheme_scheme_changed.yaml"); + } + + @Test + public void typeChanged() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_scheme_type_changed.yaml"); + } + + @Test + public void scopesIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_security_scheme_scopes_increased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/WriteOnlyBCTest.java b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/WriteOnlyBCTest.java new file mode 100644 index 00000000..f3ea427f --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/WriteOnlyBCTest.java @@ -0,0 +1,32 @@ +package org.openapitools.openapidiff.core.backcompat; + +import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible; +import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; + +import org.junit.jupiter.api.Test; + +public class WriteOnlyBCTest { + private final String BASE = "bc_writeonly_base.yaml"; + + @Test + public void unchanged() { + assertSpecUnchanged(BASE, BASE); + } + + @Test + public void changedButCompatible() { + assertSpecChangedButCompatible(BASE, "bc_writeonly_changed_but_compatible.yaml"); + } + + @Test + public void responseWriteOnlyIncreased() { + assertOpenApiBackwardIncompatible(BASE, "bc_response_writeonly_increased.yaml"); + } + + @Test + public void responseWriteOnlyRequiredDecreased() { + // TODO: Document why desired or remove support (test added to avoid unintentional regression) + assertOpenApiBackwardIncompatible(BASE, "bc_response_writeonly_required_decreased.yaml"); + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/compare/ApiResponseDiffTest.java b/core/src/test/java/org/openapitools/openapidiff/core/compare/ApiResponseDiffTest.java deleted file mode 100644 index 97b8ab09..00000000 --- a/core/src/test/java/org/openapitools/openapidiff/core/compare/ApiResponseDiffTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.openapitools.openapidiff.core.compare; - -import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardCompatible; -import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -class ApiResponseDiffTest extends Assertions { - /** - * * This is a regression test - when no responses were set, we would get an exception since the - * OpenAPI object has a `null` ApiResponses field. - */ - @Test - public void testNoResponseInPrevious() { - // The previous API had no response, so adding a response shape is still compatible. - assertOpenApiBackwardCompatible( - "backwardCompatibility/apiResponse_diff_1.yaml", - "backwardCompatibility/apiResponse_diff_2.yaml", - true); - - // Removing the response shape is backwards incompatible. - assertOpenApiBackwardIncompatible( - "backwardCompatibility/apiResponse_diff_2.yaml", - "backwardCompatibility/apiResponse_diff_1.yaml"); - } -} diff --git a/core/src/test/resources/backwardCompatibility/apiResponse_diff_1.yaml b/core/src/test/resources/backwardCompatibility/apiResponse_diff_1.yaml deleted file mode 100644 index fb1e6047..00000000 --- a/core/src/test/resources/backwardCompatibility/apiResponse_diff_1.yaml +++ /dev/null @@ -1,7 +0,0 @@ -openapi: 3.0.0 -info: - title: Swagger Petstore -paths: - /store/inventory: - get: - operationId: asdf \ No newline at end of file diff --git a/core/src/test/resources/backwardCompatibility/apiResponse_diff_2.yaml b/core/src/test/resources/backwardCompatibility/apiResponse_diff_2.yaml deleted file mode 100644 index 82da7cfd..00000000 --- a/core/src/test/resources/backwardCompatibility/apiResponse_diff_2.yaml +++ /dev/null @@ -1,15 +0,0 @@ -openapi: 3.0.0 -info: - title: Swagger Petstore -paths: - /store/inventory: - get: - responses: - '200': - content: - application/json: - schema: - type: object - properties: - title: - type: string \ No newline at end of file diff --git a/core/src/test/resources/backwardCompatibility/bc_1.yaml b/core/src/test/resources/backwardCompatibility/bc_1.yaml deleted file mode 100644 index 8247d2fc..00000000 --- a/core/src/test/resources/backwardCompatibility/bc_1.yaml +++ /dev/null @@ -1,132 +0,0 @@ -openapi: 3.0.0 -servers: - - url: 'http://petstore.swagger.io/v2' -info: - description: >- - This is a sample server Petstore server. You can find out more about - Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, - #swagger](http://swagger.io/irc/). For this sample, you can use the api key - `special-key` to test the authorization filters. - version: 1.0.0 - title: Swagger Petstore - termsOfService: 'http://swagger.io/terms/' - contact: - email: apiteam@swagger.io - license: - name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' -tags: - - name: pet - description: Everything about your Pets - externalDocs: - description: Find out more - url: 'http://swagger.io' - - name: store - description: Access to Petstore orders - - name: user - description: Operations about user - externalDocs: - description: Find out more about our store - url: 'http://swagger.io' -paths: - /pet/findByStatus: - get: - tags: - - pet - summary: Finds Pets by status - description: Multiple status values can be provided with comma separated strings - operationId: findPetsByStatus - parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true - explode: true - schema: - type: array - items: - type: string - maxLength: 16 - responses: - '200': - description: successful operation - content: - application/json: - schema: - type: object - properties: - pets: - type: array - items: - $ref: '#/components/schemas/Dog' - '400': - description: Invalid status value - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' -externalDocs: - description: Find out more about Swagger - url: 'http://swagger.io' -components: - requestBodies: - Pet: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: 'http://petstore.swagger.io/oauth/dialog' - scopes: - 'write:pets': modify pets in your account - 'read:pets': read your pets - api_key: - type: apiKey - name: api_key - in: header - schemas: - Pet: - type: object - required: - - pet_type - properties: - pet_type: - type: string - discriminator: - propertyName: pet_type - mapping: - cachorro: Dog - Cat: - type: object - properties: - name: - type: string - Dog: - type: object - properties: - bark: - type: string - test: - writeOnly: true - type: string - Lizard: - type: object - properties: - lovesRocks: - type: boolean - - MyResponseType: - oneOf: - - $ref: '#/components/schemas/Cat' - - $ref: '#/components/schemas/Dog' - - $ref: '#/components/schemas/Lizard' - discriminator: - propertyName: pet_type - mapping: - dog: '#/components/schemas/Dog' \ No newline at end of file diff --git a/core/src/test/resources/backwardCompatibility/bc_2.yaml b/core/src/test/resources/backwardCompatibility/bc_2.yaml deleted file mode 100644 index 179f3ca3..00000000 --- a/core/src/test/resources/backwardCompatibility/bc_2.yaml +++ /dev/null @@ -1,150 +0,0 @@ -openapi: 3.0.0 -servers: - - url: 'http://petstore.swagger.io/v2' -info: - description: >- - This is a sample server Petstore server. You can find out more about - Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, - #swagger](http://swagger.io/irc/). For this sample, you can use the api key - `special-key` to test the authorization filters. - version: 1.0.0 - title: Swagger Petstore - termsOfService: 'http://swagger.io/terms/' - contact: - email: apiteam@swagger.io - license: - name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' -tags: - - name: pet - description: Everything about your Pets - externalDocs: - description: Find out more - url: 'http://swagger.io' - - name: store - description: Access to Petstore orders - - name: user - description: Operations about user - externalDocs: - description: Find out more about our store - url: 'http://swagger.io' -paths: - /pet: - post: - tags: - - pet - summary: Add a new pet to the store - description: '' - operationId: addPet - requestBody: - $ref: '#/components/requestBodies/Pet' - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/MyResponseType' - '405': - description: Invalid input - /pet/findByStatus: - get: - tags: - - pet - summary: Finds Pets by status - description: Multiple status values can be provided with comma separated strings - operationId: findPetsByStatus - parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true - explode: true - schema: - type: array - items: - type: string - maxLength: 24 - responses: - '200': - description: successful operation - content: - application/json: - schema: - type: object - properties: - pets: - type: array - items: - $ref: '#/components/schemas/Dog' - '400': - description: Invalid status value - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' -externalDocs: - description: Find out more about Swagger - url: 'http://swagger.io' -components: - requestBodies: - Pet: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: 'http://petstore.swagger.io/oauth/dialog' - scopes: - 'write:pets': modify pets in your account - 'read:pets': read your pets - api_key: - type: apiKey - name: api_key - in: header - schemas: - Pet: - type: object - required: - - pet_type - properties: - pet_type: - type: string - discriminator: - propertyName: pet_type - mapping: - cachorro: Dog - Cat: - type: object - properties: - name: - type: string - Dog: - type: object - properties: - bark: - type: string - test: - writeOnly: true - type: string - Lizard: - type: object - properties: - lovesRocks: - type: boolean - - MyResponseType: - oneOf: - - $ref: '#/components/schemas/Cat' - - $ref: '#/components/schemas/Dog' - - $ref: '#/components/schemas/Lizard' - discriminator: - propertyName: pet_type - mapping: - dog: '#/components/schemas/Dog' \ No newline at end of file diff --git a/core/src/test/resources/backwardCompatibility/bc_3.yaml b/core/src/test/resources/backwardCompatibility/bc_3.yaml deleted file mode 100644 index 30a68ced..00000000 --- a/core/src/test/resources/backwardCompatibility/bc_3.yaml +++ /dev/null @@ -1,163 +0,0 @@ -openapi: 3.0.0 -servers: - - url: 'http://petstore.swagger.io/v2' -info: - description: >- - This is a sample server Petstore server. You can find out more about - Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, - #swagger](http://swagger.io/irc/). For this sample, you can use the api key - `special-key` to test the authorization filters. - version: 1.0.0 - title: Swagger Petstore - termsOfService: 'http://swagger.io/terms/' - contact: - email: apiteam@swagger.io - license: - name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' -tags: - - name: pet - description: Everything about your Pets - externalDocs: - description: Find out more - url: 'http://swagger.io' - - name: store - description: Access to Petstore orders - - name: user - description: Operations about user - externalDocs: - description: Find out more about our store - url: 'http://swagger.io' -paths: - /pet: - post: - tags: - - pet - summary: Add a new pet to the store - description: '' - operationId: addPet - requestBody: - $ref: '#/components/requestBodies/Pet' - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/MyResponseType' - '405': - description: Invalid input - get: - tags: - - pet - summary: Finds Pets by name - description: name can be provided for the pet - operationId: getPet - parameters: - - name: name - in: query - description: name that need to be considered for filter - required: true - schema: - type: string - /pet/findByStatus: - get: - tags: - - pet - summary: Finds Pets by status - description: Multiple status values can be provided with comma separated strings - operationId: findPetsByStatus - parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true - explode: true - schema: - type: array - items: - type: string - maxLength: 36 - responses: - '200': - description: successful operation - content: - application/json: - schema: - type: object - properties: - pets: - type: array - items: - $ref: '#/components/schemas/Dog' - '400': - description: Invalid status value - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' -externalDocs: - description: Find out more about Swagger - url: 'http://swagger.io' -components: - requestBodies: - Pet: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: 'http://petstore.swagger.io/oauth/dialog' - scopes: - 'write:pets': modify pets in your account - 'read:pets': read your pets - api_key: - type: apiKey - name: api_key - in: header - schemas: - Pet: - type: object - required: - - pet_type - properties: - pet_type: - type: string - discriminator: - propertyName: pet_type - mapping: - cachorro: Dog - Cat: - type: object - properties: - name: - type: string - Dog: - type: object - properties: - bark: - type: string - test: - writeOnly: true - type: string - Lizard: - type: object - properties: - lovesRocks: - type: boolean - - MyResponseType: - oneOf: - - $ref: '#/components/schemas/Cat' - - $ref: '#/components/schemas/Dog' - - $ref: '#/components/schemas/Lizard' - discriminator: - propertyName: pet_type - mapping: - dog: '#/components/schemas/Dog' \ No newline at end of file diff --git a/core/src/test/resources/backwardCompatibility/bc_4.yaml b/core/src/test/resources/backwardCompatibility/bc_4.yaml deleted file mode 100644 index 4e6ee3e1..00000000 --- a/core/src/test/resources/backwardCompatibility/bc_4.yaml +++ /dev/null @@ -1,155 +0,0 @@ -openapi: 3.0.0 -servers: - - url: 'http://petstore.swagger.io/v2' -info: - description: >- - This is a sample server Petstore server. You can find out more about - Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, - #swagger](http://swagger.io/irc/). For this sample, you can use the api key - `special-key` to test the authorization filters. - version: 1.0.0 - title: Swagger Petstore - termsOfService: 'http://swagger.io/terms/' - contact: - email: apiteam@swagger.io - license: - name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' -tags: - - name: pet - description: Everything about your Pets - externalDocs: - description: Find out more - url: 'http://swagger.io' - - name: store - description: Access to Petstore orders - - name: user - description: Operations about user - externalDocs: - description: Find out more about our store - url: 'http://swagger.io' -paths: - /pet: - post: - tags: - - pet - summary: Add a new pet to the store - description: '' - operationId: addPet - requestBody: - $ref: '#/components/requestBodies/Pet' - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/MyResponseType' - '405': - description: Invalid input - /pet/findByStatus: - get: - tags: - - pet - summary: Finds Pets by status - description: Multiple status values can be provided with comma separated strings - operationId: findPetsByStatus - parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true - explode: true - schema: - type: array - items: - type: string - enum: - - available - - pending - - sold - default: available - responses: - '200': - description: successful operation - content: - application/json: - schema: - type: object - properties: - pets: - type: array - items: - $ref: '#/components/schemas/Dog' - '400': - description: Invalid status value - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' -externalDocs: - description: Find out more about Swagger - url: 'http://swagger.io' -components: - requestBodies: - Pet: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: 'http://petstore.swagger.io/oauth/dialog' - scopes: - 'write:pets': modify pets in your account - 'read:pets': read your pets - api_key: - type: apiKey - name: api_key - in: header - schemas: - Pet: - type: object - required: - - pet_type - properties: - pet_type: - type: string - discriminator: - propertyName: pet_type - mapping: - cachorro: Dog - Cat: - type: object - properties: - name: - type: string - deprecated: true - Dog: - type: object - properties: - bark: - type: string - test: - writeOnly: true - type: string - Lizard: - type: object - properties: - lovesRocks: - type: boolean - - MyResponseType: - oneOf: - - $ref: '#/components/schemas/Cat' - - $ref: '#/components/schemas/Dog' - - $ref: '#/components/schemas/Lizard' - discriminator: - propertyName: pet_type - mapping: - dog: '#/components/schemas/Dog' \ No newline at end of file diff --git a/core/src/test/resources/backwardCompatibility/bc_5.yaml b/core/src/test/resources/backwardCompatibility/bc_5.yaml deleted file mode 100644 index 6b282ba4..00000000 --- a/core/src/test/resources/backwardCompatibility/bc_5.yaml +++ /dev/null @@ -1,131 +0,0 @@ -openapi: 3.0.0 -servers: - - url: 'http://petstore.swagger.io/v2' -info: - description: >- - This is a sample server Petstore server. You can find out more about - Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, - #swagger](http://swagger.io/irc/). For this sample, you can use the api key - `special-key` to test the authorization filters. - version: 1.0.0 - title: Swagger Petstore - termsOfService: 'http://swagger.io/terms/' - contact: - email: apiteam@swagger.io - license: - name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' -tags: - - name: pet - description: Everything about your Pets - externalDocs: - description: Find out more - url: 'http://swagger.io' - - name: store - description: Access to Petstore orders - - name: user - description: Operations about user - externalDocs: - description: Find out more about our store - url: 'http://swagger.io' -paths: - /pet/findByStatus: - get: - tags: - - pet - summary: Finds Pets by status - description: Multiple status values can be provided with comma separated strings - operationId: findPetsByStatus - parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true - explode: true - schema: - type: array - items: - type: string - maxLength: 16 - responses: - '200': - description: successful operation - content: - application/json: - schema: - type: object - properties: - pets: - type: array - items: - $ref: '#/components/schemas/Dog' - '400': - description: Invalid status value - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' -externalDocs: - description: Find out more about Swagger - url: 'http://swagger.io' -components: - requestBodies: - Pet: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true - securitySchemes: - petstore_auth: - type: oauth2 - flows: - implicit: - authorizationUrl: 'http://petstore.swagger.io/oauth/dialog' - scopes: - 'write:pets': modify pets in your account - 'read:pets': read your pets - api_key: - type: apiKey - name: api_key - in: header - schemas: - Pet: - type: object - required: - - pet_type - properties: - pet_type: - type: string - discriminator: - propertyName: pet_type - mapping: - cachorro: Dog - Cat: - type: object - properties: - name: - type: string - Dog: - type: object - properties: - bark: - type: string - test: - type: string - Lizard: - type: object - properties: - lovesRocks: - type: boolean - - MyResponseType: - oneOf: - - $ref: '#/components/schemas/Cat' - - $ref: '#/components/schemas/Dog' - - $ref: '#/components/schemas/Lizard' - discriminator: - propertyName: pet_type - mapping: - dog: '#/components/schemas/Dog' \ No newline at end of file diff --git a/core/src/test/resources/bc_content_base.yaml b/core/src/test/resources/bc_content_base.yaml new file mode 100644 index 00000000..82634f2a --- /dev/null +++ b/core/src/test/resources/bc_content_base.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + application/text: + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + application/text: + schema: + type: string diff --git a/core/src/test/resources/bc_content_changed_but_compatible.yaml b/core/src/test/resources/bc_content_changed_but_compatible.yaml new file mode 100644 index 00000000..8300fbad --- /dev/null +++ b/core/src/test/resources/bc_content_changed_but_compatible.yaml @@ -0,0 +1,35 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + application/text: + schema: + type: string + application/xml: + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + application/text: + schema: + type: string + application/xml: + schema: + type: string diff --git a/core/src/test/resources/bc_enum_base.yaml b/core/src/test/resources/bc_enum_base.yaml new file mode 100644 index 00000000..fe020824 --- /dev/null +++ b/core/src/test/resources/bc_enum_base.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: param-inline-enum + in: query + required: true + schema: + type: string + enum: + - param-inline-enum-val-1 + - param-inline-enum-val-2 + default: param-inline-enum-val-1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + enum-prop: + type: string + enum: + - enum-prop-val-1 + - enum-prop-val-2 + default: enum-prop-val-1 diff --git a/core/src/test/resources/bc_enum_changed_but_compatible.yaml b/core/src/test/resources/bc_enum_changed_but_compatible.yaml new file mode 100644 index 00000000..7fd9b1da --- /dev/null +++ b/core/src/test/resources/bc_enum_changed_but_compatible.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: param-inline-enum + in: query + required: true + schema: + type: string + enum: + - param-inline-enum-val-1 + - param-inline-enum-val-2 + - param-inline-enum-val-3 + default: param-inline-enum-val-1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + enum-prop: + type: string + enum: + - enum-prop-val-1 + default: enum-prop-val-1 diff --git a/core/src/test/resources/bc_maxlength_base.yaml b/core/src/test/resources/bc_maxlength_base.yaml new file mode 100644 index 00000000..583adca5 --- /dev/null +++ b/core/src/test/resources/bc_maxlength_base.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: string + maxLength: 16 + application/xml: + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + maxLength: 16 + application/xml: + schema: + type: string diff --git a/core/src/test/resources/bc_numericrange_base.yaml b/core/src/test/resources/bc_numericrange_base.yaml new file mode 100644 index 00000000..e03c5939 --- /dev/null +++ b/core/src/test/resources/bc_numericrange_base.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_numericrange_changed_but_compatible.yaml b/core/src/test/resources/bc_numericrange_changed_but_compatible.yaml new file mode 100644 index 00000000..b38f2fe9 --- /dev/null +++ b/core/src/test/resources/bc_numericrange_changed_but_compatible.yaml @@ -0,0 +1,57 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 9 + maximum: 21 + application/xml: + schema: + type: integer + format: int32 + minimum: 9 + maximum: 21 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + # TODO: Narrowing response range fails as incompatible, but shouldn't it be ok? + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + # TODO: Narrowing response range fails as incompatible, but shouldn't it be ok? + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_oauthflow_authorization_url_changed.yaml b/core/src/test/resources/bc_oauthflow_authorization_url_changed.yaml new file mode 100644 index 00000000..d14957ee --- /dev/null +++ b/core/src/test/resources/bc_oauthflow_authorization_url_changed.yaml @@ -0,0 +1,28 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - oauth2-scheme-1: [] +components: + securitySchemes: + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/authorization2 + refreshUrl: https://example.com/api/oauth/refresh + tokenUrl: https://example.com/api/oauth/token + scopes: {} diff --git a/core/src/test/resources/bc_oauthflow_base.yaml b/core/src/test/resources/bc_oauthflow_base.yaml new file mode 100644 index 00000000..40c7509b --- /dev/null +++ b/core/src/test/resources/bc_oauthflow_base.yaml @@ -0,0 +1,28 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - oauth2-scheme-1: [] +components: + securitySchemes: + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/authorization + refreshUrl: https://example.com/api/oauth/refresh + tokenUrl: https://example.com/api/oauth/token + scopes: {} diff --git a/core/src/test/resources/bc_oauthflow_refresh_url_changed.yaml b/core/src/test/resources/bc_oauthflow_refresh_url_changed.yaml new file mode 100644 index 00000000..bde8f228 --- /dev/null +++ b/core/src/test/resources/bc_oauthflow_refresh_url_changed.yaml @@ -0,0 +1,28 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - oauth2-scheme-1: [] +components: + securitySchemes: + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/authorization + refreshUrl: https://example.com/api/oauth/refresh2 + tokenUrl: https://example.com/api/oauth/token + scopes: {} diff --git a/core/src/test/resources/bc_oauthflow_token_url_changed.yaml b/core/src/test/resources/bc_oauthflow_token_url_changed.yaml new file mode 100644 index 00000000..6992e3c0 --- /dev/null +++ b/core/src/test/resources/bc_oauthflow_token_url_changed.yaml @@ -0,0 +1,28 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - oauth2-scheme-1: [] +components: + securitySchemes: + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/authorization + refreshUrl: https://example.com/api/oauth/refresh + tokenUrl: https://example.com/api/oauth/token2 + scopes: {} diff --git a/core/src/test/resources/bc_oneof_base.yaml b/core/src/test/resources/bc_oneof_base.yaml new file mode 100644 index 00000000..b5ef92c3 --- /dev/null +++ b/core/src/test/resources/bc_oneof_base.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' +components: + schemas: + WidgetCreateRequest: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + WidgetCreateResponse: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + Doodad: + type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_oneof_changed_but_compatible.yaml b/core/src/test/resources/bc_oneof_changed_but_compatible.yaml new file mode 100644 index 00000000..78468ebe --- /dev/null +++ b/core/src/test/resources/bc_oneof_changed_but_compatible.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' +components: + schemas: + WidgetCreateRequest: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + - $ref: '#/components/schemas/Gizmo' + WidgetCreateResponse: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + Doodad: + type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_openapi_base.yaml b/core/src/test/resources/bc_openapi_base.yaml new file mode 100644 index 00000000..78e86b94 --- /dev/null +++ b/core/src/test/resources/bc_openapi_base.yaml @@ -0,0 +1,25 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + post: + operationId: widgetCreate + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_openapi_changed_but_compatible.yaml b/core/src/test/resources/bc_openapi_changed_but_compatible.yaml new file mode 100644 index 00000000..5b5dfffc --- /dev/null +++ b/core/src/test/resources/bc_openapi_changed_but_compatible.yaml @@ -0,0 +1,35 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + post: + operationId: widgetCreate + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + /widgets/{id}: + get: + operationId: getWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_openapi_endpoints_decreased.yaml b/core/src/test/resources/bc_openapi_endpoints_decreased.yaml new file mode 100644 index 00000000..bd33b69d --- /dev/null +++ b/core/src/test/resources/bc_openapi_endpoints_decreased.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_operation_base.yaml b/core/src/test/resources/bc_operation_base.yaml new file mode 100644 index 00000000..eb640330 --- /dev/null +++ b/core/src/test/resources/bc_operation_base.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_operation_changed_but_compatible.yaml b/core/src/test/resources/bc_operation_changed_but_compatible.yaml new file mode 100644 index 00000000..2d99878b --- /dev/null +++ b/core/src/test/resources/bc_operation_changed_but_compatible.yaml @@ -0,0 +1,17 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + deprecated: true + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_path_base.yaml b/core/src/test/resources/bc_path_base.yaml new file mode 100644 index 00000000..78e86b94 --- /dev/null +++ b/core/src/test/resources/bc_path_base.yaml @@ -0,0 +1,25 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + post: + operationId: widgetCreate + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_path_changed_but_compatible.yaml b/core/src/test/resources/bc_path_changed_but_compatible.yaml new file mode 100644 index 00000000..d2ae9801 --- /dev/null +++ b/core/src/test/resources/bc_path_changed_but_compatible.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + post: + operationId: widgetCreate + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + put: + operationId: widgetUpdate + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_path_ops_decreased.yaml b/core/src/test/resources/bc_path_ops_decreased.yaml new file mode 100644 index 00000000..eb640330 --- /dev/null +++ b/core/src/test/resources/bc_path_ops_decreased.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_paths_base.yaml b/core/src/test/resources/bc_paths_base.yaml new file mode 100644 index 00000000..451f6631 --- /dev/null +++ b/core/src/test/resources/bc_paths_base.yaml @@ -0,0 +1,26 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + /widgets/{id}: + get: + operationId: getWidget + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_paths_changed_but_compatible.yaml b/core/src/test/resources/bc_paths_changed_but_compatible.yaml new file mode 100644 index 00000000..e2b94c22 --- /dev/null +++ b/core/src/test/resources/bc_paths_changed_but_compatible.yaml @@ -0,0 +1,36 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + /widgets/{id}: + get: + operationId: getWidget + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + /widgets/{id}/status: + get: + operationId: getWidgetStatus + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_paths_decreased.yaml b/core/src/test/resources/bc_paths_decreased.yaml new file mode 100644 index 00000000..eb640330 --- /dev/null +++ b/core/src/test/resources/bc_paths_decreased.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_readonly_base.yaml b/core/src/test/resources/bc_readonly_base.yaml new file mode 100644 index 00000000..dc4889b1 --- /dev/null +++ b/core/src/test/resources/bc_readonly_base.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + readOnly: true + prop2: + type: string + required: + - prop1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + readOnly: true diff --git a/core/src/test/resources/bc_readonly_changed_but_compatible.yaml b/core/src/test/resources/bc_readonly_changed_but_compatible.yaml new file mode 100644 index 00000000..cc6596ef --- /dev/null +++ b/core/src/test/resources/bc_readonly_changed_but_compatible.yaml @@ -0,0 +1,32 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + readOnly: true + prop2: + type: string + required: + - prop1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string diff --git a/core/src/test/resources/bc_request_body_base.yaml b/core/src/test/resources/bc_request_body_base.yaml new file mode 100644 index 00000000..fd89553e --- /dev/null +++ b/core/src/test/resources/bc_request_body_base.yaml @@ -0,0 +1,21 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_body_required_changed.yaml b/core/src/test/resources/bc_request_body_required_changed.yaml new file mode 100644 index 00000000..859512ca --- /dev/null +++ b/core/src/test/resources/bc_request_body_required_changed.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: string + required: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_content_decreased.yaml b/core/src/test/resources/bc_request_content_decreased.yaml new file mode 100644 index 00000000..d7a5517d --- /dev/null +++ b/core/src/test/resources/bc_request_content_decreased.yaml @@ -0,0 +1,26 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + application/text: + schema: + type: string diff --git a/core/src/test/resources/bc_request_enum_decreased.yaml b/core/src/test/resources/bc_request_enum_decreased.yaml new file mode 100644 index 00000000..c131e9aa --- /dev/null +++ b/core/src/test/resources/bc_request_enum_decreased.yaml @@ -0,0 +1,32 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: param-inline-enum + in: query + required: true + schema: + type: string + enum: + - param-inline-enum-val-1 + default: param-inline-enum-val-1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + enum-prop: + type: string + enum: + - enum-prop-val-1 + - enum-prop-val-2 + default: enum-prop-val-1 diff --git a/core/src/test/resources/bc_request_maxlength_decreased.yaml b/core/src/test/resources/bc_request_maxlength_decreased.yaml new file mode 100644 index 00000000..48d50863 --- /dev/null +++ b/core/src/test/resources/bc_request_maxlength_decreased.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: string + maxLength: 10 + application/xml: + schema: + type: string + maxLength: 10 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + maxLength: 16 + application/xml: + schema: + type: string diff --git a/core/src/test/resources/bc_request_numericrange_exclusive_max_created.yaml b/core/src/test/resources/bc_request_numericrange_exclusive_max_created.yaml new file mode 100644 index 00000000..f893a954 --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_exclusive_max_created.yaml @@ -0,0 +1,56 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMaximum: true + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_numericrange_exclusive_max_set.yaml b/core/src/test/resources/bc_request_numericrange_exclusive_max_set.yaml new file mode 100644 index 00000000..efa02f99 --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_exclusive_max_set.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: true + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_numericrange_exclusive_min_created.yaml b/core/src/test/resources/bc_request_numericrange_exclusive_min_created.yaml new file mode 100644 index 00000000..649b7f48 --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_exclusive_min_created.yaml @@ -0,0 +1,56 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_numericrange_exclusive_min_set.yaml b/core/src/test/resources/bc_request_numericrange_exclusive_min_set.yaml new file mode 100644 index 00000000..e6d0c81f --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_exclusive_min_set.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: true + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_numericrange_max_added.yaml b/core/src/test/resources/bc_request_numericrange_max_added.yaml new file mode 100644 index 00000000..f438d9bd --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_max_added.yaml @@ -0,0 +1,56 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + maximum: 20 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_numericrange_max_decreased.yaml b/core/src/test/resources/bc_request_numericrange_max_decreased.yaml new file mode 100644 index 00000000..be0dec2c --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_max_decreased.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 19 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 19 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_numericrange_min_added.yaml b/core/src/test/resources/bc_request_numericrange_min_added.yaml new file mode 100644 index 00000000..84a06bbc --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_min_added.yaml @@ -0,0 +1,56 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + minimum: 10 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_numericrange_min_increased.yaml b/core/src/test/resources/bc_request_numericrange_min_increased.yaml new file mode 100644 index 00000000..87df1ba4 --- /dev/null +++ b/core/src/test/resources/bc_request_numericrange_min_increased.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 11 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 11 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_request_oneof_decreased.yaml b/core/src/test/resources/bc_request_oneof_decreased.yaml new file mode 100644 index 00000000..82371aed --- /dev/null +++ b/core/src/test/resources/bc_request_oneof_decreased.yaml @@ -0,0 +1,47 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' +components: + schemas: + WidgetCreateRequest: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + WidgetCreateResponse: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + Doodad: + type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_request_param_allowemptyvalue_decreased.yaml b/core/src/test/resources/bc_request_param_allowemptyvalue_decreased.yaml new file mode 100644 index 00000000..cf25dd89 --- /dev/null +++ b/core/src/test/resources/bc_request_param_allowemptyvalue_decreased.yaml @@ -0,0 +1,28 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + schema: + type: string + - name: query-param-2 + in: query + style: form + explode: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_param_base.yaml b/core/src/test/resources/bc_request_param_base.yaml new file mode 100644 index 00000000..55501599 --- /dev/null +++ b/core/src/test/resources/bc_request_param_base.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + schema: + type: string + - name: query-param-2 + in: query + style: form + explode: true + allowEmptyValue: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_param_changed_but_compatible.yaml b/core/src/test/resources/bc_request_param_changed_but_compatible.yaml new file mode 100644 index 00000000..281fd051 --- /dev/null +++ b/core/src/test/resources/bc_request_param_changed_but_compatible.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + allowEmptyValue: true + required: false + schema: + type: string + - name: query-param-2 + in: query + style: form + explode: true + allowEmptyValue: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_param_explode_changed.yaml b/core/src/test/resources/bc_request_param_explode_changed.yaml new file mode 100644 index 00000000..3424c5fb --- /dev/null +++ b/core/src/test/resources/bc_request_param_explode_changed.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + explode: true + required: true + schema: + type: string + - name: query-param-2 + in: query + style: form + explode: false + allowEmptyValue: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_param_required_increased.yaml b/core/src/test/resources/bc_request_param_required_increased.yaml new file mode 100644 index 00000000..6af74a9b --- /dev/null +++ b/core/src/test/resources/bc_request_param_required_increased.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + schema: + type: string + - name: query-param-2 + in: query + style: form + explode: true + allowEmptyValue: true + required: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_param_style_changed.yaml b/core/src/test/resources/bc_request_param_style_changed.yaml new file mode 100644 index 00000000..ff8cb1db --- /dev/null +++ b/core/src/test/resources/bc_request_param_style_changed.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + style: form + schema: + type: string + - name: query-param-2 + in: query + style: simple + explode: true + allowEmptyValue: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_params_base.yaml b/core/src/test/resources/bc_request_params_base.yaml new file mode 100644 index 00000000..9d623821 --- /dev/null +++ b/core/src/test/resources/bc_request_params_base.yaml @@ -0,0 +1,26 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + schema: + type: string + - name: query-param-2 + in: query + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_params_changed_but_compatible.yaml b/core/src/test/resources/bc_request_params_changed_but_compatible.yaml new file mode 100644 index 00000000..62a26fbb --- /dev/null +++ b/core/src/test/resources/bc_request_params_changed_but_compatible.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + schema: + type: string + - name: query-param-2 + in: query + schema: + type: string + - name: query-param-3 + in: query + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_params_decreased.yaml b/core/src/test/resources/bc_request_params_decreased.yaml new file mode 100644 index 00000000..2837bcc4 --- /dev/null +++ b/core/src/test/resources/bc_request_params_decreased.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_params_required_increased.yaml b/core/src/test/resources/bc_request_params_required_increased.yaml new file mode 100644 index 00000000..d1c2e16c --- /dev/null +++ b/core/src/test/resources/bc_request_params_required_increased.yaml @@ -0,0 +1,31 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: query-param-1 + in: query + required: true + schema: + type: string + - name: query-param-2 + in: query + schema: + type: string + - name: query-param-3 + in: query + required: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string diff --git a/core/src/test/resources/bc_request_readonly_increased.yaml b/core/src/test/resources/bc_request_readonly_increased.yaml new file mode 100644 index 00000000..5de3149d --- /dev/null +++ b/core/src/test/resources/bc_request_readonly_increased.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + readOnly: true + prop2: + type: string + readOnly: true + required: + - prop1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + readOnly: true diff --git a/core/src/test/resources/bc_request_readonly_required_decreased.yaml b/core/src/test/resources/bc_request_readonly_required_decreased.yaml new file mode 100644 index 00000000..73f12cae --- /dev/null +++ b/core/src/test/resources/bc_request_readonly_required_decreased.yaml @@ -0,0 +1,32 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + required: + - prop1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + readOnly: true diff --git a/core/src/test/resources/bc_request_required_increased.yaml b/core/src/test/resources/bc_request_required_increased.yaml new file mode 100644 index 00000000..cd9821ac --- /dev/null +++ b/core/src/test/resources/bc_request_required_increased.yaml @@ -0,0 +1,42 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 + - prop2 + - prop3 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 + - prop2 diff --git a/core/src/test/resources/bc_request_schema_format_decreased.yaml b/core/src/test/resources/bc_request_schema_format_decreased.yaml new file mode 100644 index 00000000..3a69caf8 --- /dev/null +++ b/core/src/test/resources/bc_request_schema_format_decreased.yaml @@ -0,0 +1,115 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int32 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int32 + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_request_schema_format_increased.yaml b/core/src/test/resources/bc_request_schema_format_increased.yaml new file mode 100644 index 00000000..6201e14c --- /dev/null +++ b/core/src/test/resources/bc_request_schema_format_increased.yaml @@ -0,0 +1,115 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int64 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int32 + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_request_schema_props_put_increased.yaml b/core/src/test/resources/bc_request_schema_props_put_increased.yaml new file mode 100644 index 00000000..9ca619a4 --- /dev/null +++ b/core/src/test/resources/bc_request_schema_props_put_increased.yaml @@ -0,0 +1,117 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + put_prop3: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int32 + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_required_base.yaml b/core/src/test/resources/bc_required_base.yaml new file mode 100644 index 00000000..711cd20a --- /dev/null +++ b/core/src/test/resources/bc_required_base.yaml @@ -0,0 +1,41 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 + - prop2 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 + - prop2 diff --git a/core/src/test/resources/bc_required_changed_but_compatible.yaml b/core/src/test/resources/bc_required_changed_but_compatible.yaml new file mode 100644 index 00000000..4e352896 --- /dev/null +++ b/core/src/test/resources/bc_required_changed_but_compatible.yaml @@ -0,0 +1,41 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 + - prop2 + - prop3 diff --git a/core/src/test/resources/bc_response_apiresponse_base.yaml b/core/src/test/resources/bc_response_apiresponse_base.yaml new file mode 100644 index 00000000..640a7dc1 --- /dev/null +++ b/core/src/test/resources/bc_response_apiresponse_base.yaml @@ -0,0 +1,18 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + '400': + description: Invalid status value + /widgets/index: + post: + operationId: indexWidgets + description: Regression test for https://github.com/OpenAPITools/openapi-diff/pull/206 (handle missing responses) diff --git a/core/src/test/resources/bc_response_apiresponse_changed_but_compatible.yaml b/core/src/test/resources/bc_response_apiresponse_changed_but_compatible.yaml new file mode 100644 index 00000000..6ad62134 --- /dev/null +++ b/core/src/test/resources/bc_response_apiresponse_changed_but_compatible.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + '201': + description: OK + '400': + description: Invalid status value + /widgets/index: + post: + operationId: indexWidgets + responses: + '200': + description: successful operation diff --git a/core/src/test/resources/bc_response_apiresponse_decreased.yaml b/core/src/test/resources/bc_response_apiresponse_decreased.yaml new file mode 100644 index 00000000..6502cf0c --- /dev/null +++ b/core/src/test/resources/bc_response_apiresponse_decreased.yaml @@ -0,0 +1,16 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + /widgets/index: + post: + operationId: indexWidgets + description: Regression test for https://github.com/OpenAPITools/openapi-diff/pull/206 (handle missing responses) diff --git a/core/src/test/resources/bc_response_content_decreased.yaml b/core/src/test/resources/bc_response_content_decreased.yaml new file mode 100644 index 00000000..2915db53 --- /dev/null +++ b/core/src/test/resources/bc_response_content_decreased.yaml @@ -0,0 +1,26 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + application/text: + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 diff --git a/core/src/test/resources/bc_response_enum_increased.yaml b/core/src/test/resources/bc_response_enum_increased.yaml new file mode 100644 index 00000000..27a0d58d --- /dev/null +++ b/core/src/test/resources/bc_response_enum_increased.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + parameters: + - name: param-inline-enum + in: query + required: true + schema: + type: string + enum: + - param-inline-enum-val-1 + - param-inline-enum-val-2 + default: param-inline-enum-val-1 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + enum-prop: + type: string + enum: + - enum-prop-val-1 + - enum-prop-val-2 + - enum-prop-val-3 + default: enum-prop-val-1 diff --git a/core/src/test/resources/bc_response_header_base.yaml b/core/src/test/resources/bc_response_header_base.yaml new file mode 100644 index 00000000..17716ba0 --- /dev/null +++ b/core/src/test/resources/bc_response_header_base.yaml @@ -0,0 +1,21 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + required: true + schema: + type: integer + format: int32 + X-Header-2: + schema: + type: integer diff --git a/core/src/test/resources/bc_response_header_deprecated.yaml b/core/src/test/resources/bc_response_header_deprecated.yaml new file mode 100644 index 00000000..0c60132b --- /dev/null +++ b/core/src/test/resources/bc_response_header_deprecated.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + required: true + schema: + type: integer + format: int32 + X-Header-2: + deprecated: true + schema: + type: integer diff --git a/core/src/test/resources/bc_response_header_explode.yaml b/core/src/test/resources/bc_response_header_explode.yaml new file mode 100644 index 00000000..d48a726a --- /dev/null +++ b/core/src/test/resources/bc_response_header_explode.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + required: true + schema: + type: integer + format: int32 + X-Header-2: + schema: + type: integer + explode: true diff --git a/core/src/test/resources/bc_response_header_required_added.yaml b/core/src/test/resources/bc_response_header_required_added.yaml new file mode 100644 index 00000000..83bceafe --- /dev/null +++ b/core/src/test/resources/bc_response_header_required_added.yaml @@ -0,0 +1,22 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + required: true + schema: + type: integer + format: int32 + X-Header-2: + required: true + schema: + type: integer diff --git a/core/src/test/resources/bc_response_header_required_deleted.yaml b/core/src/test/resources/bc_response_header_required_deleted.yaml new file mode 100644 index 00000000..c227a392 --- /dev/null +++ b/core/src/test/resources/bc_response_header_required_deleted.yaml @@ -0,0 +1,20 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + schema: + type: integer + format: int32 + X-Header-2: + schema: + type: integer diff --git a/core/src/test/resources/bc_response_headers_base.yaml b/core/src/test/resources/bc_response_headers_base.yaml new file mode 100644 index 00000000..17716ba0 --- /dev/null +++ b/core/src/test/resources/bc_response_headers_base.yaml @@ -0,0 +1,21 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + required: true + schema: + type: integer + format: int32 + X-Header-2: + schema: + type: integer diff --git a/core/src/test/resources/bc_response_headers_increased.yaml b/core/src/test/resources/bc_response_headers_increased.yaml new file mode 100644 index 00000000..837b3e22 --- /dev/null +++ b/core/src/test/resources/bc_response_headers_increased.yaml @@ -0,0 +1,24 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + required: true + schema: + type: integer + format: int32 + X-Header-2: + schema: + type: integer + X-Header-3: + schema: + type: integer diff --git a/core/src/test/resources/bc_response_headers_missing.yaml b/core/src/test/resources/bc_response_headers_missing.yaml new file mode 100644 index 00000000..c5166c9c --- /dev/null +++ b/core/src/test/resources/bc_response_headers_missing.yaml @@ -0,0 +1,18 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + headers: + X-Header-1: + required: true + schema: + type: integer + format: int32 diff --git a/core/src/test/resources/bc_response_maxlength_increased.yaml b/core/src/test/resources/bc_response_maxlength_increased.yaml new file mode 100644 index 00000000..40dd4309 --- /dev/null +++ b/core/src/test/resources/bc_response_maxlength_increased.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: string + maxLength: 16 + application/xml: + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + maxLength: 20 + application/xml: + schema: + type: string + maxLength: 20 diff --git a/core/src/test/resources/bc_response_numericrange_exclusive_max_deleted.yaml b/core/src/test/resources/bc_response_numericrange_exclusive_max_deleted.yaml new file mode 100644 index 00000000..385b4759 --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_exclusive_max_deleted.yaml @@ -0,0 +1,54 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true diff --git a/core/src/test/resources/bc_response_numericrange_exclusive_max_unset.yaml b/core/src/test/resources/bc_response_numericrange_exclusive_max_unset.yaml new file mode 100644 index 00000000..e6c1448c --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_exclusive_max_unset.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: false diff --git a/core/src/test/resources/bc_response_numericrange_exclusive_min_deleted.yaml b/core/src/test/resources/bc_response_numericrange_exclusive_min_deleted.yaml new file mode 100644 index 00000000..49881a7f --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_exclusive_min_deleted.yaml @@ -0,0 +1,54 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_response_numericrange_exclusive_min_unset.yaml b/core/src/test/resources/bc_response_numericrange_exclusive_min_unset.yaml new file mode 100644 index 00000000..75bb758f --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_exclusive_min_unset.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: false + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_response_numericrange_max_deleted.yaml b/core/src/test/resources/bc_response_numericrange_max_deleted.yaml new file mode 100644 index 00000000..6edf439f --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_max_deleted.yaml @@ -0,0 +1,53 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_response_numericrange_max_increased.yaml b/core/src/test/resources/bc_response_numericrange_max_increased.yaml new file mode 100644 index 00000000..e994bf88 --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_max_increased.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 21 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 21 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_response_numericrange_min_decreased.yaml b/core/src/test/resources/bc_response_numericrange_min_decreased.yaml new file mode 100644 index 00000000..2055a324 --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_min_decreased.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 9 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 9 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_response_numericrange_min_deleted.yaml b/core/src/test/resources/bc_response_numericrange_min_deleted.yaml new file mode 100644 index 00000000..087245c0 --- /dev/null +++ b/core/src/test/resources/bc_response_numericrange_min_deleted.yaml @@ -0,0 +1,53 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + minimum: 10 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: integer + format: int32 + exclusiveMinimum: false + exclusiveMaximum: false + application/text: + schema: + type: integer + format: int32 + maximum: 20 + application/xml: + schema: + type: integer + format: int32 + maximum: 20 + exclusiveMinimum: true + exclusiveMaximum: true diff --git a/core/src/test/resources/bc_response_oneof_increased.yaml b/core/src/test/resources/bc_response_oneof_increased.yaml new file mode 100644 index 00000000..0d6636e0 --- /dev/null +++ b/core/src/test/resources/bc_response_oneof_increased.yaml @@ -0,0 +1,49 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' +components: + schemas: + WidgetCreateRequest: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + WidgetCreateResponse: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + - $ref: '#/components/schemas/Gizmo' + Doodad: + type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_response_required_decreased.yaml b/core/src/test/resources/bc_response_required_decreased.yaml new file mode 100644 index 00000000..e77d73da --- /dev/null +++ b/core/src/test/resources/bc_response_required_decreased.yaml @@ -0,0 +1,40 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 + - prop2 + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + prop3: + type: string + required: + - prop1 diff --git a/core/src/test/resources/bc_response_schema_format_decreased.yaml b/core/src/test/resources/bc_response_schema_format_decreased.yaml new file mode 100644 index 00000000..66ad527d --- /dev/null +++ b/core/src/test/resources/bc_response_schema_format_decreased.yaml @@ -0,0 +1,115 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int32 + response_prop2: + type: integer + format: int32 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_response_schema_format_increased.yaml b/core/src/test/resources/bc_response_schema_format_increased.yaml new file mode 100644 index 00000000..1ecc86fb --- /dev/null +++ b/core/src/test/resources/bc_response_schema_format_increased.yaml @@ -0,0 +1,115 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int64 + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_response_schema_props_required_decreased.yaml b/core/src/test/resources/bc_response_schema_props_required_decreased.yaml new file mode 100644 index 00000000..cbd2c5a4 --- /dev/null +++ b/core/src/test/resources/bc_response_schema_props_required_decreased.yaml @@ -0,0 +1,112 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_response_writeonly_increased.yaml b/core/src/test/resources/bc_response_writeonly_increased.yaml new file mode 100644 index 00000000..a009b8dc --- /dev/null +++ b/core/src/test/resources/bc_response_writeonly_increased.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + writeOnly: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + writeOnly: true + prop2: + type: string + writeOnly: true + required: + - prop1 diff --git a/core/src/test/resources/bc_response_writeonly_required_decreased.yaml b/core/src/test/resources/bc_response_writeonly_required_decreased.yaml new file mode 100644 index 00000000..74bf153e --- /dev/null +++ b/core/src/test/resources/bc_response_writeonly_required_decreased.yaml @@ -0,0 +1,32 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + writeOnly: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + prop2: + type: string + required: + - prop1 diff --git a/core/src/test/resources/bc_schema_base.yaml b/core/src/test/resources/bc_schema_base.yaml new file mode 100644 index 00000000..28d8800d --- /dev/null +++ b/core/src/test/resources/bc_schema_base.yaml @@ -0,0 +1,115 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int32 + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_schema_changed_but_compatible.yaml b/core/src/test/resources/bc_schema_changed_but_compatible.yaml new file mode 100644 index 00000000..e8a6e7e9 --- /dev/null +++ b/core/src/test/resources/bc_schema_changed_but_compatible.yaml @@ -0,0 +1,114 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop2: + type: integer + format: int64 + request_prop3: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int32 + response_prop3: + type: string + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + deprecated: true + prop2: + type: integer + format: int32 + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_schema_discriminator_changed.yaml b/core/src/test/resources/bc_schema_discriminator_changed.yaml new file mode 100644 index 00000000..fd956900 --- /dev/null +++ b/core/src/test/resources/bc_schema_discriminator_changed.yaml @@ -0,0 +1,115 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: integer + format: int32 + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: 'prop1' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_schema_type_changed.yaml b/core/src/test/resources/bc_schema_type_changed.yaml new file mode 100644 index 00000000..946d1689 --- /dev/null +++ b/core/src/test/resources/bc_schema_type_changed.yaml @@ -0,0 +1,114 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateRequest' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/WidgetCreateResponse' + put: + operationId: widgetUpdate + requestBody: + content: + application/json: + schema: + type: object + properties: + put_prop1: + type: string + put_prop2: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string +components: + schemas: + WidgetCreateRequest: + type: object + properties: + to_create: + $ref: '#/components/schemas/Widget_Polymorphic' + request_prop1: + type: integer + format: int32 + request_prop2: + type: integer + format: int64 + required: + - to_create + - request_prop1 + WidgetCreateResponse: + type: object + properties: + created: + $ref: '#/components/schemas/Widget_Polymorphic' + response_prop1: + type: string + response_prop2: + type: integer + format: int64 + required: + - created + - response_prop1 + Widget_Polymorphic: + type: object + oneOf: + - $ref: '#/components/schemas/Doodad' + - $ref: '#/components/schemas/Gadget' + discriminator: + propertyName: '@type' + Widget: + type: object + properties: + '@type': + type: string + prop1: + type: string + prop2: + type: integer + format: int32 + deprecated: true + required: + - '@type' + - prop1 + Doodad: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + doodad_prop1: + type: string + Gadget: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gadget_prop1: + type: string + Gizmo: + type: object + allOf: + - $ref: '#/components/schemas/Widget' + - type: object + properties: + gizmo_prop1: + type: string diff --git a/core/src/test/resources/bc_security_requirement_base.yaml b/core/src/test/resources/bc_security_requirement_base.yaml new file mode 100644 index 00000000..47773651 --- /dev/null +++ b/core/src/test/resources/bc_security_requirement_base.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - my-scheme-1: [] + my-scheme-2: [] +components: + securitySchemes: + my-scheme-1: + type: http + scheme: basic + my-scheme-2: + type: http + scheme: basic + my-scheme-3: + type: http + scheme: basic diff --git a/core/src/test/resources/bc_security_requirement_changed_but_compatible.yaml b/core/src/test/resources/bc_security_requirement_changed_but_compatible.yaml new file mode 100644 index 00000000..9a58c327 --- /dev/null +++ b/core/src/test/resources/bc_security_requirement_changed_but_compatible.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - my-scheme-1: [] +components: + securitySchemes: + my-scheme-1: + type: http + scheme: basic + my-scheme-2: + type: http + scheme: basic + my-scheme-3: + type: http + scheme: basic diff --git a/core/src/test/resources/bc_security_requirement_schemes_increased.yaml b/core/src/test/resources/bc_security_requirement_schemes_increased.yaml new file mode 100644 index 00000000..234aa7a2 --- /dev/null +++ b/core/src/test/resources/bc_security_requirement_schemes_increased.yaml @@ -0,0 +1,31 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - my-scheme-1: [] + my-scheme-2: [] + my-scheme-3: [] +components: + securitySchemes: + my-scheme-1: + type: http + scheme: basic + my-scheme-2: + type: http + scheme: basic + my-scheme-3: + type: http + scheme: basic diff --git a/core/src/test/resources/bc_security_requirements_base.yaml b/core/src/test/resources/bc_security_requirements_base.yaml new file mode 100644 index 00000000..9c4c0465 --- /dev/null +++ b/core/src/test/resources/bc_security_requirements_base.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - my-scheme-1: [] + - my-scheme-2: [] +components: + securitySchemes: + my-scheme-1: + type: http + scheme: basic + my-scheme-2: + type: http + scheme: basic + my-scheme-3: + type: http + scheme: basic diff --git a/core/src/test/resources/bc_security_requirements_changed_but_compatible.yaml b/core/src/test/resources/bc_security_requirements_changed_but_compatible.yaml new file mode 100644 index 00000000..ba983bc3 --- /dev/null +++ b/core/src/test/resources/bc_security_requirements_changed_but_compatible.yaml @@ -0,0 +1,31 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - my-scheme-1: [] + - my-scheme-2: [] + - my-scheme-3: [] +components: + securitySchemes: + my-scheme-1: + type: http + scheme: basic + my-scheme-2: + type: http + scheme: basic + my-scheme-3: + type: http + scheme: basic diff --git a/core/src/test/resources/bc_security_requirements_decreased.yaml b/core/src/test/resources/bc_security_requirements_decreased.yaml new file mode 100644 index 00000000..9a58c327 --- /dev/null +++ b/core/src/test/resources/bc_security_requirements_decreased.yaml @@ -0,0 +1,29 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - my-scheme-1: [] +components: + securitySchemes: + my-scheme-1: + type: http + scheme: basic + my-scheme-2: + type: http + scheme: basic + my-scheme-3: + type: http + scheme: basic diff --git a/core/src/test/resources/bc_security_requirements_scheme_type_changed.yaml b/core/src/test/resources/bc_security_requirements_scheme_type_changed.yaml new file mode 100644 index 00000000..d2e6f1a9 --- /dev/null +++ b/core/src/test/resources/bc_security_requirements_scheme_type_changed.yaml @@ -0,0 +1,31 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - my-scheme-1: [] + - my-scheme-2: [] +components: + securitySchemes: + my-scheme-1: + type: apiKey + name: api_key + in: header + my-scheme-2: + type: http + scheme: basic + my-scheme-3: + type: http + scheme: basic diff --git a/core/src/test/resources/bc_security_scheme_base.yaml b/core/src/test/resources/bc_security_scheme_base.yaml new file mode 100644 index 00000000..00caad13 --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_base.yaml @@ -0,0 +1,42 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" + - "scope2" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: header + basic-scheme-1: + type: http + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_security_scheme_bearer_format_changed.yaml b/core/src/test/resources/bc_security_scheme_bearer_format_changed.yaml new file mode 100644 index 00000000..bf7fcca5 --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_bearer_format_changed.yaml @@ -0,0 +1,43 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" + - "scope2" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: header + basic-scheme-1: + type: http + bearerFormat: myBearerFormat + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_security_scheme_changed_but_compatible.yaml b/core/src/test/resources/bc_security_scheme_changed_but_compatible.yaml new file mode 100644 index 00000000..5cf1f26b --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_changed_but_compatible.yaml @@ -0,0 +1,41 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: header + basic-scheme-1: + type: http + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_security_scheme_in_changed.yaml b/core/src/test/resources/bc_security_scheme_in_changed.yaml new file mode 100644 index 00000000..5d937c36 --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_in_changed.yaml @@ -0,0 +1,42 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" + - "scope2" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: query + basic-scheme-1: + type: http + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_security_scheme_open_id_connect_url_changed.yaml b/core/src/test/resources/bc_security_scheme_open_id_connect_url_changed.yaml new file mode 100644 index 00000000..e981a945 --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_open_id_connect_url_changed.yaml @@ -0,0 +1,42 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" + - "scope2" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: header + basic-scheme-1: + type: http + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect2 + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_security_scheme_scheme_changed.yaml b/core/src/test/resources/bc_security_scheme_scheme_changed.yaml new file mode 100644 index 00000000..5b474049 --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_scheme_changed.yaml @@ -0,0 +1,43 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" + - "scope2" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: header + basic-scheme-1: + type: http + scheme: Digest + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_security_scheme_scopes_increased.yaml b/core/src/test/resources/bc_security_scheme_scopes_increased.yaml new file mode 100644 index 00000000..8cfe7683 --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_scopes_increased.yaml @@ -0,0 +1,43 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" + - "scope2" + - "scope3" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: header + basic-scheme-1: + type: http + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_security_scheme_type_changed.yaml b/core/src/test/resources/bc_security_scheme_type_changed.yaml new file mode 100644 index 00000000..985a1a17 --- /dev/null +++ b/core/src/test/resources/bc_security_scheme_type_changed.yaml @@ -0,0 +1,42 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + get: + operationId: listWidgets + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + security: + - basic-scheme-1: [] + - apikey-scheme-1: [] + - openidconnect-scheme-1: [] + - oauth2-scheme-1: + - "scope1" + - "scope2" +components: + securitySchemes: + apikey-scheme-1: + type: apiKey + name: api_key + in: header + basic-scheme-1: + type: apiKey + openidconnect-scheme-1: + type: openIdConnect + openIdConnectUrl: https://example.com/api/openidconnect + oauth2-scheme-1: + type: oauth2 + flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + scope1: scope1 description + scope2: scope2 description diff --git a/core/src/test/resources/bc_writeonly_base.yaml b/core/src/test/resources/bc_writeonly_base.yaml new file mode 100644 index 00000000..ad3c869d --- /dev/null +++ b/core/src/test/resources/bc_writeonly_base.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + writeOnly: true + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + writeOnly: true + prop2: + type: string + required: + - prop1 diff --git a/core/src/test/resources/bc_writeonly_changed_but_compatible.yaml b/core/src/test/resources/bc_writeonly_changed_but_compatible.yaml new file mode 100644 index 00000000..48857215 --- /dev/null +++ b/core/src/test/resources/bc_writeonly_changed_but_compatible.yaml @@ -0,0 +1,32 @@ +openapi: 3.0.0 +info: + description: myDesc + title: myTitle + version: 1.0.0 +paths: + /widgets: + post: + operationId: widgetCreate + requestBody: + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + properties: + prop1: + type: string + writeOnly: true + prop2: + type: string + required: + - prop1 From 37b2d06f686773a5d2df5065fbce90940315889b Mon Sep 17 00:00:00 2001 From: nithintatikonda1 <77759605+nithintatikonda1@users.noreply.github.com> Date: Tue, 25 Jul 2023 12:44:41 -0700 Subject: [PATCH 22/25] Fix old parameter compared with itself in HtmlRender (#547) Co-authored-by: Nithin Tatikonda --- .../org/openapitools/openapidiff/core/output/HtmlRender.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/openapitools/openapidiff/core/output/HtmlRender.java b/core/src/main/java/org/openapitools/openapidiff/core/output/HtmlRender.java index 0513424c..31bac91b 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/output/HtmlRender.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/output/HtmlRender.java @@ -400,7 +400,7 @@ private LiTag li_changedParam(ChangedParameter changeParam) { .map(ChangedMetadata::isDifferent) .orElse(false); Parameter rightParam = changeParam.getNewParameter(); - Parameter leftParam = changeParam.getNewParameter(); + Parameter leftParam = changeParam.getOldParameter(); LiTag li = li().withText(changeParam.getName() + " in " + changeParam.getIn()); if (changeRequired) { li.withText(" change into " + (rightParam.getRequired() ? "required" : "not required")); From 830a887193e2512f7af468ba8204dc5d6f9bc64f Mon Sep 17 00:00:00 2001 From: lsalgo Date: Tue, 25 Jul 2023 21:48:38 +0200 Subject: [PATCH 23/25] Fix renderer memory issues by writing to OutputStream (#544) Closes #543 --- .../openapitools/openapidiff/cli/Main.java | 46 ++++---- .../core/exception/RendererException.java | 12 +++ .../core/output/ConsoleRender.java | 100 +++++++++--------- .../openapidiff/core/output/HtmlRender.java | 25 ++++- .../openapidiff/core/output/JsonRender.java | 20 ++-- .../core/output/MarkdownRender.java | 89 ++++++++-------- .../openapidiff/core/output/Render.java | 13 ++- .../core/AdditionalPropertiesTest.java | 7 +- .../openapidiff/core/ConsoleRenderTest.java | 12 ++- .../openapidiff/core/HtmlRenderTest.java | 7 +- .../openapidiff/core/JsonRenderTest.java | 12 ++- .../openapidiff/core/MarkdownRenderTest.java | 17 ++- .../openapidiff/core/OpenApiDiffTest.java | 81 +++++++------- .../core/ResponseAddedContentSchemaTest.java | 23 +++- .../openapidiff/maven/OpenApiDiffMojo.java | 7 +- 15 files changed, 275 insertions(+), 196 deletions(-) create mode 100644 core/src/main/java/org/openapitools/openapidiff/core/exception/RendererException.java diff --git a/cli/src/main/java/org/openapitools/openapidiff/cli/Main.java b/cli/src/main/java/org/openapitools/openapidiff/cli/Main.java index 21503e08..f19826a9 100644 --- a/cli/src/main/java/org/openapitools/openapidiff/cli/Main.java +++ b/cli/src/main/java/org/openapitools/openapidiff/cli/Main.java @@ -2,9 +2,9 @@ import ch.qos.logback.classic.Level; import io.swagger.v3.parser.core.models.AuthorizationValue; -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; +import java.io.ByteArrayOutputStream; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; import java.util.Collections; import java.util.List; import org.apache.commons.cli.CommandLine; @@ -14,7 +14,6 @@ import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; -import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.exception.ExceptionUtils; import org.openapitools.openapidiff.core.OpenApiCompare; import org.openapitools.openapidiff.core.model.ChangedOpenApi; @@ -175,29 +174,33 @@ public static void main(String... args) { ChangedOpenApi result = OpenApiCompare.fromLocations(oldPath, newPath, auths); ConsoleRender consoleRender = new ConsoleRender(); if (!logLevel.equals("OFF")) { - System.out.println(consoleRender.render(result)); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); + consoleRender.render(result, outputStreamWriter); + System.out.println(outputStream); } if (line.hasOption("html")) { HtmlRender htmlRender = new HtmlRender(); - String output = htmlRender.render(result); - String outputFile = line.getOptionValue("html"); - writeOutput(output, outputFile); + FileOutputStream outputStream = new FileOutputStream(line.getOptionValue("html")); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); + htmlRender.render(result, outputStreamWriter); } if (line.hasOption("markdown")) { MarkdownRender mdRender = new MarkdownRender(); - String output = mdRender.render(result); - String outputFile = line.getOptionValue("markdown"); - writeOutput(output, outputFile); + FileOutputStream outputStream = new FileOutputStream(line.getOptionValue("markdown")); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); + mdRender.render(result, outputStreamWriter); } if (line.hasOption("text")) { - String output = consoleRender.render(result); - String outputFile = line.getOptionValue("text"); - writeOutput(output, outputFile); + FileOutputStream outputStream = new FileOutputStream(line.getOptionValue("text")); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); + consoleRender.render(result, outputStreamWriter); } if (line.hasOption("json")) { JsonRender jsonRender = new JsonRender(); - String outputFile = line.getOptionValue("json"); - jsonRender.renderToFile(result, outputFile); + FileOutputStream outputStream = new FileOutputStream(line.getOptionValue("json")); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); + jsonRender.render(result, outputStreamWriter); } if (line.hasOption("state")) { System.out.println(result.isChanged().getValue()); @@ -222,17 +225,6 @@ public static void main(String... args) { } } - private static void writeOutput(String output, String outputFile) { - File file = new File(outputFile); - logger.debug("Output file: {}", file.getAbsolutePath()); - try { - FileUtils.writeStringToFile(file, output, StandardCharsets.UTF_8); - } catch (IOException e) { - logger.error("Impossible to write output to file {}", outputFile, e); - System.exit(2); - } - } - public static void printHelp(Options options) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("openapi-diff ", options); diff --git a/core/src/main/java/org/openapitools/openapidiff/core/exception/RendererException.java b/core/src/main/java/org/openapitools/openapidiff/core/exception/RendererException.java new file mode 100644 index 00000000..d7dc2444 --- /dev/null +++ b/core/src/main/java/org/openapitools/openapidiff/core/exception/RendererException.java @@ -0,0 +1,12 @@ +package org.openapitools.openapidiff.core.exception; + +public class RendererException extends RuntimeException { + + public RendererException(Throwable cause) { + super(cause); + } + + public RendererException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/core/src/main/java/org/openapitools/openapidiff/core/output/ConsoleRender.java b/core/src/main/java/org/openapitools/openapidiff/core/output/ConsoleRender.java index 72597ad9..a3e3a31e 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/output/ConsoleRender.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/output/ConsoleRender.java @@ -6,11 +6,14 @@ import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.responses.ApiResponse; +import java.io.IOException; +import java.io.OutputStreamWriter; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Optional; import org.apache.commons.lang3.StringUtils; +import org.openapitools.openapidiff.core.exception.RendererException; import org.openapitools.openapidiff.core.model.*; import org.openapitools.openapidiff.core.utils.RefPointer; import org.openapitools.openapidiff.core.utils.RefType; @@ -21,81 +24,78 @@ public class ConsoleRender implements Render { protected ChangedOpenApi diff; @Override - public String render(ChangedOpenApi diff) { + public void render(ChangedOpenApi diff, OutputStreamWriter outputStreamWriter) { this.diff = diff; - StringBuilder output = new StringBuilder(); if (diff.isUnchanged()) { - output.append("No differences. Specifications are equivalents"); + safelyAppend(outputStreamWriter, "No differences. Specifications are equivalents"); } else { - output - .append(bigTitle("Api Change Log")) - .append(StringUtils.center(diff.getNewSpecOpenApi().getInfo().getTitle(), LINE_LENGTH)) - .append(System.lineSeparator()); + safelyAppend(outputStreamWriter, bigTitle("Api Change Log")); + safelyAppend( + outputStreamWriter, + StringUtils.center(diff.getNewSpecOpenApi().getInfo().getTitle(), LINE_LENGTH)); + safelyAppend(outputStreamWriter, System.lineSeparator()); List newEndpoints = diff.getNewEndpoints(); - String ol_newEndpoint = listEndpoints(newEndpoints, "What's New"); + listEndpoints(newEndpoints, "What's New", outputStreamWriter); List missingEndpoints = diff.getMissingEndpoints(); - String ol_missingEndpoint = listEndpoints(missingEndpoints, "What's Deleted"); + listEndpoints(missingEndpoints, "What's Deleted", outputStreamWriter); List deprecatedEndpoints = diff.getDeprecatedEndpoints(); - String ol_deprecatedEndpoint = listEndpoints(deprecatedEndpoints, "What's Deprecated"); + listEndpoints(deprecatedEndpoints, "What's Deprecated", outputStreamWriter); List changedOperations = diff.getChangedOperations(); - String ol_changed = ol_changed(changedOperations); - - output - .append(renderBody(ol_newEndpoint, ol_missingEndpoint, ol_deprecatedEndpoint, ol_changed)) - .append(title("Result")) - .append( - StringUtils.center( - diff.isCompatible() - ? "API changes are backward compatible" - : "API changes broke backward compatibility", - LINE_LENGTH)) - .append(System.lineSeparator()) - .append(separator('-')); + ol_changed(changedOperations, outputStreamWriter); + + safelyAppend( + outputStreamWriter, + StringUtils.center( + diff.isCompatible() + ? "API changes are backward compatible" + : "API changes broke backward compatibility", + LINE_LENGTH)); + safelyAppend(outputStreamWriter, System.lineSeparator()); + safelyAppend(outputStreamWriter, separator('-')); + } + try { + outputStreamWriter.close(); + } catch (IOException e) { + throw new RendererException(e); } - return output.toString(); } - private String ol_changed(List operations) { + private void ol_changed( + List operations, OutputStreamWriter outputStreamWriter) { if (null == operations || operations.isEmpty()) { - return ""; + return; } - StringBuilder sb = new StringBuilder(); - sb.append(title("What's Changed")); + safelyAppend(outputStreamWriter, title("What's Changed")); for (ChangedOperation operation : operations) { String pathUrl = operation.getPathUrl(); String method = operation.getHttpMethod().toString(); String desc = Optional.ofNullable(operation.getSummary()).map(ChangedMetadata::getRight).orElse(""); - StringBuilder ul_detail = new StringBuilder(); if (result(operation.getParameters()).isDifferent()) { - ul_detail - .append(StringUtils.repeat(' ', 2)) - .append("Parameter:") - .append(System.lineSeparator()) - .append(ul_param(operation.getParameters())); + safelyAppend(outputStreamWriter, StringUtils.repeat(' ', 2)); + safelyAppend(outputStreamWriter, "Parameter:"); + safelyAppend(outputStreamWriter, System.lineSeparator()); + safelyAppend(outputStreamWriter, ul_param(operation.getParameters())); } if (operation.resultRequestBody().isDifferent()) { - ul_detail - .append(StringUtils.repeat(' ', 2)) - .append("Request:") - .append(System.lineSeparator()) - .append(ul_content(operation.getRequestBody().getContent(), true)); + safelyAppend(outputStreamWriter, StringUtils.repeat(' ', 2)); + safelyAppend(outputStreamWriter, "Request:"); + safelyAppend(outputStreamWriter, System.lineSeparator()); + safelyAppend(outputStreamWriter, ul_content(operation.getRequestBody().getContent(), true)); } if (operation.resultApiResponses().isDifferent()) { - ul_detail - .append(StringUtils.repeat(' ', 2)) - .append("Return Type:") - .append(System.lineSeparator()) - .append(ul_response(operation.getApiResponses())); + safelyAppend(outputStreamWriter, StringUtils.repeat(' ', 2)); + safelyAppend(outputStreamWriter, "Return Type:"); + safelyAppend(outputStreamWriter, System.lineSeparator()); + safelyAppend(outputStreamWriter, ul_response(operation.getApiResponses())); } - sb.append(itemEndpoint(method, pathUrl, desc)).append(ul_detail); + safelyAppend(outputStreamWriter, itemEndpoint(method, pathUrl, desc)); } - return sb.toString(); } private String ul_response(ChangedApiResponse changedApiResponse) { @@ -279,7 +279,8 @@ private String li_changedParam(ChangedParameter changeParam) { } } - private String listEndpoints(List endpoints, String title) { + private String listEndpoints( + List endpoints, String title, OutputStreamWriter outputStreamWriter) { if (null == endpoints || endpoints.isEmpty()) { return ""; } @@ -317,8 +318,7 @@ public String title(String title, char ch) { separator(ch), little, StringUtils.center(title, LINE_LENGTH - 4), little, separator(ch)); } - public StringBuilder separator(char ch) { - StringBuilder sb = new StringBuilder(); - return sb.append(StringUtils.repeat(ch, LINE_LENGTH)).append(System.lineSeparator()); + public String separator(char ch) { + return StringUtils.repeat(ch, LINE_LENGTH) + System.lineSeparator(); } } diff --git a/core/src/main/java/org/openapitools/openapidiff/core/output/HtmlRender.java b/core/src/main/java/org/openapitools/openapidiff/core/output/HtmlRender.java index 31bac91b..f84bd79e 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/output/HtmlRender.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/output/HtmlRender.java @@ -26,16 +26,20 @@ import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.responses.ApiResponse; +import j2html.rendering.FlatHtml; import j2html.tags.ContainerTag; import j2html.tags.specialized.DivTag; import j2html.tags.specialized.HtmlTag; import j2html.tags.specialized.LiTag; import j2html.tags.specialized.OlTag; import j2html.tags.specialized.UlTag; +import java.io.IOException; +import java.io.OutputStreamWriter; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Optional; +import org.openapitools.openapidiff.core.exception.RendererException; import org.openapitools.openapidiff.core.model.ChangedApiResponse; import org.openapitools.openapidiff.core.model.ChangedContent; import org.openapitools.openapidiff.core.model.ChangedMediaType; @@ -71,7 +75,7 @@ public HtmlRender(String title, String linkCss) { this.linkCss = linkCss; } - public String render(ChangedOpenApi diff) { + public void render(ChangedOpenApi diff, OutputStreamWriter outputStreamWriter) { this.diff = diff; List newEndpoints = diff.getNewEndpoints(); @@ -86,10 +90,16 @@ public String render(ChangedOpenApi diff) { List changedOperations = diff.getChangedOperations(); OlTag ol_changed = ol_changed(changedOperations); - return renderHtml(ol_newEndpoint, ol_missingEndpoint, ol_deprecatedEndpoint, ol_changed); + renderHtml( + ol_newEndpoint, ol_missingEndpoint, ol_deprecatedEndpoint, ol_changed, outputStreamWriter); } - public String renderHtml(OlTag ol_new, OlTag ol_miss, OlTag ol_deprec, OlTag ol_changed) { + public void renderHtml( + OlTag ol_new, + OlTag ol_miss, + OlTag ol_deprec, + OlTag ol_changed, + OutputStreamWriter outputStreamWriter) { HtmlTag html = html() .attr("lang", "en") @@ -110,7 +120,14 @@ public String renderHtml(OlTag ol_new, OlTag ol_miss, OlTag ol_deprec, OlTag ol_ div().with(h2("What's Deprecated"), hr(), ol_deprec), div().with(h2("What's Changed"), hr(), ol_changed)))); - return document().render() + html.render(); + try { + FlatHtml flatHtml = FlatHtml.into(outputStreamWriter); + document().render(flatHtml); + html.render(flatHtml); + outputStreamWriter.close(); + } catch (IOException e) { + throw new RendererException("Problem rendering html document.", e); + } } private OlTag ol_newEndpoint(List endpoints) { diff --git a/core/src/main/java/org/openapitools/openapidiff/core/output/JsonRender.java b/core/src/main/java/org/openapitools/openapidiff/core/output/JsonRender.java index a0dfa09f..b6629d5f 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/output/JsonRender.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/output/JsonRender.java @@ -4,7 +4,8 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; -import java.nio.file.Paths; +import java.io.OutputStreamWriter; +import org.openapitools.openapidiff.core.exception.RendererException; import org.openapitools.openapidiff.core.model.ChangedOpenApi; public class JsonRender implements Render { @@ -17,21 +18,14 @@ public JsonRender() { } @Override - public String render(ChangedOpenApi diff) { + public void render(ChangedOpenApi diff, OutputStreamWriter outputStreamWriter) { try { - return objectMapper.writeValueAsString(diff); + objectMapper.writeValue(outputStreamWriter, diff); + outputStreamWriter.close(); } catch (JsonProcessingException e) { - throw new RuntimeException("Could not serialize diff as JSON", e); - } - } - - public void renderToFile(ChangedOpenApi diff, String file) { - try { - objectMapper.writeValue(Paths.get(file).toFile(), diff); - } catch (JsonProcessingException e) { - throw new RuntimeException("Could not serialize diff as JSON", e); + throw new RendererException("Could not serialize diff as JSON", e); } catch (IOException e) { - throw new RuntimeException("Could not write to JSON file", e); + throw new RendererException(e); } } } diff --git a/core/src/main/java/org/openapitools/openapidiff/core/output/MarkdownRender.java b/core/src/main/java/org/openapitools/openapidiff/core/output/MarkdownRender.java index 595b97cf..5e0d0dd7 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/output/MarkdownRender.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/output/MarkdownRender.java @@ -11,11 +11,14 @@ import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.responses.ApiResponse; +import java.io.IOException; +import java.io.OutputStreamWriter; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.lang3.StringUtils; +import org.openapitools.openapidiff.core.exception.RendererException; import org.openapitools.openapidiff.core.model.*; import org.openapitools.openapidiff.core.utils.RefPointer; import org.openapitools.openapidiff.core.utils.RefType; @@ -44,28 +47,33 @@ public class MarkdownRender implements Render { */ protected boolean showChangedMetadata; - public String render(ChangedOpenApi diff) { + public void render(ChangedOpenApi diff, OutputStreamWriter outputStreamWriter) { this.diff = diff; this.handledSchemas.clear(); - return listEndpoints("What's New", diff.getNewEndpoints()) - + listEndpoints("What's Deleted", diff.getMissingEndpoints()) - + listEndpoints("What's Deprecated", diff.getDeprecatedEndpoints()) - + listEndpoints(diff.getChangedOperations()); + listEndpoints("What's New", diff.getNewEndpoints(), outputStreamWriter); + listEndpoints("What's Deleted", diff.getMissingEndpoints(), outputStreamWriter); + listEndpoints("What's Deprecated", diff.getDeprecatedEndpoints(), outputStreamWriter); + listEndpoints(diff.getChangedOperations(), outputStreamWriter); + try { + outputStreamWriter.close(); + } catch (IOException e) { + throw new RendererException(e); + } } protected String sectionTitle(String title) { return H4 + title + '\n' + HR + '\n'; } - protected String listEndpoints(String title, List endpoints) { + protected void listEndpoints( + String title, List endpoints, OutputStreamWriter outputStreamWriter) { if (null == endpoints || endpoints.isEmpty()) { - return ""; + return; } - StringBuilder sb = new StringBuilder(sectionTitle(title)); + safelyAppend(outputStreamWriter, sectionTitle(title)); endpoints.stream() .map(e -> itemEndpoint(e.getMethod().toString(), e.getPathUrl(), e.getSummary())) - .forEach(sb::append); - return sb.toString(); + .forEach(csq -> safelyAppend(outputStreamWriter, csq)); } protected String itemEndpoint(String method, String path, String summary) { @@ -80,41 +88,36 @@ protected String titleH5(String title) { return H6 + title + '\n'; } - protected String listEndpoints(List changedOperations) { + protected void listEndpoints( + List changedOperations, OutputStreamWriter outputStreamWriter) { if (null == changedOperations || changedOperations.isEmpty()) { - return ""; + return; } - StringBuilder sb = new StringBuilder(sectionTitle("What's Changed")); - changedOperations.stream() - .map( - operation -> { - StringBuilder details = - new StringBuilder() - .append( - itemEndpoint( - operation.getHttpMethod().toString(), - operation.getPathUrl(), - operation.getSummary())); - if (result(operation.getParameters()).isDifferent()) { - details - .append(titleH5("Parameters:")) - .append(parameters(operation.getParameters())); - } - if (operation.resultRequestBody().isDifferent()) { - details - .append(titleH5("Request:")) - .append(metadata("Description", operation.getRequestBody().getDescription())) - .append(bodyContent(operation.getRequestBody().getContent())); - } - if (operation.resultApiResponses().isDifferent()) { - details - .append(titleH5("Return Type:")) - .append(responses(operation.getApiResponses())); - } - return details.toString(); - }) - .forEach(sb::append); - return sb.toString(); + safelyAppend(outputStreamWriter, sectionTitle("What's Changed")); + changedOperations.forEach( + operation -> { + safelyAppend( + outputStreamWriter, + itemEndpoint( + operation.getHttpMethod().toString(), + operation.getPathUrl(), + operation.getSummary())); + if (result(operation.getParameters()).isDifferent()) { + safelyAppend(outputStreamWriter, titleH5("Parameters:")); + safelyAppend(outputStreamWriter, parameters(operation.getParameters())); + } + if (operation.resultRequestBody().isDifferent()) { + safelyAppend(outputStreamWriter, titleH5("Request:")); + safelyAppend( + outputStreamWriter, + metadata("Description", operation.getRequestBody().getDescription())); + safelyAppend(outputStreamWriter, bodyContent(operation.getRequestBody().getContent())); + } + if (operation.resultApiResponses().isDifferent()) { + safelyAppend(outputStreamWriter, titleH5("Return Type:")); + safelyAppend(outputStreamWriter, responses(operation.getApiResponses())); + } + }); } protected String responses(ChangedApiResponse changedApiResponse) { diff --git a/core/src/main/java/org/openapitools/openapidiff/core/output/Render.java b/core/src/main/java/org/openapitools/openapidiff/core/output/Render.java index 4a48ebcf..8169f31c 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/output/Render.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/output/Render.java @@ -1,8 +1,19 @@ package org.openapitools.openapidiff.core.output; +import java.io.IOException; +import java.io.OutputStreamWriter; +import org.openapitools.openapidiff.core.exception.RendererException; import org.openapitools.openapidiff.core.model.ChangedOpenApi; public interface Render { - String render(ChangedOpenApi diff); + void render(ChangedOpenApi diff, OutputStreamWriter outputStreamWriter); + + default void safelyAppend(OutputStreamWriter outputStreamWriter, String csq) { + try { + outputStreamWriter.append(csq); + } catch (IOException ex) { + throw new RendererException(ex); + } + } } diff --git a/core/src/test/java/org/openapitools/openapidiff/core/AdditionalPropertiesTest.java b/core/src/test/java/org/openapitools/openapidiff/core/AdditionalPropertiesTest.java index df7885e0..7fabd712 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/AdditionalPropertiesTest.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/AdditionalPropertiesTest.java @@ -2,6 +2,8 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.ByteArrayOutputStream; +import java.io.OutputStreamWriter; import org.junit.jupiter.api.Test; import org.openapitools.openapidiff.core.model.ChangedOpenApi; import org.openapitools.openapidiff.core.output.ConsoleRender; @@ -9,8 +11,11 @@ class AdditionalPropertiesTest { @Test void booleanAdditionalPropertiesAreSupported() { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); ChangedOpenApi diff = OpenApiCompare.fromLocations("issue-256_1.json", "issue-256_2.json"); ConsoleRender render = new ConsoleRender(); - assertThat(render.render(diff)).isNotBlank(); + render.render(diff, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); } } diff --git a/core/src/test/java/org/openapitools/openapidiff/core/ConsoleRenderTest.java b/core/src/test/java/org/openapitools/openapidiff/core/ConsoleRenderTest.java index 45563170..f56b4cb9 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/ConsoleRenderTest.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/ConsoleRenderTest.java @@ -2,6 +2,8 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.ByteArrayOutputStream; +import java.io.OutputStreamWriter; import org.junit.jupiter.api.Test; import org.openapitools.openapidiff.core.model.ChangedOpenApi; import org.openapitools.openapidiff.core.output.ConsoleRender; @@ -10,16 +12,22 @@ public class ConsoleRenderTest { @Test public void renderDoesNotFailWhenPropertyHasBeenRemoved() { ConsoleRender render = new ConsoleRender(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); ChangedOpenApi diff = OpenApiCompare.fromLocations("missing_property_1.yaml", "missing_property_2.yaml"); - assertThat(render.render(diff)).isNotBlank(); + render.render(diff, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); } @Test public void renderDoesNotFailWhenHTTPStatusCodeIsRange() { ConsoleRender render = new ConsoleRender(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); ChangedOpenApi diff = OpenApiCompare.fromLocations("range_statuscode_1.yaml", "range_statuscode_2.yaml"); - assertThat(render.render(diff)).isNotBlank(); + render.render(diff, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); } } diff --git a/core/src/test/java/org/openapitools/openapidiff/core/HtmlRenderTest.java b/core/src/test/java/org/openapitools/openapidiff/core/HtmlRenderTest.java index 6273ef24..aa44725c 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/HtmlRenderTest.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/HtmlRenderTest.java @@ -2,6 +2,8 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.ByteArrayOutputStream; +import java.io.OutputStreamWriter; import org.junit.jupiter.api.Test; import org.openapitools.openapidiff.core.model.ChangedOpenApi; import org.openapitools.openapidiff.core.output.HtmlRender; @@ -10,8 +12,11 @@ public class HtmlRenderTest { @Test public void renderDoesNotFailWhenPropertyHasBeenRemoved() { HtmlRender render = new HtmlRender(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); ChangedOpenApi diff = OpenApiCompare.fromLocations("missing_property_1.yaml", "missing_property_2.yaml"); - assertThat(render.render(diff)).isNotBlank(); + render.render(diff, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); } } diff --git a/core/src/test/java/org/openapitools/openapidiff/core/JsonRenderTest.java b/core/src/test/java/org/openapitools/openapidiff/core/JsonRenderTest.java index aba54ea4..280dce9d 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/JsonRenderTest.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/JsonRenderTest.java @@ -2,6 +2,8 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.ByteArrayOutputStream; +import java.io.OutputStreamWriter; import org.junit.jupiter.api.Test; import org.openapitools.openapidiff.core.model.ChangedOpenApi; import org.openapitools.openapidiff.core.output.JsonRender; @@ -10,16 +12,22 @@ public class JsonRenderTest { @Test public void renderDoesNotFailWhenPropertyHasBeenRemoved() { JsonRender render = new JsonRender(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); ChangedOpenApi diff = OpenApiCompare.fromLocations("missing_property_1.yaml", "missing_property_2.yaml"); - assertThat(render.render(diff)).isNotBlank(); + render.render(diff, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); } @Test public void renderDoesNotFailForJsr310Types() { JsonRender render = new JsonRender(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); ChangedOpenApi diff = OpenApiCompare.fromLocations("jsr310_property_1.yaml", "jsr310_property_2.yaml"); - assertThat(render.render(diff)).isNotBlank(); + render.render(diff, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); } } diff --git a/core/src/test/java/org/openapitools/openapidiff/core/MarkdownRenderTest.java b/core/src/test/java/org/openapitools/openapidiff/core/MarkdownRenderTest.java index 36e007a8..d30c6e0b 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/MarkdownRenderTest.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/MarkdownRenderTest.java @@ -2,6 +2,8 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.io.ByteArrayOutputStream; +import java.io.OutputStreamWriter; import org.junit.jupiter.api.Test; import org.openapitools.openapidiff.core.model.ChangedOpenApi; import org.openapitools.openapidiff.core.output.MarkdownRender; @@ -10,23 +12,32 @@ public class MarkdownRenderTest { @Test public void renderDoesNotFailWhenPropertyHasBeenRemoved() { MarkdownRender render = new MarkdownRender(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); ChangedOpenApi diff = OpenApiCompare.fromLocations("missing_property_1.yaml", "missing_property_2.yaml"); - assertThat(render.render(diff)).isNotBlank(); + render.render(diff, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); } @Test public void renderDoesNotCauseStackOverflowWithRecursiveDefinitions() { MarkdownRender render = new MarkdownRender(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); ChangedOpenApi diff = OpenApiCompare.fromLocations("recursive_old.yaml", "recursive_new.yaml"); - assertThat(render.render(diff)).isNotBlank(); + render.render(diff, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); } @Test public void renderDoesNotFailWhenHTTPStatusCodeIsRange() { MarkdownRender render = new MarkdownRender(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); ChangedOpenApi diff = OpenApiCompare.fromLocations("range_statuscode_1.yaml", "range_statuscode_2.yaml"); - assertThat(render.render(diff)).isNotBlank(); + render.render(diff, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); } } diff --git a/core/src/test/java/org/openapitools/openapidiff/core/OpenApiDiffTest.java b/core/src/test/java/org/openapitools/openapidiff/core/OpenApiDiffTest.java index 2d52392f..ea21bd28 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/OpenApiDiffTest.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/OpenApiDiffTest.java @@ -6,12 +6,10 @@ import io.swagger.parser.OpenAPIParser; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.parser.core.models.ParseOptions; -import java.io.FileWriter; -import java.io.IOException; -import java.nio.file.Path; +import java.io.ByteArrayOutputStream; +import java.io.OutputStreamWriter; import java.util.List; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; import org.openapitools.openapidiff.core.model.ChangedOpenApi; import org.openapitools.openapidiff.core.model.ChangedOperation; import org.openapitools.openapidiff.core.model.DiffResult; @@ -19,6 +17,7 @@ import org.openapitools.openapidiff.core.output.HtmlRender; import org.openapitools.openapidiff.core.output.JsonRender; import org.openapitools.openapidiff.core.output.MarkdownRender; +import org.openapitools.openapidiff.core.output.Render; public class OpenApiDiffTest { @@ -35,7 +34,7 @@ public void testEqual() { } @Test - public void testNewApi(@TempDir Path tempDir) throws IOException { + public void testNewApi() { ChangedOpenApi changedOpenApi = OpenApiCompare.fromLocations(OPENAPI_EMPTY_DOC, OPENAPI_DOC2); List newEndpoints = changedOpenApi.getNewEndpoints(); List missingEndpoints = changedOpenApi.getMissingEndpoints(); @@ -44,18 +43,16 @@ public void testNewApi(@TempDir Path tempDir) throws IOException { assertThat(missingEndpoints).isEmpty(); assertThat(changedEndPoints).isEmpty(); - String html = - new HtmlRender("Changelog", "http://deepoove.com/swagger-diff/stylesheets/demo.css") - .render(changedOpenApi); - final Path path = tempDir.resolve("testNewApi.html"); - try (FileWriter fw = new FileWriter(path.toFile())) { - fw.write(html); - } - assertThat(path).isNotEmptyFile(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); + Render render = + new HtmlRender("Changelog", "http://deepoove.com/swagger-diff/stylesheets/demo.css"); + render.render(changedOpenApi, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); } @Test - public void testDeprecatedApi(@TempDir Path tempDir) throws IOException { + public void testDeprecatedApi() { ChangedOpenApi changedOpenApi = OpenApiCompare.fromLocations(OPENAPI_DOC1, OPENAPI_EMPTY_DOC); List newEndpoints = changedOpenApi.getNewEndpoints(); List missingEndpoints = changedOpenApi.getMissingEndpoints(); @@ -64,52 +61,46 @@ public void testDeprecatedApi(@TempDir Path tempDir) throws IOException { assertThat(missingEndpoints).isNotEmpty(); assertThat(changedEndPoints).isEmpty(); - String html = - new HtmlRender("Changelog", "http://deepoove.com/swagger-diff/stylesheets/demo.css") - .render(changedOpenApi); - final Path path = tempDir.resolve("testDeprecatedApi.html"); - try (FileWriter fw = new FileWriter(path.toFile())) { - fw.write(html); - } - assertThat(path).isNotEmptyFile(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); + Render render = + new HtmlRender("Changelog", "http://deepoove.com/swagger-diff/stylesheets/demo.css"); + render.render(changedOpenApi, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); } @Test - public void testDiff(@TempDir Path tempDir) throws IOException { + public void testDiff() { ChangedOpenApi changedOpenApi = OpenApiCompare.fromLocations(OPENAPI_DOC1, OPENAPI_DOC2); List changedEndPoints = changedOpenApi.getChangedOperations(); assertThat(changedEndPoints).isNotEmpty(); - String html = - new HtmlRender("Changelog", "http://deepoove.com/swagger-diff/stylesheets/demo.css") - .render(changedOpenApi); - final Path path = tempDir.resolve("testDiff.html"); - try (FileWriter fw = new FileWriter(path.toFile())) { - fw.write(html); - } - assertThat(path).isNotEmptyFile(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); + Render render = + new HtmlRender("Changelog", "http://deepoove.com/swagger-diff/stylesheets/demo.css"); + render.render(changedOpenApi, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); } @Test - public void testDiffAndMarkdown(@TempDir Path tempDir) throws IOException { + public void testDiffAndMarkdown() { ChangedOpenApi diff = OpenApiCompare.fromLocations(OPENAPI_DOC1, OPENAPI_DOC2); - String render = new MarkdownRender().render(diff); - final Path path = tempDir.resolve("testDiff.md"); - try (FileWriter fw = new FileWriter(path.toFile())) { - fw.write(render); - } - assertThat(path).isNotEmptyFile(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); + Render render = new MarkdownRender(); + render.render(diff, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); } @Test - public void testDiffAndJson(@TempDir Path tempDir) throws IOException { + public void testDiffAndJson() { ChangedOpenApi diff = OpenApiCompare.fromLocations(OPENAPI_DOC1, OPENAPI_DOC2); - String render = new JsonRender().render(diff); - final Path path = tempDir.resolve("testDiff.json"); - try (FileWriter fw = new FileWriter(path.toFile())) { - fw.write(render); - } - assertThat(path).isNotEmptyFile(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); + Render render = new JsonRender(); + render.render(diff, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); } /** Testing that repetitive specs comparisons has to produce consistent result. */ diff --git a/core/src/test/java/org/openapitools/openapidiff/core/ResponseAddedContentSchemaTest.java b/core/src/test/java/org/openapitools/openapidiff/core/ResponseAddedContentSchemaTest.java index a4f0cabb..725c7e0e 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/ResponseAddedContentSchemaTest.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/ResponseAddedContentSchemaTest.java @@ -3,6 +3,8 @@ import static org.assertj.core.api.Assertions.assertThat; import io.swagger.v3.oas.models.media.Content; +import java.io.ByteArrayOutputStream; +import java.io.OutputStreamWriter; import java.util.Map; import org.junit.jupiter.api.Test; import org.openapitools.openapidiff.core.model.ChangedOpenApi; @@ -10,6 +12,7 @@ import org.openapitools.openapidiff.core.output.ConsoleRender; import org.openapitools.openapidiff.core.output.HtmlRender; import org.openapitools.openapidiff.core.output.MarkdownRender; +import org.openapitools.openapidiff.core.output.Render; public class ResponseAddedContentSchemaTest { @@ -39,8 +42,22 @@ public void testDiffDifferent() { public void testDiffCanBeRendered() { ChangedOpenApi changedOpenApi = OpenApiCompare.fromLocations(OPENAPI_DOC1, OPENAPI_DOC2); - assertThat(new ConsoleRender().render(changedOpenApi)).isNotBlank(); - assertThat(new HtmlRender().render(changedOpenApi)).isNotBlank(); - assertThat(new MarkdownRender().render(changedOpenApi)).isNotBlank(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); + Render render = new ConsoleRender(); + render.render(changedOpenApi, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); + + outputStream = new ByteArrayOutputStream(); + outputStreamWriter = new OutputStreamWriter(outputStream); + render = new HtmlRender(); + render.render(changedOpenApi, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); + + outputStream = new ByteArrayOutputStream(); + outputStreamWriter = new OutputStreamWriter(outputStream); + render = new MarkdownRender(); + render.render(changedOpenApi, outputStreamWriter); + assertThat(outputStream.toString()).isNotBlank(); } } diff --git a/maven/src/main/java/org/openapitools/openapidiff/maven/OpenApiDiffMojo.java b/maven/src/main/java/org/openapitools/openapidiff/maven/OpenApiDiffMojo.java index 7b1e679d..af402c9f 100644 --- a/maven/src/main/java/org/openapitools/openapidiff/maven/OpenApiDiffMojo.java +++ b/maven/src/main/java/org/openapitools/openapidiff/maven/OpenApiDiffMojo.java @@ -1,5 +1,7 @@ package org.openapitools.openapidiff.maven; +import java.io.ByteArrayOutputStream; +import java.io.OutputStreamWriter; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; @@ -37,7 +39,10 @@ public void execute() throws MojoExecutionException, MojoFailureException { try { final ChangedOpenApi diff = OpenApiCompare.fromLocations(oldSpec, newSpec); - getLog().info(new ConsoleRender().render(diff)); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream); + new ConsoleRender().render(diff, outputStreamWriter); + getLog().info(outputStream.toString()); if (failOnIncompatible && diff.isIncompatible()) { throw new BackwardIncompatibilityException("The API changes broke backward compatibility"); From 5b5b820a8555b8f503ca64fb9d4518ac179c1348 Mon Sep 17 00:00:00 2001 From: Bhavesh Mistry Date: Tue, 25 Jul 2023 12:54:21 -0700 Subject: [PATCH 24/25] Fix potential NPEs in ParametersDiff and HtmlRender (#517) Co-authored-by: Bhavesh Mistry --- .../openapitools/openapidiff/core/compare/ParametersDiff.java | 4 +++- .../org/openapitools/openapidiff/core/output/HtmlRender.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/openapitools/openapidiff/core/compare/ParametersDiff.java b/core/src/main/java/org/openapitools/openapidiff/core/compare/ParametersDiff.java index c12eeaf9..b5cf4c03 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/compare/ParametersDiff.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/compare/ParametersDiff.java @@ -9,6 +9,8 @@ import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; + +import org.apache.commons.lang3.StringUtils; import org.openapitools.openapidiff.core.model.Changed; import org.openapitools.openapidiff.core.model.ChangedParameters; import org.openapitools.openapidiff.core.model.DiffContext; @@ -99,7 +101,7 @@ public boolean pathUnchangedParametersChanged( // Speedy Check. Use the map already created in changedParameters to check if missing param is // linked to newParam String newParameterName = context.getParameters().get(parameter.getName()); - if (newParameterName.isEmpty()) return false; + if (StringUtils.isBlank(newParameterName)) return false; Optional newParameter = changedParameters.getIncreased().stream() diff --git a/core/src/main/java/org/openapitools/openapidiff/core/output/HtmlRender.java b/core/src/main/java/org/openapitools/openapidiff/core/output/HtmlRender.java index f84bd79e..99861ab9 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/output/HtmlRender.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/output/HtmlRender.java @@ -420,7 +420,7 @@ private LiTag li_changedParam(ChangedParameter changeParam) { Parameter leftParam = changeParam.getOldParameter(); LiTag li = li().withText(changeParam.getName() + " in " + changeParam.getIn()); if (changeRequired) { - li.withText(" change into " + (rightParam.getRequired() ? "required" : "not required")); + li.withText(" change into " + (rightParam.getRequired() != null && rightParam.getRequired() ? "required" : "not required")); } if (changeDescription) { li.withText(" Notes ") From 3c026ef9c0742bc068a399199996435a725c038d Mon Sep 17 00:00:00 2001 From: westse <10818305+westse@users.noreply.github.com> Date: Tue, 25 Jul 2023 14:09:14 -0600 Subject: [PATCH 25/25] Treat new PUT request properties as compatible again (#538) Effectively reverts change for #136 (and PR #137) which appear invalid in intent, implementation, and test. - Invalid in intent: #136 claims that adding a readOnly property to the request body of a PUT request is a breaking change because clients will begin to omit it and the server will interpret the omission as a directive to delete the property. This is incorrect because the server should expect, [per the OAS spec](https://spec.openapis.org/oas/v3.0.3#fixed-fields-19), that readOnly properties "SHOULD NOT be sent as part of the request". So it would be a bug for the server to delete any data associated with the readOnly property. Regardless, the API is left unbroken if the server simply ignores readOnly properties. - Invalid in implementation: the code treats as incompatible any new PUT request property, not just readOnly properties. - Invalid in test: no readOnly properties are tested. In theory one could argue that some servers might enforce the "SHOULD NOT" language of the spec by returning validation errors where they didn't before, and this would constitute an API breakage. But that should be discussed in a different issue. Fixes #537 Refs #136 Refs #137 --- .../openapidiff/core/model/ChangedSchema.java | 4 ---- .../openapidiff/core/AddPropPutDiffTest.java | 10 +++++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSchema.java b/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSchema.java index 80d98007..d62cd7b6 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSchema.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSchema.java @@ -1,6 +1,5 @@ package org.openapitools.openapidiff.core.model; -import io.swagger.v3.oas.models.PathItem; import io.swagger.v3.oas.models.media.Schema; import java.util.*; import java.util.stream.Collectors; @@ -157,9 +156,6 @@ private DiffResult calculateCoreChanged() { } private boolean compatibleForRequest() { - if (PathItem.HttpMethod.PUT.equals(context.getMethod()) && !increasedProperties.isEmpty()) { - return false; - } return (oldSchema != null || newSchema == null); } diff --git a/core/src/test/java/org/openapitools/openapidiff/core/AddPropPutDiffTest.java b/core/src/test/java/org/openapitools/openapidiff/core/AddPropPutDiffTest.java index d73ab6eb..6ecc1bc2 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/AddPropPutDiffTest.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/AddPropPutDiffTest.java @@ -1,9 +1,10 @@ package org.openapitools.openapidiff.core; +import static org.assertj.core.api.Assertions.assertThat; import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiAreEquals; -import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible; import org.junit.jupiter.api.Test; +import org.openapitools.openapidiff.core.model.ChangedOpenApi; public class AddPropPutDiffTest { private final String OPENAPI_DOC1 = "add-prop-put-1.yaml"; @@ -15,7 +16,10 @@ public void testDiffSame() { } @Test - public void testDiffDifferent() { - assertOpenApiBackwardIncompatible(OPENAPI_DOC1, OPENAPI_DOC2); + public void testFieldAdditionalInPutApiIsCompatible() { + // See https://github.com/OpenAPITools/openapi-diff/pull/537 + ChangedOpenApi changedOpenApi = OpenApiCompare.fromLocations(OPENAPI_DOC1, OPENAPI_DOC2); + assertThat(changedOpenApi.isDifferent()).isTrue(); + assertThat(changedOpenApi.isCompatible()).isTrue(); } }