From a674aa1e1eba74a1310be1d07e2647757f714e5f Mon Sep 17 00:00:00 2001 From: Aliaksandr Pinchuk Date: Wed, 3 Sep 2025 18:28:13 +0200 Subject: [PATCH 01/13] Bump to 2.1.4-SNAPSHOT --- cli/pom.xml | 2 +- core/pom.xml | 2 +- maven-example/pom.xml | 4 ++-- maven/pom.xml | 2 +- pom.xml | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cli/pom.xml b/cli/pom.xml index caf4c001..50550ca1 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -4,7 +4,7 @@ org.openapitools.openapidiff openapi-diff-parent - 2.1.3 + 2.1.4-SNAPSHOT openapi-diff-cli diff --git a/core/pom.xml b/core/pom.xml index 769422fa..92dcc697 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -4,7 +4,7 @@ org.openapitools.openapidiff openapi-diff-parent - 2.1.3 + 2.1.4-SNAPSHOT openapi-diff-core diff --git a/maven-example/pom.xml b/maven-example/pom.xml index 2122455e..074bf240 100644 --- a/maven-example/pom.xml +++ b/maven-example/pom.xml @@ -3,7 +3,7 @@ openapi-diff-parent org.openapitools.openapidiff - 2.1.3 + 2.1.4-SNAPSHOT 4.0.0 @@ -23,7 +23,7 @@ org.openapitools.openapidiff openapi-diff-maven - 2.1.3 + 2.1.4-SNAPSHOT diff --git a/maven/pom.xml b/maven/pom.xml index 7434daed..0a6d9666 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -5,7 +5,7 @@ org.openapitools.openapidiff openapi-diff-parent - 2.1.3 + 2.1.4-SNAPSHOT openapi-diff-maven diff --git a/pom.xml b/pom.xml index 15f52994..45c44a54 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ org.openapitools.openapidiff openapi-diff-parent - 2.1.3 + 2.1.4-SNAPSHOT pom openapi-diff-parent @@ -82,7 +82,7 @@ 1.8 UTF-8 UTF-8 - 2025-09-03T14:43:41Z + 2025-09-03T16:27:22Z github openapitools @@ -99,7 +99,7 @@ org.openapitools.openapidiff openapi-diff-core - 2.1.3 + 2.1.4-SNAPSHOT org.junit From 3d2280e279dc46fc8c4fb13a0271a9ffcb926d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kure=C5=A1?= Date: Thu, 25 Sep 2025 09:29:31 +0200 Subject: [PATCH 02/13] fix for issue 834 (#835) * changed different line separators in AsciiDocRender.java to make it consistent * changed \n in AsciiRender to System.lineSeparator() in all places and fixed tests with isEqualToNormalizingNewlines --- .../core/output/AsciidocRender.java | 33 +++++++++++++------ .../core/output/AsciidocRenderTest.java | 4 +-- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/org/openapitools/openapidiff/core/output/AsciidocRender.java b/core/src/main/java/org/openapitools/openapidiff/core/output/AsciidocRender.java index 997241dc..ac7c997b 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/output/AsciidocRender.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/output/AsciidocRender.java @@ -42,7 +42,12 @@ public void render(ChangedOpenApi diff, OutputStreamWriter outputStreamWriter) { diff.getNewSpecOpenApi().getInfo().getTitle(), diff.getNewSpecOpenApi().getInfo().getVersion())); safelyAppend(outputStreamWriter, System.lineSeparator()); - safelyAppend(outputStreamWriter, ":reproducible:\n:sectlinks:\n:toc:\n"); + safelyAppend(outputStreamWriter, ":reproducible:"); + safelyAppend(outputStreamWriter, System.lineSeparator()); + safelyAppend(outputStreamWriter, ":sectlinks:"); + safelyAppend(outputStreamWriter, System.lineSeparator()); + safelyAppend(outputStreamWriter, ":toc:"); + safelyAppend(outputStreamWriter, System.lineSeparator()); safelyAppend(outputStreamWriter, System.lineSeparator()); List newEndpoints = diff.getNewEndpoints(); @@ -86,19 +91,23 @@ private void ol_changed( Optional.ofNullable(operation.getSummary()).map(ChangedMetadata::getRight).orElse(""); safelyAppend(outputStreamWriter, itemEndpoint(method, pathUrl, desc)); + safelyAppend(outputStreamWriter, System.lineSeparator()); if (result(operation.getParameters()).isDifferent()) { - safelyAppend(outputStreamWriter, "* Parameter:\n"); + safelyAppend(outputStreamWriter, "* Parameter:"); + safelyAppend(outputStreamWriter, System.lineSeparator()); safelyAppend(outputStreamWriter, ul_param(operation.getParameters())); safelyAppend(outputStreamWriter, System.lineSeparator()); } if (operation.resultRequestBody().isDifferent()) { - safelyAppend(outputStreamWriter, "* Request:\n"); + safelyAppend(outputStreamWriter, "* Request:"); + safelyAppend(outputStreamWriter, System.lineSeparator()); safelyAppend( outputStreamWriter, ul_content(operation.getRequestBody().getContent(), true, 2)); safelyAppend(outputStreamWriter, System.lineSeparator()); } if (operation.resultApiResponses().isDifferent()) { - safelyAppend(outputStreamWriter, "* Return Type:\n"); + safelyAppend(outputStreamWriter, "* Return Type:"); + safelyAppend(outputStreamWriter, System.lineSeparator()); safelyAppend(outputStreamWriter, ul_response(operation.getApiResponses())); safelyAppend(outputStreamWriter, System.lineSeparator()); } @@ -128,13 +137,14 @@ private String itemResponse(String title, String code) { if (!code.equals("default") && !code.matches("[1-5]XX")) { status = HttpStatus.getReasonPhrase(Integer.parseInt(code)); } - sb.append(title).append(code).append(' ').append(status).append("\n"); + sb.append(title).append(code).append(' ').append(status).append(System.lineSeparator()); return sb.toString(); } private String itemChangedResponse(String title, String contentType, ChangedResponse response) { return itemResponse(title, contentType) - + "** Media types:\n" + + "** Media types:" + + System.lineSeparator() + ul_content(response.getContent(), false, 3); } @@ -158,7 +168,7 @@ private String ul_content(ChangedContent changedContent, boolean isRequest, int } private String itemContent(String title, String contentType, int indent) { - return StringUtils.repeat('*', indent) + " " + title + contentType + "\n"; + return StringUtils.repeat('*', indent) + " " + title + contentType + System.lineSeparator(); } private String itemContent( @@ -171,7 +181,7 @@ private String itemContent( sb.append(itemContent(title, contentType, indent)) .append(itemContent("Schema:", "", indent)) .append(changedMediaType.isCompatible() ? "Backward compatible" : "Broken compatibility") - .append("\n"); + .append(System.lineSeparator()); if (!changedMediaType.isCompatible()) { sb.append(incompatibilities(changedMediaType.getSchema())); } @@ -190,6 +200,8 @@ private String incompatibilities(String propName, final ChangedSchema schema) { if (schema.isCoreChanged() == DiffResult.INCOMPATIBLE && schema.isChangedType()) { String type = type(schema.getOldSchema()) + " -> " + type(schema.getNewSchema()); sb.append(property(propName, "Changed property type", type)); + sb.append(System.lineSeparator()); + sb.append(System.lineSeparator()); } String prefix = propName.isEmpty() ? "" : propName + "."; sb.append( @@ -226,7 +238,7 @@ protected String property(String name, String title, Schema schema) { } protected String property(String name, String title, String type) { - return String.format("*** %s: %s (%s)%n\n", title, name, type); + return String.format("*** %s: %s (%s)", title, name, type); } protected Schema resolve(Schema schema) { @@ -286,12 +298,13 @@ private String listEndpoints( sb.append( itemEndpoint( endpoint.getMethod().toString(), endpoint.getPathUrl(), endpoint.getSummary())); + sb.append(System.lineSeparator()); } return sb.append(System.lineSeparator()).toString(); } private String itemEndpoint(String method, String path, String desc) { - return String.format("=== %s%s%n", StringUtils.rightPad(method, 6), path); + return String.format("=== %s%s", StringUtils.rightPad(method, 6), path); } public String bigTitle(String title, String version) { diff --git a/core/src/test/java/org/openapitools/openapidiff/core/output/AsciidocRenderTest.java b/core/src/test/java/org/openapitools/openapidiff/core/output/AsciidocRenderTest.java index 228623a2..15c698d6 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/output/AsciidocRenderTest.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/output/AsciidocRenderTest.java @@ -50,7 +50,7 @@ public void validateAsciiDocChangeFile() { OpenApiCompare.fromLocations("missing_property_1.yaml", "missing_property_2.yaml"); render.render(diff, outputStreamWriter); assertThat(outputStream.toString()) - .isEqualTo( + .isEqualToNormalizingNewlines( "= TITLE (v 1.0.0)\n" + ":reproducible:\n" + ":sectlinks:\n" @@ -78,7 +78,7 @@ public void validateAsciiDocRangeStatus() { OpenApiCompare.fromLocations("range_statuscode_1.yaml", "range_statuscode_2.yaml"); render.render(diff, outputStreamWriter); assertThat(outputStream.toString()) - .isEqualTo( + .isEqualToNormalizingNewlines( "= PROJECTS API (v 1.0.0)\n" + ":reproducible:\n" + ":sectlinks:\n" From 34121d55bd51ff76b137f7d879b9f3c06ac6a878 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Sep 2025 10:11:20 +0200 Subject: [PATCH 03/13] build(deps): bump org.assertj:assertj-core from 3.27.4 to 3.27.6 (#833) Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.27.4 to 3.27.6. - [Release notes](https://github.com/assertj/assertj/releases) - [Commits](https://github.com/assertj/assertj/compare/assertj-build-3.27.4...assertj-build-3.27.6) --- updated-dependencies: - dependency-name: org.assertj:assertj-core dependency-version: 3.27.6 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 45c44a54..22f589f1 100644 --- a/pom.xml +++ b/pom.xml @@ -171,7 +171,7 @@ org.assertj assertj-core - 3.27.4 + 3.27.6 test From 684fd7416b7b9437f2b140fc776a699349406611 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Sep 2025 10:13:08 +0200 Subject: [PATCH 04/13] build(deps): bump org.apache.maven.plugins:maven-javadoc-plugin (#832) Bumps [org.apache.maven.plugins:maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.11.3 to 3.12.0. - [Release notes](https://github.com/apache/maven-javadoc-plugin/releases) - [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.11.3...maven-javadoc-plugin-3.12.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-javadoc-plugin dependency-version: 3.12.0 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 22f589f1..bffd205f 100644 --- a/pom.xml +++ b/pom.xml @@ -309,7 +309,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.11.3 + 3.12.0 org.apache.maven.plugins From a16d30072f7585cbd2dc03394a88313fec51daad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Sep 2025 10:13:25 +0200 Subject: [PATCH 05/13] build(deps): bump org.apache.maven.plugins:maven-surefire-plugin (#830) Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.5.3 to 3.5.4. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.5.3...surefire-3.5.4) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-surefire-plugin dependency-version: 3.5.4 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 bffd205f..c253dffb 100644 --- a/pom.xml +++ b/pom.xml @@ -314,7 +314,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.5.3 + 3.5.4 com.coveo From 8ccc28b05f2d54afff1fed8f4ea69491bf9e0f90 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Sep 2025 10:13:39 +0200 Subject: [PATCH 06/13] build(deps): bump org.apache.maven.plugins:maven-shade-plugin (#829) Bumps [org.apache.maven.plugins:maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.6.0 to 3.6.1. - [Release notes](https://github.com/apache/maven-shade-plugin/releases) - [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.6.0...v3.6.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-shade-plugin dependency-version: 3.6.1 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 c253dffb..77c28326 100644 --- a/pom.xml +++ b/pom.xml @@ -339,7 +339,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.6.0 + 3.6.1 org.sonatype.central From 7d6285218923bcc11ae3108c32dcfefc58a4eef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kure=C5=A1?= Date: Fri, 26 Sep 2025 10:35:47 +0200 Subject: [PATCH 07/13] fix for issue 814 (#836) * changed equal validation for changed example to properly validate arrays of primitive types changed equal validation for changed example to properly validate arrays of primitive types * removed unnecessary import from test class * proposed new solution with deepEquals on Objects, fix also added to ChangedExamples.java, Fixed suggestion from copilot, grammatical error * formatting fix formatting fix * moved test from ConsoleRenderTest to SchemaDiffTest class as suggested in review * Moved test resource to proper location --- .../core/model/ChangedExample.java | 3 ++- .../core/model/ChangedExamples.java | 2 +- .../core/output/AsciidocRender.java | 2 +- .../core/output/ConsoleRender.java | 2 +- .../openapidiff/core/SchemaDiffTest.java | 17 ++++++++++++ ...828-binary-example-for-csv-media-type.yaml | 26 +++++++++++++++++++ 6 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 core/src/test/resources/schemaDiff/issue-828-binary-example-for-csv-media-type.yaml diff --git a/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedExample.java b/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedExample.java index 4e540eca..2fbb93b1 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedExample.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedExample.java @@ -30,9 +30,10 @@ public void setRightExample(Object rightExample) { @Override public DiffResult isChanged() { - if (!Objects.equals(leftExample, rightExample)) { + if (!Objects.deepEquals(leftExample, rightExample)) { return DiffResult.METADATA; } + return DiffResult.NO_CHANGES; } diff --git a/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedExamples.java b/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedExamples.java index c1a00bbb..5bf27a72 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedExamples.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedExamples.java @@ -30,7 +30,7 @@ public void setRightExamples(Object rightExamples) { @Override public DiffResult isChanged() { - if (!Objects.equals(leftExamples, rightExamples)) { + if (!Objects.deepEquals(leftExamples, rightExamples)) { return DiffResult.METADATA; } return DiffResult.NO_CHANGES; diff --git a/core/src/main/java/org/openapitools/openapidiff/core/output/AsciidocRender.java b/core/src/main/java/org/openapitools/openapidiff/core/output/AsciidocRender.java index ac7c997b..b45b2034 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/output/AsciidocRender.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/output/AsciidocRender.java @@ -34,7 +34,7 @@ public void render(ChangedOpenApi diff, OutputStreamWriter outputStreamWriter) { diff.getNewSpecOpenApi().getInfo().getVersion())); safelyAppend(outputStreamWriter, System.lineSeparator()); safelyAppend(outputStreamWriter, System.lineSeparator()); - safelyAppend(outputStreamWriter, "NOTE: No differences. Specifications are equivalents"); + safelyAppend(outputStreamWriter, "NOTE: No differences. Specifications are equivalent"); } else { safelyAppend( outputStreamWriter, 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 4f8e10fc..37b926cd 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 @@ -27,7 +27,7 @@ public class ConsoleRender implements Render { public void render(ChangedOpenApi diff, OutputStreamWriter outputStreamWriter) { this.diff = diff; if (diff.isUnchanged()) { - safelyAppend(outputStreamWriter, "No differences. Specifications are equivalents"); + safelyAppend(outputStreamWriter, "No differences. Specifications are equivalent"); } else { safelyAppend(outputStreamWriter, bigTitle("Api Change Log")); safelyAppend( diff --git a/core/src/test/java/org/openapitools/openapidiff/core/SchemaDiffTest.java b/core/src/test/java/org/openapitools/openapidiff/core/SchemaDiffTest.java index 1f41406a..b5cdae03 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/SchemaDiffTest.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/SchemaDiffTest.java @@ -438,4 +438,21 @@ public void testAllOfDiff() { assertThat(changedSchema.getRequired().getMissing()).containsExactly("fieldA"); assertThat(changedSchema.getRequired().getIncreased()).isEmpty(); } + + @Test + void renderShowsNoDifferencesWhenCSVMediaTypeResponseExampleIsByteArray() { + ChangedOpenApi changedOpenApi = + OpenApiCompare.fromLocations( + "schemaDiff/issue-828-binary-example-for-csv-media-type.yaml", + "schemaDiff/issue-828-binary-example-for-csv-media-type.yaml"); + + assertThat(changedOpenApi).isNotNull(); + + assertThat(changedOpenApi.isUnchanged()).isTrue(); + assertThat(changedOpenApi.isDifferent()).isFalse(); + assertThat(changedOpenApi.isChanged()).isEqualTo(DiffResult.NO_CHANGES); + assertThat(changedOpenApi.isIncompatible()).isFalse(); + assertThat(changedOpenApi.isCompatible()).isTrue(); + assertThat(changedOpenApi.isCoreChanged()).isEqualTo(DiffResult.NO_CHANGES); + } } diff --git a/core/src/test/resources/schemaDiff/issue-828-binary-example-for-csv-media-type.yaml b/core/src/test/resources/schemaDiff/issue-828-binary-example-for-csv-media-type.yaml new file mode 100644 index 00000000..4da624e5 --- /dev/null +++ b/core/src/test/resources/schemaDiff/issue-828-binary-example-for-csv-media-type.yaml @@ -0,0 +1,26 @@ +openapi: 3.0.1 +info: + title: My API + version: 1.0.0 +paths: + /api/v1/csv: + get: + operationId: someCsvEndpoint + responses: + "200": + content: + text/csv: + schema: + type: string + format: binary + example: Example + description: Successful operation + security: + - Bearer: [] + summary: Download a CSV or something +components: + securitySchemes: + Bearer: + bearerFormat: JWT + scheme: bearer + type: http \ No newline at end of file From 1e65e50df14477103f0c1eef5e31309d54cff56a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Oct 2025 12:13:06 +0200 Subject: [PATCH 08/13] build(deps): bump org.apache.maven.plugins:maven-compiler-plugin (#840) Bumps [org.apache.maven.plugins:maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.14.0 to 3.14.1. - [Release notes](https://github.com/apache/maven-compiler-plugin/releases) - [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.14.0...maven-compiler-plugin-3.14.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-compiler-plugin dependency-version: 3.14.1 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 77c28326..8a9b13e1 100644 --- a/pom.xml +++ b/pom.xml @@ -282,7 +282,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.14.0 + 3.14.1 org.apache.maven.plugins From 5a888c935bdd506c80aa8ede15c937710debf571 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Oct 2025 12:13:24 +0200 Subject: [PATCH 09/13] build(deps): bump org.apache.commons:commons-lang3 from 3.18.0 to 3.19.0 (#842) Bumps org.apache.commons:commons-lang3 from 3.18.0 to 3.19.0. --- updated-dependencies: - dependency-name: org.apache.commons:commons-lang3 dependency-version: 3.19.0 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 8a9b13e1..5d3ccfe7 100644 --- a/pom.xml +++ b/pom.xml @@ -146,7 +146,7 @@ org.apache.commons commons-lang3 - 3.18.0 + 3.19.0 org.slf4j From 52f325efff65ce228fe9e9993ebc23a0987c3487 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Oct 2025 12:14:41 +0200 Subject: [PATCH 10/13] build(deps): bump org.sonatype.central:central-publishing-maven-plugin (#841) Bumps [org.sonatype.central:central-publishing-maven-plugin](https://github.com/sonatype/central-publishing-maven-plugin) from 0.8.0 to 0.9.0. - [Commits](https://github.com/sonatype/central-publishing-maven-plugin/commits) --- updated-dependencies: - dependency-name: org.sonatype.central:central-publishing-maven-plugin dependency-version: 0.9.0 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5d3ccfe7..912f607d 100644 --- a/pom.xml +++ b/pom.xml @@ -232,7 +232,7 @@ org.sonatype.central central-publishing-maven-plugin - 0.8.0 + 0.9.0 true central @@ -344,7 +344,7 @@ org.sonatype.central central-publishing-maven-plugin - 0.8.0 + 0.9.0 org.jacoco From 78393d0ccfec46879465612bd31bb4583c342c72 Mon Sep 17 00:00:00 2001 From: Sebastien Dionne Date: Mon, 13 Oct 2025 07:21:49 -0400 Subject: [PATCH 11/13] Fix typos and linguistic errors in documentation (#846) Signed-off-by: Sebastien Dionne --- CONTRIBUTING.md | 2 +- README.md | 10 +-- .../openapitools/openapidiff/cli/Main.java | 6 +- .../openapidiff/core/OpenApiCompare.java | 86 +++++++++---------- .../openapidiff/core/compare/MapKeyDiff.java | 2 +- .../core/compare/ParametersDiff.java | 6 +- 6 files changed, 56 insertions(+), 56 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3d05fc16..1371be1e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,5 +8,5 @@ - File a PR with meaningful title, description and commit messages - Make sure the option "Allow edits from maintainers" in the PR is selected so that the maintainers can update your PRs with minor fixes, if needed. - Recommended git settings - - `git config core.autocrlf input` to tell Git convert CRLF to LF on commit but not the other way around + - `git config core.autocrlf input` to tell Git to convert CRLF to LF on commit but not the other way around - To close an issue (e.g. issue 1542) automatically after a PR is merged, use keywords "fix", "close", "resolve" in the PR description, e.g. `fix #1542`. (Ref: [closing issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/)) diff --git a/README.md b/README.md index ddaf3a1f..8da667ec 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OpenAPI-diff -Compare two OpenAPI specifications (3.x) and render the difference to HTML plaintext, Markdown files, or JSON files. +Compare two OpenAPI specifications (3.x) and render the difference to HTML plain text, Markdown files, or JSON files. [![Build](https://github.com/OpenAPITools/openapi-diff/workflows/Main%20Build/badge.svg)](https://github.com/OpenAPITools/openapi-diff/actions?query=branch%3Amaster+workflow%3A"Main+Build") [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=OpenAPITools_openapi-diff&metric=alert_status)](https://sonarcloud.io/dashboard?id=OpenAPITools_openapi-diff) @@ -20,7 +20,7 @@ Compare two OpenAPI specifications (3.x) and render the difference to HTML plain # Feature * Supports OpenAPI spec v3.0. -* Depth comparison of parameters, responses, endpoint, http method (GET,POST,PUT,DELETE...) +* In-depth comparison of parameters, responses, endpoint, http method (GET,POST,PUT,DELETE...) * Supports swagger api Authorization * Render difference of property with Expression Language * HTML, Markdown, Asciidoc & JSON render @@ -195,9 +195,9 @@ public class Main { ### Path Matching while comparing two OpenAPI paths -Path matching controls how paths from the old and new specs are paired during comparison (PathsDiff.java). The default matcher (DefaultPathMatcher) obfuscates path parameter names, meaning `/users/{id}` matches `/users/{userId}`. Default matcher fails on ambiguous signatures if spec contains few paths semantically identical. In case this behaviour is not fitting your use case, you can implement your own matching strategy. +Path matching controls how paths from the old and new specs are paired during comparison (PathsDiff.java). The default matcher (DefaultPathMatcher) obfuscates path parameter names, meaning `/users/{id}` matches `/users/{userId}`. The default matcher fails on ambiguous signatures if the spec contains a few paths semantically identical. In case this behaviour is not fitting your use case, you can implement your own matching strategy. -You can plug in a custom matcher via `OpenApiDiffOptions` implementing the `PathMatcher` interface.: +You can plug in a custom matcher via `OpenApiDiffOptions` implementing the `PathMatcher` interface: ```java OpenApiDiffOptions options = OpenApiDiffOptions @@ -249,7 +249,7 @@ jsonRender.render(diff, outputStreamWriter); ### Extensions -This project uses Java Service Provider Inteface (SPI) so additional extensions can be added. +This project uses Java Service Provider Interface (SPI) so additional extensions can be added. To build your own extension, you simply need to create a `src/main/resources/META-INF/services/org.openapitools.openapidiff.core.compare.ExtensionDiff` file with the full classname of your implementation. Your class must also implement the `org.openapitools.openapidiff.core.compare.ExtensionDiff` interface. 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 a9e223d2..85f125d7 100644 --- a/cli/src/main/java/org/openapitools/openapidiff/cli/Main.java +++ b/cli/src/main/java/org/openapitools/openapidiff/cli/Main.java @@ -90,7 +90,7 @@ public static void main(String... args) { .numberOfArgs(2) .valueSeparator() .argName("property=value") - .desc("use given header for authorisation") + .desc("use given header for authorization") .build()); options.addOption( Option.builder() @@ -99,7 +99,7 @@ public static void main(String... args) { .numberOfArgs(2) .valueSeparator() .argName("property=value") - .desc("use query param for authorisation") + .desc("use query param for authorization") .build()); options.addOption( Option.builder() @@ -187,7 +187,7 @@ public static void main(String... args) { && !logLevel.equalsIgnoreCase("OFF")) { throw new ParseException( String.format( - "Invalid log level. Excepted: [TRACE, DEBUG, INFO, WARN, ERROR, OFF]. Given: %s", + "Invalid log level. Expected: [TRACE, DEBUG, INFO, WARN, ERROR, OFF]. Given: %s", logLevel)); } } diff --git a/core/src/main/java/org/openapitools/openapidiff/core/OpenApiCompare.java b/core/src/main/java/org/openapitools/openapidiff/core/OpenApiCompare.java index daa3af9b..529e7cf9 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/OpenApiCompare.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/OpenApiCompare.java @@ -21,10 +21,10 @@ public class OpenApiCompare { private OpenApiCompare() {} /** - * compare two openapi doc + * Compare two OpenAPI documents. * - * @param oldContent old api-doc location:Json or Http - * @param newContent new api-doc location:Json or Http + * @param oldContent old API document location: JSON or HTTP + * @param newContent new API document location: JSON or HTTP * @return Comparison result */ public static ChangedOpenApi fromContents(String oldContent, String newContent) { @@ -32,11 +32,11 @@ public static ChangedOpenApi fromContents(String oldContent, String newContent) } /** - * compare two openapi doc + * Compare two OpenAPI documents. * - * @param oldContent old api-doc location:Json or Http - * @param newContent new api-doc location:Json or Http - * @param auths + * @param oldContent old API document location: JSON or HTTP + * @param newContent new API document location: JSON or HTTP + * @param auths authorization values * @return Comparison result */ public static ChangedOpenApi fromContents( @@ -45,12 +45,12 @@ public static ChangedOpenApi fromContents( } /** - * compare two openapi doc + * Compare two OpenAPI documents. * - * @param oldContent old api-doc location:Json or Http - * @param newContent new api-doc location:Json or Http - * @param auths - * @param options + * @param oldContent old API document location: JSON or HTTP + * @param newContent new API document location: JSON or HTTP + * @param auths authorization values + * @param options comparison options * @return Comparison result */ public static ChangedOpenApi fromContents( @@ -63,10 +63,10 @@ public static ChangedOpenApi fromContents( } /** - * compare two openapi doc + * Compare two OpenAPI documents. * - * @param oldFile old api-doc file - * @param newFile new api-doc file + * @param oldFile old API document file + * @param newFile new API document file * @return Comparison result */ public static ChangedOpenApi fromFiles(File oldFile, File newFile) { @@ -74,11 +74,11 @@ public static ChangedOpenApi fromFiles(File oldFile, File newFile) { } /** - * compare two openapi doc + * Compare two OpenAPI documents. * - * @param oldFile old api-doc file - * @param newFile new api-doc file - * @param auths + * @param oldFile old API document file + * @param newFile new API document file + * @param auths authorization values * @return Comparison result */ public static ChangedOpenApi fromFiles( @@ -87,12 +87,12 @@ public static ChangedOpenApi fromFiles( } /** - * compare two openapi doc + * Compare two OpenAPI documents. * - * @param oldFile old api-doc file - * @param newFile new api-doc file - * @param auths - * @param options + * @param oldFile old API document file + * @param newFile new API document file + * @param auths authorization values + * @param options comparison options * @return Comparison result */ public static ChangedOpenApi fromFiles( @@ -101,10 +101,10 @@ public static ChangedOpenApi fromFiles( } /** - * compare two openapi doc + * Compare two OpenAPI documents. * - * @param oldLocation old api-doc location (local or http) - * @param newLocation new api-doc location (local or http) + * @param oldLocation old API document location (local or HTTP) + * @param newLocation new API document location (local or HTTP) * @return Comparison result */ public static ChangedOpenApi fromLocations(String oldLocation, String newLocation) { @@ -112,11 +112,11 @@ public static ChangedOpenApi fromLocations(String oldLocation, String newLocatio } /** - * compare two openapi doc + * Compare two OpenAPI documents. * - * @param oldLocation old api-doc location (local or http) - * @param newLocation new api-doc location (local or http) - * @param auths + * @param oldLocation old API document location (local or HTTP) + * @param newLocation new API document location (local or HTTP) + * @param auths authorization values * @return Comparison result */ public static ChangedOpenApi fromLocations( @@ -125,12 +125,12 @@ public static ChangedOpenApi fromLocations( } /** - * compare two openapi doc + * Compare two OpenAPI documents. * - * @param oldLocation old api-doc location (local or http) - * @param newLocation new api-doc location (local or http) - * @param auths - * @param options + * @param oldLocation old API document location (local or HTTP) + * @param newLocation new API document location (local or HTTP) + * @param auths authorization values + * @param options comparison options * @return Comparison result */ public static ChangedOpenApi fromLocations( @@ -143,10 +143,10 @@ public static ChangedOpenApi fromLocations( } /** - * compare two openapi doc + * Compare two OpenAPI documents. * - * @param oldSpec old api-doc specification - * @param newSpec new api-doc specification + * @param oldSpec old API document specification + * @param newSpec new API document specification * @return Comparison result */ public static ChangedOpenApi fromSpecifications(OpenAPI oldSpec, OpenAPI newSpec) { @@ -154,11 +154,11 @@ public static ChangedOpenApi fromSpecifications(OpenAPI oldSpec, OpenAPI newSpec } /** - * compare two openapi doc + * Compare two OpenAPI documents. * - * @param oldSpec old api-doc specification - * @param newSpec new api-doc specification - * @param options + * @param oldSpec old API document specification + * @param newSpec new API document specification + * @param options comparison options * @return Comparison result */ public static ChangedOpenApi fromSpecifications( diff --git a/core/src/main/java/org/openapitools/openapidiff/core/compare/MapKeyDiff.java b/core/src/main/java/org/openapitools/openapidiff/core/compare/MapKeyDiff.java index 5febe26e..9e623c6f 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/compare/MapKeyDiff.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/compare/MapKeyDiff.java @@ -6,7 +6,7 @@ import java.util.Map; import java.util.Map.Entry; -/** compare two Maps by key */ +/** Compare two Maps by key. */ public class MapKeyDiff { private Map increased; 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 6de3b4c2..2f2c83fc 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 @@ -28,7 +28,7 @@ public ParametersDiffResult( this.sameOperationsDiffSchema = sameOperationsDiffSchema; } } -/** compare two parameter */ +/** Compare two parameters. */ public class ParametersDiff { private static final RefPointer refPointer = new RefPointer<>(RefType.PARAMETERS); @@ -108,12 +108,12 @@ public boolean pathUnchangedParametersChanged( .findFirst(); if (!newParameter.isPresent()) return false; - // Check if the old and new Parameters match . IF so, return TRUE + // Check if the old and new Parameters match. IF so, return TRUE Parameter newParameterRealized = newParameter.get(); newParameterRealized.setName(parameter.getName()); // Make names similar boolean samePathDifferentParameter = !newParameterRealized.equals(parameter); newParameterRealized.setName( - newParameterName); // Important:: MUST Reset the name as this is not a copy + newParameterName); // Important: MUST Reset the name as this is not a copy if (samePathDifferentParameter) { return true; } From 6265628c295cb0764177c7c307e5cc7e3ae66705 Mon Sep 17 00:00:00 2001 From: jdesrochers-atpco Date: Tue, 14 Oct 2025 16:11:50 -0400 Subject: [PATCH 12/13] Merge pull request #848 * fix(#845): Proposed solution to disable BC on pattern change --- .../core/model/BackwardIncompatibleProp.java | 1 + .../core/model/schema/ChangedPattern.java | 10 +- .../core/backcompat/SchemaBCTest.java | 7 ++ .../resources/bc_schema_pattern_changed.yaml | 116 ++++++++++++++++++ 4 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 core/src/test/resources/bc_schema_pattern_changed.yaml diff --git a/core/src/main/java/org/openapitools/openapidiff/core/model/BackwardIncompatibleProp.java b/core/src/main/java/org/openapitools/openapidiff/core/model/BackwardIncompatibleProp.java index f05a72f7..0772eace 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/model/BackwardIncompatibleProp.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/model/BackwardIncompatibleProp.java @@ -53,6 +53,7 @@ public enum BackwardIncompatibleProp { SECURITY_SCHEME_SCOPES_INCREASED("incompatible.security.scheme.scopes.increased", true), SCHEMA_DISCRIMINATOR_CHANGED("incompatible.schema.discriminator.changed", true), SCHEMA_TYPE_CHANGED("incompatible.schema.type.changed", true), + SCHEMA_PATTERN_CHANGED("incompatible.schema.pattern.changed", true), ; private final String propertyName; diff --git a/core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedPattern.java b/core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedPattern.java index 06907cd2..c6104658 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedPattern.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedPattern.java @@ -1,5 +1,7 @@ package org.openapitools.openapidiff.core.model.schema; +import static org.openapitools.openapidiff.core.model.BackwardIncompatibleProp.SCHEMA_PATTERN_CHANGED; + import java.util.Objects; import org.openapitools.openapidiff.core.model.Changed; import org.openapitools.openapidiff.core.model.DiffContext; @@ -18,7 +20,13 @@ public ChangedPattern(String oldPattern, String newPattern, DiffContext context) @Override public DiffResult isChanged() { - return Objects.equals(oldPattern, newPattern) ? DiffResult.NO_CHANGES : DiffResult.INCOMPATIBLE; + if (Objects.equals(oldPattern, newPattern)) { + return DiffResult.NO_CHANGES; + } else if (SCHEMA_PATTERN_CHANGED.enabled(context)) { + return DiffResult.INCOMPATIBLE; + } else { + return DiffResult.COMPATIBLE; + } } @Override 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 index 781b48f2..28d6d398 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SchemaBCTest.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/backcompat/SchemaBCTest.java @@ -6,6 +6,7 @@ import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged; import static org.openapitools.openapidiff.core.model.BackwardIncompatibleProp.RESPONSE_REQUIRED_DECREASED; import static org.openapitools.openapidiff.core.model.BackwardIncompatibleProp.SCHEMA_DISCRIMINATOR_CHANGED; +import static org.openapitools.openapidiff.core.model.BackwardIncompatibleProp.SCHEMA_PATTERN_CHANGED; import static org.openapitools.openapidiff.core.model.BackwardIncompatibleProp.SCHEMA_TYPE_CHANGED; import org.junit.jupiter.api.Test; @@ -69,4 +70,10 @@ public void typeChanged() { BackwardIncompatibleProp prop = SCHEMA_TYPE_CHANGED; assertSpecIncompatible(BASE, "bc_schema_type_changed.yaml", prop); } + + @Test + public void patternChanged() { + BackwardIncompatibleProp prop = SCHEMA_PATTERN_CHANGED; + assertSpecIncompatible(BASE, "bc_schema_pattern_changed.yaml", prop); + } } diff --git a/core/src/test/resources/bc_schema_pattern_changed.yaml b/core/src/test/resources/bc_schema_pattern_changed.yaml new file mode 100644 index 00000000..3af05b7e --- /dev/null +++ b/core/src/test/resources/bc_schema_pattern_changed.yaml @@ -0,0 +1,116 @@ +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 + pattern: '[A-Za-z0-9#$]$' + 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 From f87793d83833f6c1a38f80c9c8d31f20ee93b45c Mon Sep 17 00:00:00 2001 From: Aliaksandr Pinchuk Date: Tue, 14 Oct 2025 22:48:54 +0200 Subject: [PATCH 13/13] Prepare 2.1.4 release --- cli/pom.xml | 2 +- core/pom.xml | 2 +- maven-example/pom.xml | 4 ++-- maven/pom.xml | 2 +- pom.xml | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cli/pom.xml b/cli/pom.xml index 50550ca1..afbc6b7a 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -4,7 +4,7 @@ org.openapitools.openapidiff openapi-diff-parent - 2.1.4-SNAPSHOT + 2.1.4 openapi-diff-cli diff --git a/core/pom.xml b/core/pom.xml index 92dcc697..4b79a2d6 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -4,7 +4,7 @@ org.openapitools.openapidiff openapi-diff-parent - 2.1.4-SNAPSHOT + 2.1.4 openapi-diff-core diff --git a/maven-example/pom.xml b/maven-example/pom.xml index 074bf240..064c4056 100644 --- a/maven-example/pom.xml +++ b/maven-example/pom.xml @@ -3,7 +3,7 @@ openapi-diff-parent org.openapitools.openapidiff - 2.1.4-SNAPSHOT + 2.1.4 4.0.0 @@ -23,7 +23,7 @@ org.openapitools.openapidiff openapi-diff-maven - 2.1.4-SNAPSHOT + 2.1.4 diff --git a/maven/pom.xml b/maven/pom.xml index 0a6d9666..4c398bc1 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -5,7 +5,7 @@ org.openapitools.openapidiff openapi-diff-parent - 2.1.4-SNAPSHOT + 2.1.4 openapi-diff-maven diff --git a/pom.xml b/pom.xml index 912f607d..5989b9bc 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ org.openapitools.openapidiff openapi-diff-parent - 2.1.4-SNAPSHOT + 2.1.4 pom openapi-diff-parent @@ -82,7 +82,7 @@ 1.8 UTF-8 UTF-8 - 2025-09-03T16:27:22Z + 2025-10-14T20:47:24Z github openapitools @@ -99,7 +99,7 @@ org.openapitools.openapidiff openapi-diff-core - 2.1.4-SNAPSHOT + 2.1.4 org.junit