File tree Expand file tree Collapse file tree
modules/openapi-generator/src
main/java/org/openapitools/codegen/utils
java/org/openapitools/codegen/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -460,7 +460,7 @@ public static boolean isObjectSchema(Schema schema) {
460460
461461 return (schema instanceof ObjectSchema ) ||
462462 // must not be a map
463- (SchemaTypeUtil .OBJECT_TYPE .equals (schema .getType ()) && !(schema instanceof MapSchema )) ||
463+ (SchemaTypeUtil .OBJECT_TYPE .equals (schema .getType ()) && !(ModelUtils . isMapSchema ( schema ) )) ||
464464 // must have at least one property
465465 (schema .getType () == null && schema .getProperties () != null && !schema .getProperties ().isEmpty ());
466466 }
@@ -509,10 +509,6 @@ public static boolean isComposedSchema(Schema schema) {
509509 * @return true if the specified schema is a Composed schema.
510510 */
511511 public static boolean isComplexComposedSchema (Schema schema ) {
512- if (!(schema instanceof ComposedSchema )) {
513- return false ;
514- }
515-
516512 int count = 0 ;
517513
518514 if (schema .getAllOf () != null && !schema .getAllOf ().isEmpty ()) {
Original file line number Diff line number Diff line change @@ -384,5 +384,11 @@ public void test31Schemas() {
384384 Assert .assertFalse (anyof2 .getAnyOf ().isEmpty ());
385385 Assert .assertTrue (ModelUtils .hasAnyOf (anyof2 ));
386386 Assert .assertTrue (ModelUtils .isAnyOf (anyof2 ));
387+
388+ Schema objectSchema = ModelUtils .getSchema (openAPI , "ObjectSchema" );
389+ Assert .assertTrue (ModelUtils .isMapSchema (objectSchema ));
390+
391+ Schema complexComposedSchema = ModelUtils .getSchema (openAPI , "ComplexComposedSchema" );
392+ Assert .assertTrue (ModelUtils .isComplexComposedSchema (complexComposedSchema ));
387393 }
388394}
Original file line number Diff line number Diff line change @@ -64,4 +64,19 @@ components:
6464 oneof1 :
6565 oneOf :
6666 - type : string
67- - type : integer
67+ - type : integer
68+ ObjectSchema :
69+ type : object
70+ additionalProperties : false
71+ properties :
72+ name :
73+ type : string
74+ address :
75+ type : string
76+ ComplexComposedSchema :
77+ oneOf :
78+ - type : string
79+ - type : integer
80+ anyOf :
81+ - type : string
82+ - type : number
You can’t perform that action at this time.
0 commit comments