@@ -79,7 +79,7 @@ public void flatten(OpenAPI openAPI) {
79
79
if (op .getProperties () != null && op .getProperties ().size () > 0 ) {
80
80
flattenProperties (op .getProperties (), pathname );
81
81
String modelName = resolveModelName (op .getTitle (), "body" );
82
- Schema innerModel = modelFromProperty (op , modelName );
82
+ Schema innerModel = createModelFromProperty (op , modelName );
83
83
String existing = matchGenerated (innerModel );
84
84
if (existing != null ) {
85
85
am .setItems (new Schema ().$ref (existing ));
@@ -120,7 +120,7 @@ public void flatten(OpenAPI openAPI) {
120
120
if (op .getProperties () != null && op .getProperties ().size () > 0 ) {
121
121
flattenProperties (op .getProperties (), pathname );
122
122
String modelName = resolveModelName (op .getTitle (), parameter .getName ());
123
- Schema innerModel = modelFromProperty (op , modelName );
123
+ Schema innerModel = createModelFromProperty (op , modelName );
124
124
String existing = matchGenerated (innerModel );
125
125
if (existing != null ) {
126
126
am .setItems (new Schema ().$ref (existing ));
@@ -150,7 +150,7 @@ public void flatten(OpenAPI openAPI) {
150
150
ObjectSchema op = (ObjectSchema ) property ;
151
151
if (op .getProperties () != null && op .getProperties ().size () > 0 ) {
152
152
String modelName = resolveModelName (op .getTitle (), "inline_response_" + key );
153
- Schema model = modelFromProperty (op , modelName );
153
+ Schema model = createModelFromProperty (op , modelName );
154
154
String existing = matchGenerated (model );
155
155
if (existing != null ) {
156
156
media .setSchema (this .makeRefProperty (existing , property ));
@@ -170,12 +170,12 @@ public void flatten(OpenAPI openAPI) {
170
170
flattenProperties (op .getProperties (), pathname );
171
171
String modelName = resolveModelName (op .getTitle (),
172
172
"inline_response_" + key );
173
- Schema innerModel = modelFromProperty ( op , modelName );
173
+ Schema innerModel = createModelFromProperty ( inner , modelName );
174
174
String existing = matchGenerated (innerModel );
175
175
if (existing != null ) {
176
- ap .setItems (this .makeRefProperty (existing , op ));
176
+ ap .setItems (this .makeRefProperty (existing , inner ));
177
177
} else {
178
- ap .setItems (this .makeRefProperty (modelName , op ));
178
+ ap .setItems (this .makeRefProperty (modelName , inner ));
179
179
addGenerated (modelName , innerModel );
180
180
openAPI .getComponents ().addSchemas (modelName , innerModel );
181
181
}
@@ -190,7 +190,7 @@ public void flatten(OpenAPI openAPI) {
190
190
flattenProperties (op .getProperties (), pathname );
191
191
String modelName = resolveModelName (op .getTitle (),
192
192
"inline_response_" + key );
193
- Schema innerModel = modelFromProperty (op , modelName );
193
+ Schema innerModel = createModelFromProperty (op , modelName );
194
194
String existing = matchGenerated (innerModel );
195
195
if (existing != null ) {
196
196
property .setAdditionalProperties (new Schema ().$ref (existing ));
@@ -228,7 +228,7 @@ public void flatten(OpenAPI openAPI) {
228
228
ObjectSchema op = (ObjectSchema ) inner ;
229
229
if (op .getProperties () != null && op .getProperties ().size () > 0 ) {
230
230
String innerModelName = resolveModelName (op .getTitle (), modelName + "_inner" );
231
- Schema innerModel = modelFromProperty (op , innerModelName );
231
+ Schema innerModel = createModelFromProperty (op , innerModelName );
232
232
String existing = matchGenerated (innerModel );
233
233
if (existing == null ) {
234
234
openAPI .getComponents ().addSchemas (innerModelName , innerModel );
@@ -334,7 +334,7 @@ public void flattenProperties(Map<String, Schema> properties, String path) {
334
334
ObjectSchema op = (ObjectSchema ) property ;
335
335
336
336
String modelName = resolveModelName (op .getTitle (), path + "_" + key );
337
- Schema model = modelFromProperty (op , modelName );
337
+ Schema model = createModelFromProperty (op , modelName );
338
338
339
339
String existing = matchGenerated (model );
340
340
@@ -355,7 +355,7 @@ public void flattenProperties(Map<String, Schema> properties, String path) {
355
355
if (op .getProperties () != null && op .getProperties ().size () > 0 ) {
356
356
flattenProperties (op .getProperties (), path );
357
357
String modelName = resolveModelName (op .getTitle (), path + "_" + key );
358
- Schema innerModel = modelFromProperty (op , modelName );
358
+ Schema innerModel = createModelFromProperty (op , modelName );
359
359
String existing = matchGenerated (innerModel );
360
360
if (existing != null ) {
361
361
ap .setItems (new Schema ().$ref (existing ));
@@ -374,7 +374,7 @@ public void flattenProperties(Map<String, Schema> properties, String path) {
374
374
if (op .getProperties () != null && op .getProperties ().size () > 0 ) {
375
375
flattenProperties (op .getProperties (), path );
376
376
String modelName = resolveModelName (op .getTitle (), path + "_" + key );
377
- Schema innerModel = modelFromProperty (op , modelName );
377
+ Schema innerModel = createModelFromProperty (op , modelName );
378
378
String existing = matchGenerated (innerModel );
379
379
if (existing != null ) {
380
380
property .setAdditionalProperties (new Schema ().$ref (existing ));
@@ -420,26 +420,26 @@ public Schema modelFromProperty(ArraySchema object, @SuppressWarnings("unused")
420
420
return null ;
421
421
}
422
422
423
- public Schema modelFromProperty ( ObjectSchema object , String path ) {
424
- String description = object .getDescription ();
423
+ public Schema createModelFromProperty ( Schema schema , String path ) {
424
+ String description = schema .getDescription ();
425
425
String example = null ;
426
- List <String > requiredList = object .getRequired ();
426
+ List <String > requiredList = schema .getRequired ();
427
427
428
428
429
- Object obj = object .getExample ();
429
+ Object obj = schema .getExample ();
430
430
if (obj != null ) {
431
431
example = obj .toString ();
432
432
}
433
- String name = object .getName ();
434
- XML xml = object .getXml ();
435
- Map <String , Schema > properties = object .getProperties ();
433
+ String name = schema .getName ();
434
+ XML xml = schema .getXml ();
435
+ Map <String , Schema > properties = schema .getProperties ();
436
436
437
437
Schema model = new Schema ();//TODO Verify this!
438
438
model .setDescription (description );
439
439
model .setExample (example );
440
440
model .setName (name );
441
441
model .setXml (xml );
442
- model .setType (object .getType ());
442
+ model .setType (schema .getType ());
443
443
model .setRequired (requiredList );
444
444
445
445
if (properties != null ) {
@@ -507,4 +507,4 @@ public void setSkipMatches(boolean skipMatches) {
507
507
this .skipMatches = skipMatches ;
508
508
}
509
509
510
- }
510
+ }
0 commit comments