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() {
2020 if (oldValue == newValue ) {
2121 return DiffResult .NO_CHANGES ;
2222 }
23- if (oldValue == null && newValue == null ) {
24- return DiffResult .NO_CHANGES ;
25- }
2623 if (oldValue == null || newValue == null ) {
2724 return DiffResult .COMPATIBLE ;
2825 }
Original file line number Diff line number Diff line change @@ -20,9 +20,6 @@ public DiffResult isChanged() {
2020 if (oldValue == newValue ) {
2121 return DiffResult .NO_CHANGES ;
2222 }
23- if (oldValue == null && newValue == null ) {
24- return DiffResult .NO_CHANGES ;
25- }
2623 if (oldValue == null || newValue == null ) {
2724 return DiffResult .COMPATIBLE ;
2825 }
Original file line number Diff line number Diff line change @@ -180,6 +180,26 @@ public void changeMinMaxItemsHandling() {
180180 assertThat (props .get ("field4" ).getMaxItems ().isIncompatible ()).isTrue ();
181181 assertThat (props .get ("field4" ).getMaxItems ().getOldValue ()).isEqualTo (100 );
182182 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 );
183203 }
184204
185205 @ Test // issue #482
Original file line number Diff line number Diff line change @@ -46,3 +46,13 @@ components:
4646 type : string
4747 minItems : 1
4848 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:
4646 type : string
4747 minItems : 1
4848 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