@@ -770,9 +770,8 @@ private void flattenProperties(OpenAPI openAPI, Map<String, Schema> properties,
770770 for (Map .Entry <String , Schema > propertiesEntry : properties .entrySet ()) {
771771 String key = propertiesEntry .getKey ();
772772 Schema property = propertiesEntry .getValue ();
773- if (property instanceof ObjectSchema && ((ObjectSchema ) property ).getProperties () != null
774- && ((ObjectSchema ) property ).getProperties ().size () > 0 ) {
775- ObjectSchema op = (ObjectSchema ) property ;
773+ if (ModelUtils .isObjectSchema (property )) {
774+ Schema op = property ;
776775 String modelName = resolveModelName (op .getTitle (), path + "_" + key );
777776 Schema model = modelFromProperty (openAPI , op , modelName );
778777 String existing = matchGenerated (model );
@@ -789,8 +788,8 @@ private void flattenProperties(OpenAPI openAPI, Map<String, Schema> properties,
789788 }
790789 } else if (ModelUtils .isArraySchema (property )) {
791790 Schema inner = ModelUtils .getSchemaItems (property );
792- if (inner instanceof ObjectSchema ) {
793- ObjectSchema op = ( ObjectSchema ) inner ;
791+ if (ModelUtils . isObjectSchema ( inner ) ) {
792+ Schema op = inner ;
794793 if (op .getProperties () != null && op .getProperties ().size () > 0 ) {
795794 flattenProperties (openAPI , op .getProperties (), path );
796795 String modelName = resolveModelName (op .getTitle (), path + "_" + key );
@@ -819,8 +818,8 @@ private void flattenProperties(OpenAPI openAPI, Map<String, Schema> properties,
819818 }
820819 } else if (ModelUtils .isMapSchema (property )) {
821820 Schema inner = ModelUtils .getAdditionalProperties (property );
822- if (inner instanceof ObjectSchema ) {
823- ObjectSchema op = ( ObjectSchema ) inner ;
821+ if (ModelUtils . isObjectSchema ( inner ) ) {
822+ Schema op = inner ;
824823 if (op .getProperties () != null && op .getProperties ().size () > 0 ) {
825824 flattenProperties (openAPI , op .getProperties (), path );
826825 String modelName = resolveModelName (op .getTitle (), path + "_" + key );
0 commit comments