forked from loafle/openapi-generator-original
Add helper function
This commit is contained in:
@@ -4122,6 +4122,18 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isMapSchema(Schema schema) {
|
||||
if (schema instanceof MapSchema) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (schema.getAdditionalProperties() != null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void addOption(String key, String description) {
|
||||
addOption(key, description, null);
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
ArraySchema ap = (ArraySchema) p;
|
||||
Schema inner = ap.getItems();
|
||||
return getTypeDeclaration(inner) + "[]";
|
||||
} else if (p.getAdditionalProperties() != null) {
|
||||
} else if (isMapSchema(p)) {
|
||||
Schema inner = (Schema) p.getAdditionalProperties();
|
||||
return getSchemaType(p) + "[string," + getTypeDeclaration(inner) + "]";
|
||||
} else if (StringUtils.isNotBlank(p.get$ref())) {
|
||||
|
||||
Reference in New Issue
Block a user