forked from loafle/openapi-generator-original
minor refactoring on default codegen (#15777)
This commit is contained in:
parent
87be942247
commit
fbe768bb9c
@ -7227,10 +7227,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
innerCp = innerCp.items;
|
innerCp = innerCp.items;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mostInnerItem == null) {
|
|
||||||
throw new RuntimeException("mostInnerItem (codegen property of array item) cannot be null. " + arraySchema);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isEmpty(bodyParameterName)) {
|
if (StringUtils.isEmpty(bodyParameterName)) {
|
||||||
if (StringUtils.isEmpty(mostInnerItem.complexType)) {
|
if (StringUtils.isEmpty(mostInnerItem.complexType)) {
|
||||||
codegenParameter.baseName = "request_body";
|
codegenParameter.baseName = "request_body";
|
||||||
@ -8147,7 +8143,9 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
* @return Schema the input data converted to a Schema if possible
|
* @return Schema the input data converted to a Schema if possible
|
||||||
*/
|
*/
|
||||||
protected Schema getSchemaFromBooleanOrSchema(Object schema) {
|
protected Schema getSchemaFromBooleanOrSchema(Object schema) {
|
||||||
if (schema instanceof Boolean) {
|
if (schema == null) {
|
||||||
|
return null;
|
||||||
|
} else if (schema instanceof Boolean) {
|
||||||
if (Boolean.TRUE.equals(schema)) {
|
if (Boolean.TRUE.equals(schema)) {
|
||||||
return trueSchema;
|
return trueSchema;
|
||||||
} else if (Boolean.FALSE.equals(schema)) {
|
} else if (Boolean.FALSE.equals(schema)) {
|
||||||
@ -8156,13 +8154,9 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
// null case
|
// null case
|
||||||
return null;
|
return null;
|
||||||
} else if (schema instanceof Schema) {
|
} else if (schema instanceof Schema) {
|
||||||
if (schema == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (Schema) schema;
|
return (Schema) schema;
|
||||||
} else if (schema == null) {
|
} else {
|
||||||
return null;
|
|
||||||
}
|
|
||||||
throw new IllegalArgumentException("Invalid schema type; type must be Boolean or Schema");
|
throw new IllegalArgumentException("Invalid schema type; type must be Boolean or Schema");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user