File tree Expand file tree Collapse file tree 5 files changed +40
-6
lines changed
main/java/org/openapitools/openapidiff/core/model/schema
java/org/openapitools/openapidiff/core Expand file tree Collapse file tree 5 files changed +40
-6
lines changed Original file line number Diff line number Diff line change @@ -20,9 +20,6 @@ public DiffResult isChanged() {
20
20
if (oldValue == newValue ) {
21
21
return DiffResult .NO_CHANGES ;
22
22
}
23
- if (oldValue == null && newValue == null ) {
24
- return DiffResult .NO_CHANGES ;
25
- }
26
23
if (oldValue == null || newValue == null ) {
27
24
return DiffResult .COMPATIBLE ;
28
25
}
Original file line number Diff line number Diff line change @@ -20,9 +20,6 @@ public DiffResult isChanged() {
20
20
if (oldValue == newValue ) {
21
21
return DiffResult .NO_CHANGES ;
22
22
}
23
- if (oldValue == null && newValue == null ) {
24
- return DiffResult .NO_CHANGES ;
25
- }
26
23
if (oldValue == null || newValue == null ) {
27
24
return DiffResult .COMPATIBLE ;
28
25
}
Original file line number Diff line number Diff line change @@ -180,6 +180,26 @@ public void changeMinMaxItemsHandling() {
180
180
assertThat (props .get ("field4" ).getMaxItems ().isIncompatible ()).isTrue ();
181
181
assertThat (props .get ("field4" ).getMaxItems ().getOldValue ()).isEqualTo (100 );
182
182
assertThat (props .get ("field4" ).getMaxItems ().getNewValue ()).isEqualTo (90 );
183
+
184
+ // Check removal of minItems
185
+ assertThat (props .get ("field5" ).getMinItems ().isCompatible ()).isTrue ();
186
+ assertThat (props .get ("field5" ).getMinItems ().getOldValue ()).isEqualTo (1 );
187
+ assertThat (props .get ("field5" ).getMinItems ().getNewValue ()).isNull ();
188
+
189
+ // Check removal of maxItems
190
+ assertThat (props .get ("field5" ).getMaxItems ().isCompatible ()).isTrue ();
191
+ assertThat (props .get ("field5" ).getMaxItems ().getOldValue ()).isEqualTo (100 );
192
+ assertThat (props .get ("field5" ).getMaxItems ().getNewValue ()).isNull ();
193
+
194
+ // Check addition of minItems
195
+ assertThat (props .get ("field6" ).getMinItems ().isCompatible ()).isTrue ();
196
+ assertThat (props .get ("field6" ).getMinItems ().getOldValue ()).isNull ();
197
+ assertThat (props .get ("field6" ).getMinItems ().getNewValue ()).isEqualTo (1 );
198
+
199
+ // Check addition of maxItems
200
+ assertThat (props .get ("field6" ).getMaxItems ().isCompatible ()).isTrue ();
201
+ assertThat (props .get ("field6" ).getMaxItems ().getOldValue ()).isNull ();
202
+ assertThat (props .get ("field6" ).getMaxItems ().getNewValue ()).isEqualTo (100 );
183
203
}
184
204
185
205
@ Test // issue #482
Original file line number Diff line number Diff line change @@ -46,3 +46,13 @@ components:
46
46
type : string
47
47
minItems : 1
48
48
maxItems : 100
49
+ field5 :
50
+ type : array
51
+ items :
52
+ type : string
53
+ minItems : 1
54
+ maxItems : 100
55
+ field6 :
56
+ type : array
57
+ items :
58
+ type : string
Original file line number Diff line number Diff line change @@ -46,3 +46,13 @@ components:
46
46
type : string
47
47
minItems : 1
48
48
maxItems : 90
49
+ field5 :
50
+ type : array
51
+ items :
52
+ type : string
53
+ field6 :
54
+ type : array
55
+ items :
56
+ type : string
57
+ minItems : 1
58
+ maxItems : 100
You can’t perform that action at this time.
0 commit comments