@@ -353,6 +353,9 @@ public void test30Schemas() {
353
353
Assert .assertNull (anyof1Property .getType ());
354
354
Assert .assertTrue (ModelUtils .hasAnyOf (anyof1Property ));
355
355
Assert .assertTrue (ModelUtils .isAnyOf (anyof1Property ));
356
+
357
+ Schema objectSchema = ModelUtils .getSchema (openAPI , "ObjectSchema" );
358
+ Assert .assertFalse (ModelUtils .isMapSchema (objectSchema ));
356
359
}
357
360
358
361
// 3.1 spec tests
@@ -392,7 +395,7 @@ public void test31Schemas() {
392
395
Assert .assertTrue (ModelUtils .isAnyOf (anyof2 ));
393
396
394
397
Schema objectSchema = ModelUtils .getSchema (openAPI , "ObjectSchema" );
395
- Assert .assertTrue (ModelUtils .isMapSchema (objectSchema ));
398
+ Assert .assertFalse (ModelUtils .isMapSchema (objectSchema ));
396
399
397
400
Schema complexComposedSchema = ModelUtils .getSchema (openAPI , "ComplexComposedSchema" );
398
401
Assert .assertTrue (ModelUtils .isComplexComposedSchema (complexComposedSchema ));
@@ -641,4 +644,35 @@ public void isUnsupportedSchemaTest() {
641
644
assertFalse (ModelUtils .isUnsupportedSchema (openAPI , (Schema ) property2 .getProperties ().get ("condition" )));
642
645
assertFalse (ModelUtils .isUnsupportedSchema (openAPI , (Schema ) property2 .getProperties ().get ("purpose" )));
643
646
}
647
+
648
+ @ Test
649
+ public void testModelWithPropertiesOnly () {
650
+ // Schema with no properties
651
+ Schema testSchema = new ObjectSchema ().properties (null );
652
+ assertFalse (ModelUtils .isModelWithPropertiesOnly (testSchema ));
653
+
654
+ // Schema with properties
655
+ testSchema .setProperties (Map .of ("foo" , new Schema ()));
656
+ assertTrue (ModelUtils .isModelWithPropertiesOnly (testSchema ));
657
+
658
+ // Explicitly no additional properties
659
+ testSchema .setAdditionalProperties (false );
660
+ assertTrue (ModelUtils .isModelWithPropertiesOnly (testSchema ));
661
+
662
+ // With additional properties
663
+ testSchema .setAdditionalProperties (true );
664
+ assertFalse (ModelUtils .isModelWithPropertiesOnly (testSchema ));
665
+
666
+ // Additional properties is a schema set to false
667
+ testSchema .setAdditionalProperties (new Schema ().booleanSchemaValue (false ));
668
+ assertTrue (ModelUtils .isModelWithPropertiesOnly (testSchema ));
669
+
670
+ // Additional properties is a schema set to true
671
+ testSchema .setAdditionalProperties (new Schema ().booleanSchemaValue (true ));
672
+ assertFalse (ModelUtils .isModelWithPropertiesOnly (testSchema ));
673
+
674
+ // Additional properties is a custom schema
675
+ testSchema .setAdditionalProperties (new Schema ().type ("string" ));
676
+ assertFalse (ModelUtils .isModelWithPropertiesOnly (testSchema ));
677
+ }
644
678
}
0 commit comments