@@ -269,7 +269,6 @@ public Schema createMapSchema(Schema objectSchema) {
269269 /**
270270 * Creates a new model schema for a property.
271271 */
272-
273272 public Schema addSchemas (Schema schema , String schemaName , Set <Schema > visitedSchema ) {
274273 LOGGER .info ("Generating new model: {}" , schemaName );
275274
@@ -346,7 +345,10 @@ public Schema generateNestedSchema(Schema schema, Set<Schema> visitedSchemas) {
346345 return schema ;
347346 }
348347
349- public void processNestedSchemas (Schema schema , Set <Schema > visitedSchemas , String modelName ) {
348+ /**
349+ * Processes nested schemas for maps and arrays.
350+ */
351+ public void processNestedSchemas (Schema schema , Set <Schema > visitedSchemas ) {
350352 if (ModelUtils .isMapSchema (schema ) && ModelUtils .getAdditionalProperties (schema ) != null ) {
351353 Schema mapValueSchema = ModelUtils .getAdditionalProperties (schema );
352354 mapValueSchema = ModelUtils .getReferencedSchema (openAPI , mapValueSchema );
@@ -383,31 +385,34 @@ public void processNestedSchemas(Schema schema, Set<Schema> visitedSchemas, Stri
383385 }
384386 }
385387
388+ /**
389+ * Wraps models to handle nested schemas for maps and arrays.
390+ */
386391 private void wrapModels () {
387392 Map <String , Schema > models = openAPI .getComponents ().getSchemas ();
388393 Set <Schema > visitedSchema = new HashSet <>();
389394 List <String > modelNames = new ArrayList <String >(models .keySet ());
390395 for (String modelName : modelNames ) {
391396 Schema schema = models .get (modelName );
392- processNestedSchemas (schema , visitedSchema , modelName );
397+ processNestedSchemas (schema , visitedSchema );
393398 if (ModelUtils .isModel (schema ) && schema .getProperties () != null ) {
394399 Map <String , Schema > properties = schema .getProperties ();
395400 for (Map .Entry <String , Schema > propertyEntry : properties .entrySet ()) {
396401 Schema propertySchema = propertyEntry .getValue ();
397- processNestedSchemas (propertySchema , visitedSchema , modelName );
402+ processNestedSchemas (propertySchema , visitedSchema );
398403 }
399404 } else if (ModelUtils .isAllOf (schema )) {
400- wrapComposedChildren (schema .getAllOf (), visitedSchema , modelName );
405+ wrapComposedChildren (schema .getAllOf (), visitedSchema );
401406 } else if (ModelUtils .isOneOf (schema )) {
402- wrapComposedChildren (schema .getOneOf (), visitedSchema , modelName );
407+ wrapComposedChildren (schema .getOneOf (), visitedSchema );
403408 } else if (ModelUtils .isAnyOf (schema )) {
404- wrapComposedChildren (schema .getAnyOf (), visitedSchema , modelName );
409+ wrapComposedChildren (schema .getAnyOf (), visitedSchema );
405410 }
406411
407412 }
408413 }
409414
410- private void wrapComposedChildren (List <Schema > children , Set <Schema > visitedSchema , String modelName ) {
415+ private void wrapComposedChildren (List <Schema > children , Set <Schema > visitedSchema ) {
411416 if (children == null || children .isEmpty ()) {
412417 return ;
413418 }
@@ -417,7 +422,7 @@ private void wrapComposedChildren(List<Schema> children, Set<Schema> visitedSche
417422 if (properties == null || properties .isEmpty ()) continue ;
418423 for (Map .Entry <String , Schema > propertyEntry : properties .entrySet ()) {
419424 Schema propertySchema = propertyEntry .getValue ();
420- processNestedSchemas (propertySchema , visitedSchema , modelName );
425+ processNestedSchemas (propertySchema , visitedSchema );
421426 }
422427 }
423428 }
0 commit comments