File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed
modules/openapi-generator/src
main/java/org/openapitools/codegen/utils
java/org/openapitools/codegen/utils Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -559,7 +559,9 @@ public static boolean isMapSchema(Schema schema) {
559559 }
560560
561561 // additionalProperties explicitly set to false
562- if (schema .getAdditionalProperties () instanceof Boolean && Boolean .FALSE .equals (schema .getAdditionalProperties ())) {
562+ if ((schema .getAdditionalProperties () instanceof Boolean && Boolean .FALSE .equals (schema .getAdditionalProperties ())) ||
563+ (schema .getAdditionalProperties () instanceof Schema && Boolean .FALSE .equals (((Schema ) schema .getAdditionalProperties ()).getBooleanSchemaValue ()))
564+ ) {
563565 return false ;
564566 }
565567
Original file line number Diff line number Diff line change @@ -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 ));
Original file line number Diff line number Diff line change @@ -65,6 +65,14 @@ components:
6565 oneOf :
6666 - type : string
6767 - type : integer
68+ ObjectSchema :
69+ type : object
70+ additionalProperties : false
71+ properties :
72+ name :
73+ type : string
74+ address :
75+ type : string
6876 anyof1 :
6977 anyOf :
7078 - type : string
You can’t perform that action at this time.
0 commit comments