forked from loafle/openapi-generator-original
fix file, binary array
This commit is contained in:
parent
7d07458b45
commit
1d09962996
@ -1601,24 +1601,31 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (p instanceof StringSchema || SchemaTypeUtil.STRING_TYPE.equals(p.getType())) {
|
if (p instanceof StringSchema || SchemaTypeUtil.STRING_TYPE.equals(p.getType())) {
|
||||||
property.maxLength = p.getMaxLength();
|
if (p instanceof BinarySchema || SchemaTypeUtil.BINARY_FORMAT.equals(p.getFormat())) {
|
||||||
property.minLength = p.getMinLength();
|
property.isBinary = true;
|
||||||
property.pattern = toRegularExpression(p.getPattern());
|
} else if (p instanceof FileSchema) {
|
||||||
|
LOGGER.info("debugging FileSchema: " + property.baseName);
|
||||||
|
property.isFile = true;
|
||||||
|
} else {
|
||||||
|
property.maxLength = p.getMaxLength();
|
||||||
|
property.minLength = p.getMinLength();
|
||||||
|
property.pattern = toRegularExpression(p.getPattern());
|
||||||
|
|
||||||
// check if any validation rule defined
|
// check if any validation rule defined
|
||||||
if (property.pattern != null || property.minLength != null || property.maxLength != null)
|
if (property.pattern != null || property.minLength != null || property.maxLength != null)
|
||||||
property.hasValidation = true;
|
property.hasValidation = true;
|
||||||
|
|
||||||
property.isString = true;
|
property.isString = true;
|
||||||
if (p.getEnum() != null) {
|
if (p.getEnum() != null) {
|
||||||
List<String> _enum = p.getEnum();
|
List<String> _enum = p.getEnum();
|
||||||
property._enum = _enum;
|
property._enum = _enum;
|
||||||
property.isEnum = true;
|
property.isEnum = true;
|
||||||
|
|
||||||
// legacy support
|
// legacy support
|
||||||
Map<String, Object> allowableValues = new HashMap<String, Object>();
|
Map<String, Object> allowableValues = new HashMap<String, Object>();
|
||||||
allowableValues.put("values", _enum);
|
allowableValues.put("values", _enum);
|
||||||
property.allowableValues = allowableValues;
|
property.allowableValues = allowableValues;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1626,12 +1633,8 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
property.isBoolean = true;
|
property.isBoolean = true;
|
||||||
property.getter = toBooleanGetter(name);
|
property.getter = toBooleanGetter(name);
|
||||||
}
|
}
|
||||||
if (p instanceof BinarySchema || SchemaTypeUtil.BINARY_FORMAT.equals(p.getFormat())) {
|
|
||||||
property.isBinary = true;
|
|
||||||
}
|
|
||||||
if (p instanceof FileSchema) { //TODO revise file and binary
|
|
||||||
property.isFile = true;
|
|
||||||
}
|
|
||||||
if (p instanceof UUIDSchema || SchemaTypeUtil.UUID_FORMAT.equals(p.getFormat())) {
|
if (p instanceof UUIDSchema || SchemaTypeUtil.UUID_FORMAT.equals(p.getFormat())) {
|
||||||
// keep isString to true to make it backward compatible
|
// keep isString to true to make it backward compatible
|
||||||
property.isString =true;
|
property.isString =true;
|
||||||
@ -2587,21 +2590,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
} else {
|
} else {
|
||||||
LOGGER.warn("Unknown parameter type: " + parameter.getName());
|
LOGGER.warn("Unknown parameter type: " + parameter.getName());
|
||||||
}
|
}
|
||||||
/* TODO: need to fix body parameter and form parameter
|
|
||||||
else if (parameter instanceof BodyParameter) {
|
|
||||||
codegenParameter.isBodyParam = true;
|
|
||||||
codegenParameter.isBinary = isDataTypeBinary(codegenParameter.dataType);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (parameter instanceof FormParameter) {
|
|
||||||
if ("file".equalsIgnoreCase(((FormParameter) parameter).getType()) || "file".equals(codegenParameter.baseType)) {
|
|
||||||
codegenParameter.isFile = true;
|
|
||||||
} else {
|
|
||||||
codegenParameter.notFile = true;
|
|
||||||
}
|
|
||||||
codegenParameter.isFormParam = true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// set the example value
|
// set the example value
|
||||||
// if not specified in x-example, generate a default value
|
// if not specified in x-example, generate a default value
|
||||||
@ -3930,6 +3918,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
codegenParameter.unescapedDescription = codegenProperty.getDescription();
|
codegenParameter.unescapedDescription = codegenProperty.getDescription();
|
||||||
codegenParameter.jsonSchema = Json.pretty(propertySchema);
|
codegenParameter.jsonSchema = Json.pretty(propertySchema);
|
||||||
|
|
||||||
|
|
||||||
if (codegenProperty.getVendorExtensions() != null && !codegenProperty.getVendorExtensions().isEmpty()) {
|
if (codegenProperty.getVendorExtensions() != null && !codegenProperty.getVendorExtensions().isEmpty()) {
|
||||||
codegenParameter.vendorExtensions = codegenProperty.getVendorExtensions();
|
codegenParameter.vendorExtensions = codegenProperty.getVendorExtensions();
|
||||||
}
|
}
|
||||||
|
@ -606,7 +606,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
} else if ("\\SplFileObject".equalsIgnoreCase(type) || p.isFile) {
|
} else if ("\\SplFileObject".equalsIgnoreCase(type) || p.isFile) {
|
||||||
if (example == null) {
|
if (example == null) {
|
||||||
example = "/path/to/file";
|
example = "/path/to/file.txt";
|
||||||
}
|
}
|
||||||
example = "\"" + escapeText(example) + "\"";
|
example = "\"" + escapeText(example) + "\"";
|
||||||
} else if ("\\Date".equalsIgnoreCase(type)) {
|
} else if ("\\Date".equalsIgnoreCase(type)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user