mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-06-29 12:10:54 +00:00
Fix list examples in python (#7967)
* Fix list examples in python When a model has an example in an array, it wrongly wraps it again in a list instead of returning the list examples. This fixes it. * Add comment
This commit is contained in:
parent
cf185d559b
commit
157ad1ce73
@ -1048,6 +1048,10 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
|
|||||||
}
|
}
|
||||||
return fullPrefix + example + closeChars;
|
return fullPrefix + example + closeChars;
|
||||||
} else if (ModelUtils.isArraySchema(schema)) {
|
} else if (ModelUtils.isArraySchema(schema)) {
|
||||||
|
if (objExample instanceof Iterable) {
|
||||||
|
// If the example is already a list, return it directly instead of wrongly wrap it in another list
|
||||||
|
return objExample.toString();
|
||||||
|
}
|
||||||
ArraySchema arrayschema = (ArraySchema) schema;
|
ArraySchema arrayschema = (ArraySchema) schema;
|
||||||
Schema itemSchema = arrayschema.getItems();
|
Schema itemSchema = arrayschema.getItems();
|
||||||
String itemModelName = getModelName(itemSchema);
|
String itemModelName = getModelName(itemSchema);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user