diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 2950826dcdc7..e54171a5bec3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -97,8 +97,6 @@ public class DefaultCodegen implements CodegenConfig { private static final Cache sanitizedNameCache; private static final String xSchemaTestExamplesKey = "x-schema-test-examples"; private static final String xSchemaTestExamplesRefPrefix = "#/components/x-schema-test-examples/"; - protected static Schema falseSchema; - protected static Schema trueSchema = new Schema(); static { DefaultFeatureSet = FeatureSet.newBuilder() @@ -151,8 +149,6 @@ public class DefaultCodegen implements CodegenConfig { .expireAfterAccess(cacheExpiry, TimeUnit.SECONDS) .ticker(Ticker.systemTicker()) .build(); - falseSchema = new Schema(); - falseSchema.setNot(new Schema()); } protected GeneratorMetadata generatorMetadata; @@ -304,8 +300,6 @@ apiTemplateFiles are for API outputs only (controllers/handlers). // A cache to efficiently lookup schema `toModelName()` based on the schema Key private final Map schemaKeyToModelNameCache = new HashMap<>(); - protected boolean loadDeepObjectIntoItems = true; - // if true then baseTypes will be imported protected boolean importBaseType = true; @@ -3122,11 +3116,6 @@ public CodegenModel fromModel(String name, Schema schema) { Map allDefinitions = ModelUtils.getSchemas(this.openAPI); CodegenModel m = CodegenModelFactory.newInstance(CodegenModelType.MODEL); - if (schema.equals(trueSchema)) { - m.setIsBooleanSchemaTrue(true); - } else if (schema.equals(falseSchema)) { - m.setIsBooleanSchemaFalse(true); - } // unalias schema schema = unaliasSchema(schema); if (schema == null) { @@ -4012,11 +4001,6 @@ public CodegenProperty fromProperty(String name, Schema p, boolean required, boo } CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY); - if (p.equals(trueSchema)) { - property.setIsBooleanSchemaTrue(true); - } else if (p.equals(falseSchema)) { - property.setIsBooleanSchemaFalse(true); - } // unalias schema p = unaliasSchema(p); @@ -5490,7 +5474,7 @@ public CodegenParameter fromParameter(Parameter parameter, Set imports) codegenParameter.pattern = toRegularExpression(parameterSchema.getPattern()); - if (codegenParameter.isQueryParam && codegenParameter.isDeepObject && loadDeepObjectIntoItems) { + if (codegenParameter.isQueryParam && codegenParameter.isDeepObject) { Schema schema = parameterSchema; if (schema.get$ref() != null) { schema = ModelUtils.getReferencedSchema(openAPI, schema); @@ -8498,34 +8482,6 @@ public boolean isTypeErasedGenerics() { */ protected String handleSpecialCharacters(String name) { return name; } - /** - * Used to ensure that null or Schema is returned given an input Boolean/Schema/null - * This will be used in openapi 3.1.0 spec processing to ensure that Booleans become Schemas - * Because our generators only understand Schemas - * Note: use getIsBooleanSchemaTrue or getIsBooleanSchemaFalse on the IJsonSchemaValidationProperties - * if you need to be able to detect if the original schema's value was true or false - * - * @param schema the input Boolean or Schema data to convert to a Schema - * @return Schema the input data converted to a Schema if possible - */ - protected Schema getSchemaFromBooleanOrSchema(Object schema) { - if (schema == null) { - return null; - } else if (schema instanceof Boolean) { - if (Boolean.TRUE.equals(schema)) { - return trueSchema; - } else if (Boolean.FALSE.equals(schema)) { - return falseSchema; - } - // null case - return null; - } else if (schema instanceof Schema) { - return (Schema) schema; - } else { - throw new IllegalArgumentException("Invalid schema type; type must be Boolean or Schema"); - } - } - public void setAutosetConstants(boolean autosetConstants) { this.autosetConstants = autosetConstants; }