forked from loafle/openapi-generator-original
[python] Fix NPE in example generation (#5082)
This commit is contained in:
parent
ac528aaf07
commit
bcff006dc8
@ -829,9 +829,11 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
// List<String> reqs = schema.getRequired();
|
// List<String> reqs = schema.getRequired();
|
||||||
|
|
||||||
// if required and optionals
|
// if required and optionals
|
||||||
List<String> reqs = new ArrayList<String>();
|
List<String> reqs = new ArrayList<>();
|
||||||
for (Object toAdd : schema.getProperties().keySet())
|
if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
|
||||||
|
for (Object toAdd : schema.getProperties().keySet()) {
|
||||||
reqs.add((String) toAdd);
|
reqs.add((String) toAdd);
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, Schema> properties = schema.getProperties();
|
Map<String, Schema> properties = schema.getProperties();
|
||||||
Set<String> propkeys = null;
|
Set<String> propkeys = null;
|
||||||
@ -861,6 +863,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
toExampleValueRecursive(schema2, included_schemas, indentation + 1) + ", ";
|
toExampleValueRecursive(schema2, included_schemas, indentation + 1) + ", ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
example +=")";
|
example +=")";
|
||||||
} else {
|
} else {
|
||||||
LOGGER.warn("Type " + schema.getType() + " not handled properly in toExampleValue");
|
LOGGER.warn("Type " + schema.getType() + " not handled properly in toExampleValue");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user