forked from loafle/openapi-generator-original
remove isAnyTypeSchema in default codegen (#17663)
This commit is contained in:
parent
e326d6aafc
commit
eb10b410e1
@ -8202,51 +8202,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method has been kept to keep the introduction of ModelUtils.isAnyType as a non-breaking change
|
||||
* this way, existing forks of our generator can continue to use this method
|
||||
* TODO in 6.0.0 replace this method with ModelUtils.isAnyType
|
||||
* Return true if the schema value can be any type, i.e. it can be
|
||||
* the null value, integer, number, string, object or array.
|
||||
* One use case is when the "type" attribute in the OAS schema is unspecified.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* arbitraryTypeValue:
|
||||
* description: This is an arbitrary type schema.
|
||||
* It is not a free-form object.
|
||||
* The value can be any type except the 'null' value.
|
||||
* arbitraryTypeNullableValue:
|
||||
* description: This is an arbitrary type schema.
|
||||
* It is not a free-form object.
|
||||
* The value can be any type, including the 'null' value.
|
||||
* nullable: true
|
||||
*
|
||||
* @param schema the OAS schema.
|
||||
* @return true if the schema value can be an arbitrary type.
|
||||
*/
|
||||
public boolean isAnyTypeSchema(Schema schema) {
|
||||
if (schema == null) {
|
||||
once(LOGGER).error("Schema cannot be null in isAnyTypeSchema check");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ModelUtils.isFreeFormObject(schema)) {
|
||||
// make sure it's not free form object
|
||||
return false;
|
||||
}
|
||||
|
||||
if (schema.getClass().equals(Schema.class) && schema.get$ref() == null && schema.getType() == null &&
|
||||
(schema.getProperties() == null || schema.getProperties().isEmpty()) &&
|
||||
schema.getAdditionalProperties() == null && schema.getNot() == null &&
|
||||
schema.getEnum() == null) {
|
||||
return true;
|
||||
// If and when type arrays are supported in a future OAS specification,
|
||||
// we could return true if the type array includes all possible JSON schema types.
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
|
Loading…
x
Reference in New Issue
Block a user