@@ -353,6 +353,9 @@ public void test30Schemas() {
353353 Assert .assertNull (anyof1Property .getType ());
354354 Assert .assertTrue (ModelUtils .hasAnyOf (anyof1Property ));
355355 Assert .assertTrue (ModelUtils .isAnyOf (anyof1Property ));
356+
357+ Schema objectSchema = ModelUtils .getSchema (openAPI , "ObjectSchema" );
358+ Assert .assertFalse (ModelUtils .isMapSchema (objectSchema ));
356359 }
357360
358361 // 3.1 spec tests
@@ -392,7 +395,7 @@ public void test31Schemas() {
392395 Assert .assertTrue (ModelUtils .isAnyOf (anyof2 ));
393396
394397 Schema objectSchema = ModelUtils .getSchema (openAPI , "ObjectSchema" );
395- Assert .assertTrue (ModelUtils .isMapSchema (objectSchema ));
398+ Assert .assertFalse (ModelUtils .isMapSchema (objectSchema ));
396399
397400 Schema complexComposedSchema = ModelUtils .getSchema (openAPI , "ComplexComposedSchema" );
398401 Assert .assertTrue (ModelUtils .isComplexComposedSchema (complexComposedSchema ));
@@ -641,4 +644,35 @@ public void isUnsupportedSchemaTest() {
641644 assertFalse (ModelUtils .isUnsupportedSchema (openAPI , (Schema ) property2 .getProperties ().get ("condition" )));
642645 assertFalse (ModelUtils .isUnsupportedSchema (openAPI , (Schema ) property2 .getProperties ().get ("purpose" )));
643646 }
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+ }
644678}
0 commit comments