diff --git a/README.md b/README.md
index e4979c1e..019cca0b 100644
--- a/README.md
+++ b/README.md
@@ -5,8 +5,7 @@ Compare two OpenAPI specifications (3.x) and render the difference to HTML plain
[](https://github.com/OpenAPITools/openapi-diff/actions?query=branch%3Amaster+workflow%3A"Main+Build")
[](https://sonarcloud.io/dashboard?id=OpenAPITools_openapi-diff)
-[](https://search.maven.org/artifact/org.openapitools.openapidiff/openapi-diff-core)
-[](https://search.maven.org/artifact/org.openapitools.openapidiff/openapi-diff-core)
+[](https://search.maven.org/artifact/org.openapitools.openapidiff/openapi-diff-core)
[](https://gitpod.io/#https://github.com/OpenAPITools/openapi-diff)
[](https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g)
diff --git a/cli/pom.xml b/cli/pom.xml
index f748f455..2e68fd97 100644
--- a/cli/pom.xml
+++ b/cli/pom.xml
@@ -4,7 +4,7 @@
org.openapitools.openapidiff
openapi-diff-parent
- 2.1.0
+ 2.1.1
openapi-diff-cli
diff --git a/core/pom.xml b/core/pom.xml
index 85248094..30b160eb 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -4,7 +4,7 @@
org.openapitools.openapidiff
openapi-diff-parent
- 2.1.0
+ 2.1.1
openapi-diff-core
diff --git a/core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedMaxItems.java b/core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedMaxItems.java
index 1af1134b..1ef3a498 100644
--- a/core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedMaxItems.java
+++ b/core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedMaxItems.java
@@ -17,7 +17,7 @@ public ChangedMaxItems(Integer oldValue, Integer newValue, DiffContext context)
@Override
public DiffResult isChanged() {
- if (oldValue == null && newValue == null) {
+ if (oldValue == newValue) {
return DiffResult.NO_CHANGES;
}
if (oldValue == null || newValue == null) {
diff --git a/core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedMinItems.java b/core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedMinItems.java
index 7791893c..3a3d4071 100644
--- a/core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedMinItems.java
+++ b/core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedMinItems.java
@@ -17,7 +17,7 @@ public ChangedMinItems(Integer oldValue, Integer newValue, DiffContext context)
@Override
public DiffResult isChanged() {
- if (oldValue == null && newValue == null) {
+ if (oldValue == newValue) {
return DiffResult.NO_CHANGES;
}
if (oldValue == null || newValue == null) {
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 8cd477ff..1f41406a 100644
--- a/core/src/test/java/org/openapitools/openapidiff/core/SchemaDiffTest.java
+++ b/core/src/test/java/org/openapitools/openapidiff/core/SchemaDiffTest.java
@@ -144,7 +144,7 @@ public void changeMultipleOfHandling() {
assertThat(props.get("field4").getMultipleOf().getRight()).isNull();
}
- @Test // issues #480
+ @Test // issues #480 and #779
public void changeMinMaxItemsHandling() {
ChangedOpenApi changedOpenApi =
OpenApiCompare.fromLocations(
@@ -158,6 +158,9 @@ public void changeMinMaxItemsHandling() {
Map props = changedSchema.getChangedProperties();
assertThat(props).isNotEmpty();
+ // Check no changes in minItems and maxItems
+ assertThat(props.get("field0")).isNull();
+
// Check increasing of minItems
assertThat(props.get("field1").getMinItems().isIncompatible()).isTrue();
assertThat(props.get("field1").getMinItems().getOldValue()).isEqualTo(1);
@@ -177,6 +180,26 @@ public void changeMinMaxItemsHandling() {
assertThat(props.get("field4").getMaxItems().isIncompatible()).isTrue();
assertThat(props.get("field4").getMaxItems().getOldValue()).isEqualTo(100);
assertThat(props.get("field4").getMaxItems().getNewValue()).isEqualTo(90);
+
+ // Check removal of minItems
+ assertThat(props.get("field5").getMinItems().isCompatible()).isTrue();
+ assertThat(props.get("field5").getMinItems().getOldValue()).isEqualTo(1);
+ assertThat(props.get("field5").getMinItems().getNewValue()).isNull();
+
+ // Check removal of maxItems
+ assertThat(props.get("field5").getMaxItems().isCompatible()).isTrue();
+ assertThat(props.get("field5").getMaxItems().getOldValue()).isEqualTo(100);
+ assertThat(props.get("field5").getMaxItems().getNewValue()).isNull();
+
+ // Check addition of minItems
+ assertThat(props.get("field6").getMinItems().isCompatible()).isTrue();
+ assertThat(props.get("field6").getMinItems().getOldValue()).isNull();
+ assertThat(props.get("field6").getMinItems().getNewValue()).isEqualTo(1);
+
+ // Check addition of maxItems
+ assertThat(props.get("field6").getMaxItems().isCompatible()).isTrue();
+ assertThat(props.get("field6").getMaxItems().getOldValue()).isNull();
+ assertThat(props.get("field6").getMaxItems().getNewValue()).isEqualTo(100);
}
@Test // issue #482
diff --git a/core/src/test/resources/schemaDiff/schema-min-max-items-diff-1.yaml b/core/src/test/resources/schemaDiff/schema-min-max-items-diff-1.yaml
index 23d84148..a7426987 100644
--- a/core/src/test/resources/schemaDiff/schema-min-max-items-diff-1.yaml
+++ b/core/src/test/resources/schemaDiff/schema-min-max-items-diff-1.yaml
@@ -16,6 +16,12 @@ components:
TestDTO:
type: object
properties:
+ field0:
+ type: array
+ items:
+ type: string
+ minItems: 1
+ maxItems: 10
field1:
type: array
items:
@@ -33,10 +39,20 @@ components:
items:
type: string
minItems: 1
- maxItems: 90
+ maxItems: 90
field4:
type: array
items:
type: string
minItems: 1
maxItems: 100
+ field5:
+ type: array
+ items:
+ type: string
+ minItems: 1
+ maxItems: 100
+ field6:
+ type: array
+ items:
+ type: string
diff --git a/core/src/test/resources/schemaDiff/schema-min-max-items-diff-2.yaml b/core/src/test/resources/schemaDiff/schema-min-max-items-diff-2.yaml
index 0d8e6199..5e58f573 100644
--- a/core/src/test/resources/schemaDiff/schema-min-max-items-diff-2.yaml
+++ b/core/src/test/resources/schemaDiff/schema-min-max-items-diff-2.yaml
@@ -16,6 +16,12 @@ components:
TestDTO:
type: object
properties:
+ field0:
+ type: array
+ items:
+ type: string
+ minItems: 1
+ maxItems: 10
field1:
type: array
items:
@@ -27,16 +33,26 @@ components:
items:
type: string
minItems: 10
- maxItems: 100
+ maxItems: 100
field3:
type: array
items:
type: string
minItems: 1
- maxItems: 100
+ maxItems: 100
field4:
type: array
items:
type: string
minItems: 1
maxItems: 90
+ field5:
+ type: array
+ items:
+ type: string
+ field6:
+ type: array
+ items:
+ type: string
+ minItems: 1
+ maxItems: 100
diff --git a/maven-example/pom.xml b/maven-example/pom.xml
index 0109e216..f76f99b2 100644
--- a/maven-example/pom.xml
+++ b/maven-example/pom.xml
@@ -3,7 +3,7 @@
openapi-diff-parent
org.openapitools.openapidiff
- 2.1.0
+ 2.1.1
4.0.0
@@ -23,7 +23,7 @@
org.openapitools.openapidiff
openapi-diff-maven
- 2.1.0
+ 2.1.1
diff --git a/maven/pom.xml b/maven/pom.xml
index 669dbcc8..271315ea 100644
--- a/maven/pom.xml
+++ b/maven/pom.xml
@@ -5,7 +5,7 @@
org.openapitools.openapidiff
openapi-diff-parent
- 2.1.0
+ 2.1.1
openapi-diff-maven
diff --git a/pom.xml b/pom.xml
index f37146f1..02531247 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
org.openapitools.openapidiff
openapi-diff-parent
- 2.1.0
+ 2.1.1
pom
openapi-diff-parent
@@ -54,7 +54,7 @@
scm:git:https://github.com/OpenAPITools/openapi-diff.git
scm:git:https://github.com/OpenAPITools/openapi-diff.git
https://github.com/OpenAPITools/openapi-diff
- 2.1.0
+ 2.1.1
@@ -75,7 +75,7 @@
1.8
UTF-8
UTF-8
- 2025-04-26T11:30:05Z
+ 2025-05-12T09:07:41Z
github
openapitools
@@ -83,7 +83,7 @@
https://sonarcloud.io
${project.artifactId}
- 2.1.26
+ 2.1.27
2.0.17
@@ -92,7 +92,7 @@
org.openapitools.openapidiff
openapi-diff-core
- 2.1.0
+ 2.1.1
org.junit
@@ -129,7 +129,7 @@
org.apache.commons
commons-configuration2
- 2.11.0
+ 2.12.0
commons-cli