From 2331432cc0f062ceff44c3d09e1a16c31abf6f57 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 21 Jan 2021 09:52:49 -0800 Subject: [PATCH] Adds hasValidation to all java core Schema classes (#8474) * Adds hasValidation to IJsonSchemaValidationProperties * Adds model validation examples for maxItems, minItems, minProperties, maxProperties, minLength, maxLength, multipleOf * Adds schemas with pattern validation * Adds minimum example schemas * Adds maximum example schemas * Adds ArrayWithUniqueItems * Adds exclusiveMinimum schemas * Adds exclusiveMaximum examples * adds testModelGetHasValidation * Adds testPropertyGetHasValidation * Adds testQueryParametersGetHasValidation * Uncomments out query parameters * Adds testHeaderParametersGetHasValidation * Adds testCookieParametersGetHasValidation * Adds length assertions for properties and marameters * Adds testBodyAndResponseGetHasValidation * Improves validation setting * Only sets exclusiveMinimum when minimum is set, only set exclusiveMaximum when maximum is set * Adds fix for rust * Fixes min and max setting for integers * Regenerates python samples * Updates code so python sample does not change --- .../openapitools/codegen/CodegenModel.java | 17 +- .../codegen/CodegenParameter.java | 6 + .../openapitools/codegen/CodegenProperty.java | 6 + .../openapitools/codegen/CodegenResponse.java | 11 +- .../openapitools/codegen/DefaultCodegen.java | 133 +- .../IJsonSchemaValidationProperties.java | 4 + .../codegen/utils/ModelUtils.java | 91 +- .../codegen/DefaultCodegenTest.java | 221 ++ .../src/test/resources/3_0/issue_7651.yaml | 2733 ++++++++++++++++- 9 files changed, 3072 insertions(+), 150 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java index 4bcb5dd4bf9..1663343387f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java @@ -79,7 +79,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties { public Set allMandatory = new TreeSet(); // with parent's required properties public Set imports = new TreeSet(); - public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum; + public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasValidation; /** * Indicates the OAS schema specifies "nullable: true". */ @@ -612,12 +612,11 @@ public class CodegenModel implements IJsonSchemaValidationProperties { this.additionalProperties = additionalProperties; } - // indicates if the model component has validation on the root level schema - // this will be true when minItems or minProperties is set - public boolean hasValidation() { - boolean val = (maxItems != null || minItems != null || minProperties != null || maxProperties != null || minLength != null || maxLength != null || multipleOf != null || pattern != null || minimum != null || maximum != null || Boolean.TRUE.equals(uniqueItems) || Boolean.TRUE.equals(exclusiveMaximum) || Boolean.TRUE.equals(exclusiveMinimum)); - return val; - } + @Override + public boolean getHasValidation() { return hasValidation; } + + @Override + public void setHasValidation(boolean hasValidation) { this.hasValidation = hasValidation; } public List getReadOnlyVars() { return readOnlyVars; @@ -742,6 +741,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties { isDeprecated == that.isDeprecated && hasOnlyReadOnly == that.hasOnlyReadOnly && isNull == that.isNull && + hasValidation == that.hasValidation && getUniqueItems() == that.getUniqueItems() && getExclusiveMinimum() == that.getExclusiveMinimum() && getExclusiveMaximum() == that.getExclusiveMaximum() && @@ -806,7 +806,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties { getDescription(), getClassVarName(), getModelJson(), getDataType(), getXmlPrefix(), getXmlNamespace(), getXmlName(), getClassFilename(), getUnescapedDescription(), getDiscriminator(), getDefaultValue(), getArrayModelType(), isAlias, isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, - isDate, isDateTime, isNull, + isDate, isDateTime, isNull, hasValidation, getVars(), getAllVars(), getRequiredVars(), getOptionalVars(), getReadOnlyVars(), getReadWriteVars(), getParentVars(), getAllowableValues(), getMandatory(), getAllMandatory(), getImports(), hasVars, isEmptyVars(), hasMoreModels, hasEnums, isEnum, isNullable, hasRequired, hasOptional, isArray, @@ -898,6 +898,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties { sb.append(", additionalProperties='").append(additionalProperties).append('\''); sb.append(", isModel='").append(isModel).append('\''); sb.append(", isNull='").append(isNull); + sb.append(", hasValidation='").append(hasValidation); sb.append('}'); return sb.toString(); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java index 7c6f80ae843..811d48d324c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java @@ -582,5 +582,11 @@ public class CodegenParameter implements IJsonSchemaValidationProperties { public void setIsNull(boolean isNull) { this.isNull = isNull; } + + @Override + public boolean getHasValidation() { return hasValidation; } + + @Override + public void setHasValidation(boolean hasValidation) { this.hasValidation = hasValidation; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java index b956a3ea7e1..60d32f47712 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java @@ -687,6 +687,12 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti this.isNull = isNull; } + @Override + public boolean getHasValidation() { return hasValidation; } + + @Override + public void setHasValidation(boolean hasValidation) { this.hasValidation = hasValidation; } + @Override public String toString() { final StringBuilder sb = new StringBuilder("CodegenProperty{"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java index 7762676b7ca..5db6b721715 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java @@ -78,6 +78,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { public CodegenProperty additionalProperties; public List vars = new ArrayList(); // all properties (without parent's properties) public List requiredVars = new ArrayList(); + private boolean hasValidation; @Override public int hashCode() { @@ -85,7 +86,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBoolean, isDate, isDateTime, isUuid, isEmail, isModel, isFreeFormObject, isAnyType, isDefault, simpleType, primitiveType, isMap, isArray, isBinary, isFile, schema, jsonSchema, vendorExtensions, items, additionalProperties, - vars, requiredVars, isNull, + vars, requiredVars, isNull, hasValidation, getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(), getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(), is1xx, is2xx, is3xx, is4xx, is5xx); @@ -124,6 +125,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { items == that.items && additionalProperties == that.additionalProperties && isNull == that.isNull && + hasValidation == that.hasValidation && is1xx == that.is1xx && is2xx == that.is2xx && is3xx == that.is3xx && @@ -426,6 +428,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { sb.append(", vars='").append(vars).append('\''); sb.append(", requiredVars='").append(requiredVars).append('\''); sb.append(", isNull='").append(isNull); + sb.append(", hasValidation='").append(hasValidation); sb.append('}'); return sb.toString(); } @@ -456,4 +459,10 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { public void setIsNull(boolean isNull) { this.isNull = isNull; } + + @Override + public boolean getHasValidation() { return hasValidation; } + + @Override + public void setHasValidation(boolean hasValidation) { this.hasValidation = hasValidation; } } 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 9f063bef496..e808a2bc1f7 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 @@ -2258,6 +2258,7 @@ public class DefaultCodegen implements CodegenConfig { } CodegenModel m = CodegenModelFactory.newInstance(CodegenModelType.MODEL); + ModelUtils.syncValidationProperties(schema, m); if (reservedWords.contains(name)) { m.name = escapeReservedWord(name); @@ -2305,7 +2306,6 @@ public class DefaultCodegen implements CodegenConfig { m.setItems(arrayProperty.items); m.arrayModelType = arrayProperty.complexType; addParentContainer(m, name, schema); - ModelUtils.syncValidationProperties(schema, m); } else if (ModelUtils.isNullType(schema)) { m.isNull = true; } else if (schema instanceof ComposedSchema) { @@ -2500,8 +2500,6 @@ public class DefaultCodegen implements CodegenConfig { m.isMap = true; } else if (ModelUtils.isIntegerSchema(schema)) { // integer type // NOTE: Integral schemas as CodegenModel is a rare use case and may be removed at a later date. - // Sync of properties is done for consistency with other data types like CodegenParameter/CodegenProperty. - ModelUtils.syncValidationProperties(schema, m); m.isNumeric = Boolean.TRUE; if (ModelUtils.isLongSchema(schema)) { // int64/long format @@ -2511,23 +2509,15 @@ public class DefaultCodegen implements CodegenConfig { } } else if (ModelUtils.isDateTimeSchema(schema)) { // NOTE: DateTime schemas as CodegenModel is a rare use case and may be removed at a later date. - // Sync of properties is done for consistency with other data types like CodegenParameter/CodegenProperty. - ModelUtils.syncValidationProperties(schema, m); m.isDateTime = Boolean.TRUE; } else if (ModelUtils.isDateSchema(schema)) { // NOTE: Date schemas as CodegenModel is a rare use case and may be removed at a later date. - // Sync of properties is done for consistency with other data types like CodegenParameter/CodegenProperty. - ModelUtils.syncValidationProperties(schema, m); m.isDate = Boolean.TRUE; } else if (ModelUtils.isStringSchema(schema)) { // NOTE: String schemas as CodegenModel is a rare use case and may be removed at a later date. - // Sync of properties is done for consistency with other data types like CodegenParameter/CodegenProperty. - ModelUtils.syncValidationProperties(schema, m); m.isString = Boolean.TRUE; } else if (ModelUtils.isNumberSchema(schema)) { // NOTE: Number schemas as CodegenModel is a rare use case and may be removed at a later date. - // Sync of properties is done for consistency with other data types like CodegenParameter/CodegenProperty. - ModelUtils.syncValidationProperties(schema, m); m.isNumeric = Boolean.TRUE; if (ModelUtils.isFloatSchema(schema)) { // float m.isFloat = Boolean.TRUE; @@ -2538,7 +2528,6 @@ public class DefaultCodegen implements CodegenConfig { } } else if (ModelUtils.isFreeFormObject(openAPI, schema)) { addAdditionPropertiesToCodeGenModel(m, schema); - ModelUtils.syncValidationProperties(schema, m); } if (Boolean.TRUE.equals(schema.getNullable())) { @@ -3077,7 +3066,6 @@ public class DefaultCodegen implements CodegenConfig { p = unaliasSchema(p, importMapping); CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY); - ModelUtils.syncValidationProperties(p, property); property.name = toVarName(name); @@ -3144,27 +3132,6 @@ public class DefaultCodegen implements CodegenConfig { property.isInteger = Boolean.TRUE; } - if (p.getMinimum() != null) { - property.minimum = String.valueOf(p.getMinimum().longValue()); - } - if (p.getMaximum() != null) { - property.maximum = String.valueOf(p.getMaximum().longValue()); - } - if (p.getExclusiveMinimum() != null) { - property.exclusiveMinimum = p.getExclusiveMinimum(); - } - if (p.getExclusiveMaximum() != null) { - property.exclusiveMaximum = p.getExclusiveMaximum(); - } - if (p.getMultipleOf() != null) { - property.multipleOf = p.getMultipleOf(); - } - - // check if any validation rule defined - // exclusive* are noop without corresponding min/max - if (property.minimum != null || property.maximum != null || p.getMultipleOf() != null) - property.hasValidation = true; - } else if (ModelUtils.isBooleanSchema(p)) { // boolean type property.isBoolean = true; property.getter = toBooleanGetter(name); @@ -3177,27 +3144,6 @@ public class DefaultCodegen implements CodegenConfig { property.isDateTime = true; } else if (ModelUtils.isDecimalSchema(p)) { // type: string, format: number property.isDecimal = true; - if (p.getMinimum() != null) { - property.minimum = String.valueOf(p.getMinimum()); - } - if (p.getMaximum() != null) { - property.maximum = String.valueOf(p.getMaximum()); - } - if (p.getExclusiveMinimum() != null) { - property.exclusiveMinimum = p.getExclusiveMinimum(); - } - if (p.getExclusiveMaximum() != null) { - property.exclusiveMaximum = p.getExclusiveMaximum(); - } - if (p.getMultipleOf() != null) { - property.multipleOf = p.getMultipleOf(); - } - - // check if any validation rule defined - // exclusive* are noop without corresponding min/max - if (property.minimum != null || property.maximum != null || p.getMultipleOf() != null) { - property.hasValidation = true; - } } else if (ModelUtils.isStringSchema(p)) { if (ModelUtils.isByteArraySchema(p)) { property.isByteArray = true; @@ -3219,15 +3165,8 @@ public class DefaultCodegen implements CodegenConfig { } else { property.isString = true; } - - property.maxLength = p.getMaxLength(); - property.minLength = p.getMinLength(); property.pattern = toRegularExpression(p.getPattern()); - // check if any validation rule defined - if (property.pattern != null || property.minLength != null || property.maxLength != null) - property.hasValidation = true; - } else if (ModelUtils.isNumberSchema(p)) { property.isNumeric = Boolean.TRUE; if (ModelUtils.isFloatSchema(p)) { // float @@ -3238,28 +3177,6 @@ public class DefaultCodegen implements CodegenConfig { property.isNumber = Boolean.TRUE; } - if (p.getMinimum() != null) { - property.minimum = String.valueOf(p.getMinimum()); - } - if (p.getMaximum() != null) { - property.maximum = String.valueOf(p.getMaximum()); - } - if (p.getExclusiveMinimum() != null) { - property.exclusiveMinimum = p.getExclusiveMinimum(); - } - if (p.getExclusiveMaximum() != null) { - property.exclusiveMaximum = p.getExclusiveMaximum(); - } - if (p.getMultipleOf() != null) { - property.multipleOf = p.getMultipleOf(); - } - - // check if any validation rule defined - // exclusive* are noop without corresponding min/max - if (property.minimum != null || property.maximum != null || p.getMultipleOf() != null) { - property.hasValidation = true; - } - } else if (isFreeFormObject(p)) { property.isFreeFormObject = true; } else if (isAnyTypeSchema(p)) { @@ -3347,8 +3264,6 @@ public class DefaultCodegen implements CodegenConfig { } // handle inner property - property.maxItems = p.getMaxItems(); - property.minItems = p.getMinItems(); String itemName = null; if (p.getExtensions() != null && p.getExtensions().get("x-item-name") != null) { itemName = p.getExtensions().get("x-item-name").toString(); @@ -3365,6 +3280,7 @@ public class DefaultCodegen implements CodegenConfig { property.isMap = true; property.containerType = "map"; property.baseType = getSchemaType(p); + // TODO remove this hack in the future, code should use minProperties and maxProperties for object schemas property.minItems = p.getMinProperties(); property.maxItems = p.getMaxProperties(); @@ -3983,20 +3899,6 @@ public class DefaultCodegen implements CodegenConfig { public CodegenResponse fromResponse(String responseCode, ApiResponse response) { CodegenResponse r = CodegenModelFactory.newInstance(CodegenModelType.RESPONSE); - if (response.getContent() != null && response.getContent().size() > 0) { - // Ensure validation properties from a target schema are persisted on CodegenResponse. - // This ignores any edge case where different schemas have different validations because we don't - // have a way to indicate a preference for response schema and are effective 1:1. - Schema contentSchema = null; - for (MediaType mt : response.getContent().values()) { - if (contentSchema != null) break; - contentSchema = mt.getSchema(); - } - if (contentSchema != null) { - ModelUtils.syncValidationProperties(contentSchema, r); - } - } - if ("default".equals(responseCode) || "defaultResponse".equals(responseCode)) { r.code = "0"; r.isDefault = true; @@ -4030,8 +3932,11 @@ public class DefaultCodegen implements CodegenConfig { responseSchema = ModelUtils.getSchemaFromResponse(response); } r.schema = responseSchema; - if (responseSchema != null && responseSchema.getPattern() != null) { - r.setPattern(toRegularExpression(responseSchema.getPattern())); + if (responseSchema != null) { + ModelUtils.syncValidationProperties(responseSchema, r); + if (responseSchema.getPattern() != null) { + r.setPattern(toRegularExpression(responseSchema.getPattern())); + } } r.message = escapeText(response.getDescription()); @@ -4219,20 +4124,6 @@ public class DefaultCodegen implements CodegenConfig { public CodegenParameter fromParameter(Parameter parameter, Set imports) { CodegenParameter codegenParameter = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER); - if (parameter.getContent() != null && parameter.getContent().size() > 0) { - // Ensure validation properties from a target schema are persisted on CodegenParameter. - // This ignores any edge case where different schemas have different validations because we don't - // have a way to indicate a preference for parameter schema and are effective 1:1. - Schema contentSchema = null; - for (MediaType mt : parameter.getContent().values()) { - if (contentSchema != null) break; - contentSchema = mt.getSchema(); - } - if (contentSchema != null) { - ModelUtils.syncValidationProperties(contentSchema, codegenParameter); - } - } - codegenParameter.baseName = parameter.getName(); codegenParameter.description = escapeText(parameter.getDescription()); codegenParameter.unescapedDescription = parameter.getDescription(); @@ -4271,6 +4162,7 @@ public class DefaultCodegen implements CodegenConfig { LOGGER.warn("warning! Schema not found for parameter \"" + parameter.getName() + "\", using String"); parameterSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to missing type definition."); } + ModelUtils.syncValidationProperties(parameterSchema, codegenParameter); if (Boolean.TRUE.equals(parameterSchema.getNullable())) { // use nullable defined in the spec codegenParameter.isNullable = true; @@ -6029,9 +5921,10 @@ public class DefaultCodegen implements CodegenConfig { if (StringUtils.isNotBlank(schema.get$ref())) { name = ModelUtils.getSimpleRef(schema.get$ref()); } + Schema validationSchema = unaliasSchema(schema, importMapping); schema = ModelUtils.getReferencedSchema(this.openAPI, schema); - ModelUtils.syncValidationProperties(schema, codegenParameter); + ModelUtils.syncValidationProperties(validationSchema, codegenParameter); if (ModelUtils.isMapSchema(schema)) { // Schema with additionalproperties: true (including composed schemas with additionalproperties: true) @@ -6159,12 +6052,6 @@ public class DefaultCodegen implements CodegenConfig { codegenParameter.dataType = codegenProperty.dataType; codegenParameter.description = codegenProperty.description; codegenParameter.paramName = toParamName(codegenParameter.baseName); - codegenParameter.minimum = codegenProperty.minimum; - codegenParameter.maximum = codegenProperty.maximum; - codegenParameter.exclusiveMinimum = codegenProperty.exclusiveMinimum; - codegenParameter.exclusiveMaximum = codegenProperty.exclusiveMaximum; - codegenParameter.minLength = codegenProperty.minLength; - codegenParameter.maxLength = codegenProperty.maxLength; codegenParameter.pattern = codegenProperty.pattern; codegenParameter.isNullable = codegenProperty.isNullable; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java index 9b0ad0f89f9..3d9cd65af29 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java @@ -94,4 +94,8 @@ public interface IJsonSchemaValidationProperties { boolean getIsNull(); void setIsNull(boolean isNull); + + boolean getHasValidation(); + + void setHasValidation(boolean hasValidation); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java index 2ad0470bc15..f570c562930 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java @@ -1489,30 +1489,89 @@ public class ModelUtils { public static void syncValidationProperties(Schema schema, IJsonSchemaValidationProperties target) { if (schema != null && target != null) { - target.setPattern(schema.getPattern()); - BigDecimal minimum = schema.getMinimum(); - BigDecimal maximum = schema.getMaximum(); - Boolean exclusiveMinimum = schema.getExclusiveMinimum(); - Boolean exclusiveMaximum = schema.getExclusiveMaximum(); - Integer minLength = schema.getMinLength(); - Integer maxLength = schema.getMaxLength(); + if (isNullType(schema) || schema.get$ref() != null || isBooleanSchema(schema)) { + return; + } + boolean isAnyType = (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); + if (isAnyType) { + return; + } Integer minItems = schema.getMinItems(); Integer maxItems = schema.getMaxItems(); Boolean uniqueItems = schema.getUniqueItems(); Integer minProperties = schema.getMinProperties(); Integer maxProperties = schema.getMaxProperties(); + Integer minLength = schema.getMinLength(); + Integer maxLength = schema.getMaxLength(); + String pattern = schema.getPattern(); + BigDecimal multipleOf = schema.getMultipleOf(); + BigDecimal minimum = schema.getMinimum(); + BigDecimal maximum = schema.getMaximum(); + Boolean exclusiveMinimum = schema.getExclusiveMinimum(); + Boolean exclusiveMaximum = schema.getExclusiveMaximum(); - if (minimum != null) target.setMinimum(String.valueOf(minimum)); - if (maximum != null) target.setMaximum(String.valueOf(maximum)); + if (isArraySchema(schema)) { + setArrayValidations(minItems, maxItems, uniqueItems, target); + } else if (isMapSchema(schema) || isObjectSchema(schema)) { + setObjectValidations(minProperties, maxProperties, target); + } else if (isStringSchema(schema)) { + setStringValidations(minLength, maxLength, pattern, target); + if (isDecimalSchema(schema)) { + setNumericValidations(schema, multipleOf, minimum, maximum, exclusiveMinimum, exclusiveMaximum, target); + } + } else if (isNumberSchema(schema) || isIntegerSchema(schema)) { + setNumericValidations(schema, multipleOf, minimum, maximum, exclusiveMinimum, exclusiveMaximum, target); + } else if (isComposedSchema(schema)) { + // this could be composed out of anything so set all validations here + setArrayValidations(minItems, maxItems, uniqueItems, target); + setObjectValidations(minProperties, maxProperties, target); + setStringValidations(minLength, maxLength, pattern, target); + setNumericValidations(schema, multipleOf, minimum, maximum, exclusiveMinimum, exclusiveMaximum, target); + } + + if (maxItems != null || minItems != null || minProperties != null || maxProperties != null || minLength != null || maxLength != null || multipleOf != null || pattern != null || minimum != null || maximum != null || exclusiveMinimum != null || exclusiveMaximum != null || uniqueItems != null) { + target.setHasValidation(true); + } + } + } + + private static void setArrayValidations(Integer minItems, Integer maxItems, Boolean uniqueItems, IJsonSchemaValidationProperties target) { + if (minItems != null) target.setMinItems(minItems); + if (maxItems != null) target.setMaxItems(maxItems); + if (uniqueItems != null) target.setUniqueItems(uniqueItems); + } + + private static void setObjectValidations(Integer minProperties, Integer maxProperties, IJsonSchemaValidationProperties target) { + if (minProperties != null) target.setMinProperties(minProperties); + if (maxProperties != null) target.setMaxProperties(maxProperties); + } + + private static void setStringValidations(Integer minLength, Integer maxLength, String pattern, IJsonSchemaValidationProperties target) { + if (minLength != null) target.setMinLength(minLength); + if (maxLength != null) target.setMaxLength(maxLength); + if (pattern != null) target.setPattern(pattern); + } + + private static void setNumericValidations(Schema schema, BigDecimal multipleOf, BigDecimal minimum, BigDecimal maximum, Boolean exclusiveMinimum, Boolean exclusiveMaximum, IJsonSchemaValidationProperties target) { + if (multipleOf != null) target.setMultipleOf(multipleOf); + if (minimum != null) { + if (isIntegerSchema(schema)) { + target.setMinimum(String.valueOf(minimum.longValue())); + } else { + target.setMinimum(String.valueOf(minimum)); + } if (exclusiveMinimum != null) target.setExclusiveMinimum(exclusiveMinimum); + } + if (maximum != null) { + if (isIntegerSchema(schema)) { + target.setMaximum(String.valueOf(maximum.longValue())); + } else { + target.setMaximum(String.valueOf(maximum)); + } if (exclusiveMaximum != null) target.setExclusiveMaximum(exclusiveMaximum); - if (minLength != null) target.setMinLength(minLength); - if (maxLength != null) target.setMaxLength(maxLength); - if (minItems != null) target.setMinItems(minItems); - if (maxItems != null) target.setMaxItems(maxItems); - if (uniqueItems != null) target.setUniqueItems(uniqueItems); - if (minProperties != null) target.setMinProperties(minProperties); - if (maxProperties != null) target.setMaxProperties(maxProperties); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index 87959fbb2ed..7042e13c2a7 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -2651,6 +2651,227 @@ public class DefaultCodegenTest { assertEquals(co.responses.get(0).isNull, true); } + @Test + public void testModelGetHasValidation() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7651.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + Schema sc; + CodegenModel cm; + + List modelNames = Arrays.asList( + "ArrayWithMaxItems", + "ArrayWithMinItems", + "ArrayWithUniqueItems", + "ObjectWithMinProperties", + "ObjectWithMaxProperties", + "StringWithMinLength", + "DateWithMinLength", + "DateTimeWithMinLength", + "ByteWithMinLength", + "BinaryWithMinLength", + "StringWithMaxLength", + "DateWithMaxLength", + "DateTimeWithMaxLength", + "ByteWithMaxLength", + "BinaryWithMaxLength", + "IntegerWithMultipleOf", + "Integer32WithMultipleOf", + "Integer64WithMultipleOf", + "NumberWithMultipleOf", + "NumberFloatWithMultipleOf", + "NumberDoubleWithMultipleOf", + "StringWithPattern", + "DateWithPattern", + "DateTimeWithPattern", + "ByteWithPattern", + "BinaryWithPattern", + "IntegerWithMinimum", + "Integer32WithMinimum", + "Integer64WithMinimum", + "NumberWithMinimum", + "NumberFloatWithMinimum", + "NumberDoubleWithMinimum", + "IntegerWithMaximum", + "Integer32WithMaximum", + "Integer64WithMaximum", + "NumberWithMaximum", + "NumberFloatWithMaximum", + "NumberDoubleWithMaximum", + "IntegerWithExclusiveMaximum", + "Integer32WithExclusiveMaximum", + "Integer64WithExclusiveMaximum", + "NumberWithExclusiveMaximum", + "NumberFloatWithExclusiveMaximum", + "NumberDoubleWithExclusiveMaximum", + "IntegerWithExclusiveMinimum", + "Integer32WithExclusiveMinimum", + "Integer64WithExclusiveMinimum", + "NumberWithExclusiveMinimum", + "NumberFloatWithExclusiveMinimum", + "NumberDoubleWithExclusiveMinimum" + ); + for (String modelName : modelNames) { + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + assertEquals(cm.getHasValidation(), true); + } + } + + @Test + public void testPropertyGetHasValidation() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7651.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + String modelName = "ObjectWithPropertiesThatHaveValidations"; + Schema sc = openAPI.getComponents().getSchemas().get(modelName);; + CodegenModel cm = codegen.fromModel(modelName, sc); + + List props = cm.getVars(); + assertEquals(props.size(), 50); + for (CodegenProperty prop : props) { + assertEquals(prop.getHasValidation(), true); + } + } + + @Test + public void testQueryParametersGetHasValidation() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7651.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + String path = "/queryParametersWithValidation"; + Operation operation = openAPI.getPaths().get(path).getPost(); + CodegenOperation co = codegen.fromOperation(path, "POST", operation, null); + List params = co.queryParams; + assertEquals(params.size(), 50); + for (CodegenParameter param : params) { + assertEquals(param.getHasValidation(), true); + } + } + + @Test + public void testHeaderParametersGetHasValidation() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7651.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + String path = "/headerParametersWithValidation"; + Operation operation = openAPI.getPaths().get(path).getPost(); + CodegenOperation co = codegen.fromOperation(path, "POST", operation, null); + List params = co.headerParams; + assertEquals(params.size(), 50); + for (CodegenParameter param : params) { + assertEquals(param.getHasValidation(), true); + } + } + + @Test + public void testCookieParametersGetHasValidation() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7651.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + String path = "/cookieParametersWithValidation"; + Operation operation = openAPI.getPaths().get(path).getPost(); + CodegenOperation co = codegen.fromOperation(path, "POST", operation, null); + List params = co.cookieParams; + assertEquals(params.size(), 50); + for (CodegenParameter param : params) { + assertEquals(param.getHasValidation(), true); + } + } + + @Test + public void testPathParametersGetHasValidation() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7651.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + String path = "/pathParametersWithValidation"; + Operation operation = openAPI.getPaths().get(path).getPost(); + CodegenOperation co = codegen.fromOperation(path, "POST", operation, null); + List params = co.pathParams; + assertEquals(params.size(), 50); + for (CodegenParameter param : params) { + assertEquals(param.getHasValidation(), true); + } + } + + @Test + public void testBodyAndResponseGetHasValidation() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7651.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + List modelNames = Arrays.asList( + "ArrayWithMaxItems", + "ArrayWithMinItems", + "ArrayWithUniqueItems", + "ObjectWithMinProperties", + "ObjectWithMaxProperties", + "StringWithMinLength", + "DateWithMinLength", + "DateTimeWithMinLength", + "ByteWithMinLength", + "BinaryWithMinLength", + "StringWithMaxLength", + "DateWithMaxLength", + "DateTimeWithMaxLength", + "ByteWithMaxLength", + "BinaryWithMaxLength", + "StringWithPattern", + "DateWithPattern", + "DateTimeWithPattern", + "ByteWithPattern", + "BinaryWithPattern", + "IntegerWithMultipleOf", + "Integer32WithMultipleOf", + "Integer64WithMultipleOf", + "NumberWithMultipleOf", + "NumberFloatWithMultipleOf", + "NumberDoubleWithMultipleOf", + "IntegerWithMinimum", + "Integer32WithMinimum", + "Integer64WithMinimum", + "NumberWithMinimum", + "NumberFloatWithMinimum", + "NumberDoubleWithMinimum", + "IntegerWithMaximum", + "Integer32WithMaximum", + "Integer64WithMaximum", + "NumberWithMaximum", + "NumberFloatWithMaximum", + "NumberDoubleWithMaximum", + "IntegerWithExclusiveMaximum", + "Integer32WithExclusiveMaximum", + "Integer64WithExclusiveMaximum", + "NumberWithExclusiveMaximum", + "NumberFloatWithExclusiveMaximum", + "NumberDoubleWithExclusiveMaximum", + "IntegerWithExclusiveMinimum", + "Integer32WithExclusiveMinimum", + "Integer64WithExclusiveMinimum", + "NumberWithExclusiveMinimum", + "NumberFloatWithExclusiveMinimum", + "NumberDoubleWithExclusiveMinimum" + ); + + String path; + Operation operation; + CodegenOperation co; + + for (String modelName : modelNames) { + path = "/"+modelName; + operation = openAPI.getPaths().get(path).getPost(); + co = codegen.fromOperation(path, "POST", operation, null); + assertEquals(co.bodyParam.getHasValidation(), true); + assertEquals(co.responses.get(0).getHasValidation(), true); + } + } + @Test public void testVarsAndRequiredVarsPresent() { final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7613.yaml"); diff --git a/modules/openapi-generator/src/test/resources/3_0/issue_7651.yaml b/modules/openapi-generator/src/test/resources/3_0/issue_7651.yaml index f35d64b4b35..eeb27cace99 100644 --- a/modules/openapi-generator/src/test/resources/3_0/issue_7651.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/issue_7651.yaml @@ -12,6 +12,2332 @@ tags: - name: isX description: an api that ensures that isX properties are present on Schema classes paths: + /ArrayWithMaxItems: + post: + tags: + - isX + operationId: ArrayWithMaxItems + requestBody: + content: + application/json: + schema: + type: array + maxItems: 2 + items: + type: string + responses: + 200: + description: success + content: + application/json: + schema: + type: array + maxItems: 2 + items: + type: string + /ArrayWithMinItems: + post: + tags: + - isX + operationId: ArrayWithMinItems + requestBody: + content: + application/json: + schema: + type: array + minItems: 2 + items: + type: string + responses: + 200: + description: success + content: + application/json: + schema: + type: array + minItems: 2 + items: + type: string + /ArrayWithUniqueItems: + post: + tags: + - isX + operationId: ArrayWithUniqueItems + requestBody: + content: + application/json: + schema: + type: array + uniqueItems: true + items: + type: string + responses: + 200: + description: success + content: + application/json: + schema: + type: array + uniqueItems: true + items: + type: string + /ObjectWithMinProperties: + post: + tags: + - isX + operationId: ObjectWithMinProperties + requestBody: + content: + application/json: + schema: + type: object + minProperties: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: object + minProperties: 2 + /ObjectWithMaxProperties: + post: + tags: + - isX + operationId: ObjectWithMaxProperties + requestBody: + content: + application/json: + schema: + type: object + maxProperties: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: object + maxProperties: 2 + /StringWithMinLength: + post: + tags: + - isX + operationId: StringWithMinLength + requestBody: + content: + application/json: + schema: + type: string + minLength: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + minLength: 1 + /DateWithMinLength: + post: + tags: + - isX + operationId: DateWithMinLength + requestBody: + content: + application/json: + schema: + type: string + format: date + minLength: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: date + minLength: 1 + /DateTimeWithMinLength: + post: + tags: + - isX + operationId: DateTimeWithMinLength + requestBody: + content: + application/json: + schema: + type: string + format: date-time + minLength: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: date-time + minLength: 1 + /ByteWithMinLength: + post: + tags: + - isX + operationId: ByteWithMinLength + requestBody: + content: + application/json: + schema: + type: string + format: byte + minLength: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: byte + minLength: 1 + /BinaryWithMinLength: + post: + tags: + - isX + operationId: BinaryWithMinLength + requestBody: + content: + application/json: + schema: + type: string + format: binary + minLength: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: binary + minLength: 1 + /StringWithMaxLength: + post: + tags: + - isX + operationId: StringWithMaxLength + requestBody: + content: + application/json: + schema: + type: string + maxLength: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + maxLength: 10 + /DateWithMaxLength: + post: + tags: + - isX + operationId: DateWithMaxLength + requestBody: + content: + application/json: + schema: + type: string + format: date + maxLength: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: date + maxLength: 10 + /DateTimeWithMaxLength: + post: + tags: + - isX + operationId: DateTimeWithMaxLength + requestBody: + content: + application/json: + schema: + type: string + format: date-time + maxLength: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: date-time + maxLength: 10 + /ByteWithMaxLength: + post: + tags: + - isX + operationId: ByteWithMaxLength + requestBody: + content: + application/json: + schema: + type: string + format: byte + maxLength: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: byte + maxLength: 10 + /BinaryWithMaxLength: + post: + tags: + - isX + operationId: BinaryWithMaxLength + requestBody: + content: + application/json: + schema: + type: string + format: binary + maxLength: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: binary + maxLength: 10 + /StringWithPattern: + post: + tags: + - isX + operationId: StringWithPattern + requestBody: + content: + application/json: + schema: + type: string + pattern: '^2021.+' + responses: + 200: + description: success + content: + application/json: + schema: + type: string + pattern: '^2021.+' + /DateWithPattern: + post: + tags: + - isX + operationId: DateWithPattern + requestBody: + content: + application/json: + schema: + type: string + format: date + pattern: '^2021.+' + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: date + pattern: '^2021.+' + /DateTimeWithPattern: + post: + tags: + - isX + operationId: DateTimeWithPattern + requestBody: + content: + application/json: + schema: + type: string + format: date-time + pattern: '^2021.+' + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: date-time + pattern: '^2021.+' + /ByteWithPattern: + post: + tags: + - isX + operationId: ByteWithPattern + requestBody: + content: + application/json: + schema: + type: string + format: byte + pattern: '^2021.+' + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: byte + pattern: '^2021.+' + /BinaryWithPattern: + post: + tags: + - isX + operationId: BinaryWithPattern + requestBody: + content: + application/json: + schema: + type: string + format: binary + pattern: '^2021.+' + responses: + 200: + description: success + content: + application/json: + schema: + type: string + format: binary + pattern: '^2021.+' + /IntegerWithMultipleOf: + post: + tags: + - isX + operationId: IntegerWithMultipleOf + requestBody: + content: + application/json: + schema: + type: integer + multipleOf: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + multipleOf: 2 + /Integer32WithMultipleOf: + post: + tags: + - isX + operationId: Integer32WithMultipleOf + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + multipleOf: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int32 + multipleOf: 2 + /Integer64WithMultipleOf: + post: + tags: + - isX + operationId: Integer64WithMultipleOf + requestBody: + content: + application/json: + schema: + type: integer + format: int64 + multipleOf: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int64 + multipleOf: 2 + /NumberWithMultipleOf: + post: + tags: + - isX + operationId: NumberWithMultipleOf + requestBody: + content: + application/json: + schema: + type: number + multipleOf: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + multipleOf: 2 + /NumberFloatWithMultipleOf: + post: + tags: + - isX + operationId: NumberFloatWithMultipleOf + requestBody: + content: + application/json: + schema: + type: number + format: float + multipleOf: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: float + multipleOf: 2 + /NumberDoubleWithMultipleOf: + post: + tags: + - isX + operationId: NumberDoubleWithMultipleOf + requestBody: + content: + application/json: + schema: + type: number + format: double + multipleOf: 2 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: double + multipleOf: 2 + /IntegerWithMinimum: + post: + tags: + - isX + operationId: IntegerWithMinimum + requestBody: + content: + application/json: + schema: + type: integer + minimum: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + minimum: 1 + /Integer32WithMinimum: + post: + tags: + - isX + operationId: Integer32WithMinimum + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + minimum: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int32 + minimum: 1 + /Integer64WithMinimum: + post: + tags: + - isX + operationId: Integer64WithMinimum + requestBody: + content: + application/json: + schema: + type: integer + format: int64 + minimum: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int64 + minimum: 1 + /NumberWithMinimum: + post: + tags: + - isX + operationId: NumberWithMinimum + requestBody: + content: + application/json: + schema: + type: number + minimum: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + minimum: 1 + /NumberFloatWithMinimum: + post: + tags: + - isX + operationId: NumberFloatWithMinimum + requestBody: + content: + application/json: + schema: + type: number + format: float + minimum: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: float + minimum: 1 + /NumberDoubleWithMinimum: + post: + tags: + - isX + operationId: NumberDoubleWithMinimum + requestBody: + content: + application/json: + schema: + type: number + format: double + minimum: 1 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: double + minimum: 1 + /IntegerWithMaximum: + post: + tags: + - isX + operationId: IntegerWithMaximum + requestBody: + content: + application/json: + schema: + type: integer + maximum: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + maximum: 10 + /Integer32WithMaximum: + post: + tags: + - isX + operationId: Integer32WithMaximum + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + maximum: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int32 + maximum: 10 + /Integer64WithMaximum: + post: + tags: + - isX + operationId: Integer64WithMaximum + requestBody: + content: + application/json: + schema: + type: integer + format: int64 + maximum: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int64 + maximum: 10 + /NumberWithMaximum: + post: + tags: + - isX + operationId: NumberWithMaximum + requestBody: + content: + application/json: + schema: + type: number + maximum: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + maximum: 10 + /NumberFloatWithMaximum: + post: + tags: + - isX + operationId: NumberFloatWithMaximum + requestBody: + content: + application/json: + schema: + type: number + format: float + maximum: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: float + maximum: 10 + /NumberDoubleWithMaximum: + post: + tags: + - isX + operationId: NumberDoubleWithMaximum + requestBody: + content: + application/json: + schema: + type: number + format: double + maximum: 10 + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: double + maximum: 10 + /IntegerWithExclusiveMaximum: + post: + tags: + - isX + operationId: IntegerWithExclusiveMaximum + requestBody: + content: + application/json: + schema: + type: integer + maximum: 10 + exclusiveMaximum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + maximum: 10 + exclusiveMaximum: true + /Integer32WithExclusiveMaximum: + post: + tags: + - isX + operationId: Integer32WithExclusiveMaximum + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + /Integer64WithExclusiveMaximum: + post: + tags: + - isX + operationId: Integer64WithExclusiveMaximum + requestBody: + content: + application/json: + schema: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + /NumberWithExclusiveMaximum: + post: + tags: + - isX + operationId: NumberWithExclusiveMaximum + requestBody: + content: + application/json: + schema: + type: number + maximum: 10 + exclusiveMaximum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: number + maximum: 10 + exclusiveMaximum: true + /NumberFloatWithExclusiveMaximum: + post: + tags: + - isX + operationId: NumberFloatWithExclusiveMaximum + requestBody: + content: + application/json: + schema: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + /NumberDoubleWithExclusiveMaximum: + post: + tags: + - isX + operationId: NumberDoubleWithExclusiveMaximum + requestBody: + content: + application/json: + schema: + type: number + format: double + maximum: 10 + exclusiveMaximum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: double + maximum: 10 + exclusiveMaximum: true + /IntegerWithExclusiveMinimum: + post: + tags: + - isX + operationId: IntegerWithExclusiveMinimum + requestBody: + content: + application/json: + schema: + type: integer + minimum: 1 + exclusiveMinimum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + minimum: 1 + exclusiveMinimum: true + /Integer32WithExclusiveMinimum: + post: + tags: + - isX + operationId: Integer32WithExclusiveMinimum + requestBody: + content: + application/json: + schema: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + /Integer64WithExclusiveMinimum: + post: + tags: + - isX + operationId: Integer64WithExclusiveMinimum + requestBody: + content: + application/json: + schema: + type: integer + format: int64 + minimum: 1 + exclusiveMinimum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: integer + format: int64 + minimum: 1 + exclusiveMinimum: true + /NumberWithExclusiveMinimum: + post: + tags: + - isX + operationId: NumberWithExclusiveMinimum + requestBody: + content: + application/json: + schema: + type: number + minimum: 1 + exclusiveMinimum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: number + minimum: 1 + exclusiveMinimum: true + /NumberFloatWithExclusiveMinimum: + post: + tags: + - isX + operationId: NumberFloatWithExclusiveMinimum + requestBody: + content: + application/json: + schema: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + /NumberDoubleWithExclusiveMinimum: + post: + tags: + - isX + operationId: NumberDoubleWithExclusiveMinimum + requestBody: + content: + application/json: + schema: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + responses: + 200: + description: success + content: + application/json: + schema: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + /pathParametersWithValidation: + post: + tags: + - isX + operationId: pathParametersWithValidation + parameters: + - name: ArrayWithMaxItems + in: path + schema: + type: array + maxItems: 2 + items: + type: string + - name: ArrayWithMinItems + in: path + schema: + type: array + minItems: 2 + items: + type: string + - name: ArrayWithUniqueItems + in: path + schema: + type: array + uniqueItems: true + items: + type: string + - name: ObjectWithMinProperties + in: path + schema: + type: object + minProperties: 2 + - name: ObjectWithMaxProperties + in: path + schema: + type: object + maxProperties: 2 + - name: StringWithMinLength + in: path + schema: + type: string + minLength: 1 + - name: DateWithMinLength + in: path + schema: + type: string + format: date + minLength: 10 + - name: DateTimeWithMinLength + in: path + schema: + type: string + format: date-time + minLength: 20 + - name: ByteWithMinLength + in: path + schema: + type: string + format: byte + minLength: 10 + - name: BinaryWithMinLength + in: path + schema: + type: string + format: binary + minLength: 10 + - name: StringWithMaxLength + in: path + schema: + type: string + maxLength: 1 + - name: DateWithMaxLength + in: path + schema: + type: string + format: date + maxLength: 10 + - name: DateTimeWithMaxLength + in: path + schema: + type: string + format: date-time + maxLength: 20 + - name: ByteWithMaxLength + in: path + schema: + type: string + format: byte + maxLength: 10 + - name: BinaryWithMaxLength + in: path + schema: + type: string + format: binary + maxLength: 10 + - name: IntegerWithMultipleOf + in: path + schema: + type: integer + multipleOf: 2 + - name: Integer32WithMultipleOf + in: path + schema: + type: integer + format: int32 + multipleOf: 2 + - name: Integer64WithMultipleOf + in: path + schema: + type: integer + format: int64 + multipleOf: 2 + - name: NumberWithMultipleOf + in: path + schema: + type: number + multipleOf: 2 + - name: NumberFloatWithMultipleOf + in: path + schema: + type: number + format: float + multipleOf: 2 + - name: NumberDoubleWithMultipleOf + in: path + schema: + type: number + format: double + multipleOf: 2 + - name: StringWithPattern + in: path + schema: + type: string + pattern: '^2021.+' + - name: DateWithPattern + in: path + schema: + type: string + format: date + pattern: '^2021.+' + - name: DateTimeWithPattern + in: path + schema: + type: string + format: date-time + pattern: '^2021.+' + - name: ByteWithPattern + in: path + schema: + type: string + format: byte + pattern: '^2021.+' + - name: BinaryWithPattern + in: path + schema: + type: string + format: binary + pattern: '^2021.+' + - name: IntegerWithMinimum + in: path + schema: + type: integer + minimum: 1 + - name: Integer32WithMinimum + in: path + schema: + type: integer + format: int32 + minimum: 1 + - name: Integer64WithMinimum + in: path + schema: + type: integer + format: int364 + minimum: 1 + - name: NumberWithMinimum + in: path + schema: + type: number + minimum: 1 + - name: NumberFloatWithMinimum + in: path + schema: + type: number + format: float + minimum: 1 + - name: NumberDoubleWithMinimum + in: path + schema: + type: number + format: double + minimum: 1 + - name: IntegerWithMaximum + in: path + schema: + type: integer + maximum: 10 + - name: Integer32WithMaximum + in: path + schema: + type: integer + format: int32 + maximum: 10 + - name: Integer64WithMaximum + in: path + schema: + type: integer + format: int64 + maximum: 10 + - name: NumberWithMaximum + in: path + schema: + type: number + maximum: 10 + - name: NumberFloatWithMaximum + in: path + schema: + type: number + format: float + maximum: 10 + - name: NumberDoubleWithMaximum + in: path + schema: + type: number + format: double + maximum: 10 + - name: IntegerWithExclusiveMinimum + in: path + schema: + type: integer + minimum: 1 + exclusiveMinimum: true + - name: Integer32WithExclusiveMinimum + in: path + schema: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + - name: Integer64WithExclusiveMinimum + in: path + schema: + type: integer + format: int364 + minimum: 1 + exclusiveMinimum: true + - name: NumberWithExclusiveMinimum + in: path + schema: + type: number + minimum: 1 + exclusiveMinimum: true + - name: NumberFloatWithExclusiveMinimum + in: path + schema: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + - name: NumberDoubleWithExclusiveMinimum + in: path + schema: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + - name: IntegerWithExclusiveMaximum + in: path + schema: + type: integer + maximum: 10 + exclusiveMaximum: true + - name: Integer32WithExclusiveMaximum + in: path + schema: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + - name: Integer64WithExclusiveMaximum + in: path + schema: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + - name: NumberWithExclusiveMaximum + in: path + schema: + type: number + maximum: 10 + exclusiveMaximum: true + - name: NumberFloatWithExclusiveMaximum + in: path + schema: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + - name: NumberDoubleWithExclusiveMaximum + in: path + schema: + type: number + format: double + maximum: 10 + exclusiveMaximum: true + requestBody: + content: + application/json: + schema: + type: string + required: true + responses: + 200: + description: success + content: + application/json: + schema: + type: string + /cookieParametersWithValidation: + post: + tags: + - isX + operationId: cookieParametersWithValidation + parameters: + - name: ArrayWithMaxItems + in: cookie + schema: + type: array + maxItems: 2 + items: + type: string + - name: ArrayWithMinItems + in: cookie + schema: + type: array + minItems: 2 + items: + type: string + - name: ArrayWithUniqueItems + in: cookie + schema: + type: array + uniqueItems: true + items: + type: string + - name: ObjectWithMinProperties + in: cookie + schema: + type: object + minProperties: 2 + - name: ObjectWithMaxProperties + in: cookie + schema: + type: object + maxProperties: 2 + - name: StringWithMinLength + in: cookie + schema: + type: string + minLength: 1 + - name: DateWithMinLength + in: cookie + schema: + type: string + format: date + minLength: 10 + - name: DateTimeWithMinLength + in: cookie + schema: + type: string + format: date-time + minLength: 20 + - name: ByteWithMinLength + in: cookie + schema: + type: string + format: byte + minLength: 10 + - name: BinaryWithMinLength + in: cookie + schema: + type: string + format: binary + minLength: 10 + - name: StringWithMaxLength + in: cookie + schema: + type: string + maxLength: 1 + - name: DateWithMaxLength + in: cookie + schema: + type: string + format: date + maxLength: 10 + - name: DateTimeWithMaxLength + in: cookie + schema: + type: string + format: date-time + maxLength: 20 + - name: ByteWithMaxLength + in: cookie + schema: + type: string + format: byte + maxLength: 10 + - name: BinaryWithMaxLength + in: cookie + schema: + type: string + format: binary + maxLength: 10 + - name: IntegerWithMultipleOf + in: cookie + schema: + type: integer + multipleOf: 2 + - name: Integer32WithMultipleOf + in: cookie + schema: + type: integer + format: int32 + multipleOf: 2 + - name: Integer64WithMultipleOf + in: cookie + schema: + type: integer + format: int64 + multipleOf: 2 + - name: NumberWithMultipleOf + in: cookie + schema: + type: number + multipleOf: 2 + - name: NumberFloatWithMultipleOf + in: cookie + schema: + type: number + format: float + multipleOf: 2 + - name: NumberDoubleWithMultipleOf + in: cookie + schema: + type: number + format: double + multipleOf: 2 + - name: StringWithPattern + in: cookie + schema: + type: string + pattern: '^2021.+' + - name: DateWithPattern + in: cookie + schema: + type: string + format: date + pattern: '^2021.+' + - name: DateTimeWithPattern + in: cookie + schema: + type: string + format: date-time + pattern: '^2021.+' + - name: ByteWithPattern + in: cookie + schema: + type: string + format: byte + pattern: '^2021.+' + - name: BinaryWithPattern + in: cookie + schema: + type: string + format: binary + pattern: '^2021.+' + - name: IntegerWithMinimum + in: cookie + schema: + type: integer + minimum: 1 + - name: Integer32WithMinimum + in: cookie + schema: + type: integer + format: int32 + minimum: 1 + - name: Integer64WithMinimum + in: cookie + schema: + type: integer + format: int364 + minimum: 1 + - name: NumberWithMinimum + in: cookie + schema: + type: number + minimum: 1 + - name: NumberFloatWithMinimum + in: cookie + schema: + type: number + format: float + minimum: 1 + - name: NumberDoubleWithMinimum + in: cookie + schema: + type: number + format: double + minimum: 1 + - name: IntegerWithMaximum + in: cookie + schema: + type: integer + maximum: 10 + - name: Integer32WithMaximum + in: cookie + schema: + type: integer + format: int32 + maximum: 10 + - name: Integer64WithMaximum + in: cookie + schema: + type: integer + format: int64 + maximum: 10 + - name: NumberWithMaximum + in: cookie + schema: + type: number + maximum: 10 + - name: NumberFloatWithMaximum + in: cookie + schema: + type: number + format: float + maximum: 10 + - name: NumberDoubleWithMaximum + in: cookie + schema: + type: number + format: double + maximum: 10 + - name: IntegerWithExclusiveMinimum + in: cookie + schema: + type: integer + minimum: 1 + exclusiveMinimum: true + - name: Integer32WithExclusiveMinimum + in: cookie + schema: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + - name: Integer64WithExclusiveMinimum + in: cookie + schema: + type: integer + format: int364 + minimum: 1 + exclusiveMinimum: true + - name: NumberWithExclusiveMinimum + in: cookie + schema: + type: number + minimum: 1 + exclusiveMinimum: true + - name: NumberFloatWithExclusiveMinimum + in: cookie + schema: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + - name: NumberDoubleWithExclusiveMinimum + in: cookie + schema: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + - name: IntegerWithExclusiveMaximum + in: cookie + schema: + type: integer + maximum: 10 + exclusiveMaximum: true + - name: Integer32WithExclusiveMaximum + in: cookie + schema: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + - name: Integer64WithExclusiveMaximum + in: cookie + schema: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + - name: NumberWithExclusiveMaximum + in: cookie + schema: + type: number + maximum: 10 + exclusiveMaximum: true + - name: NumberFloatWithExclusiveMaximum + in: cookie + schema: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + - name: NumberDoubleWithExclusiveMaximum + in: cookie + schema: + type: number + format: double + maximum: 10 + exclusiveMaximum: true + requestBody: + content: + application/json: + schema: + type: string + required: true + responses: + 200: + description: success + content: + application/json: + schema: + type: string + /headerParametersWithValidation: + post: + tags: + - isX + operationId: headerParametersWithValidation + parameters: + - name: ArrayWithMaxItems + in: header + schema: + type: array + maxItems: 2 + items: + type: string + - name: ArrayWithMinItems + in: header + schema: + type: array + minItems: 2 + items: + type: string + - name: ArrayWithUniqueItems + in: header + schema: + type: array + uniqueItems: true + items: + type: string + - name: ObjectWithMinProperties + in: header + schema: + type: object + minProperties: 2 + - name: ObjectWithMaxProperties + in: header + schema: + type: object + maxProperties: 2 + - name: StringWithMinLength + in: header + schema: + type: string + minLength: 1 + - name: DateWithMinLength + in: header + schema: + type: string + format: date + minLength: 10 + - name: DateTimeWithMinLength + in: header + schema: + type: string + format: date-time + minLength: 20 + - name: ByteWithMinLength + in: header + schema: + type: string + format: byte + minLength: 10 + - name: BinaryWithMinLength + in: header + schema: + type: string + format: binary + minLength: 10 + - name: StringWithMaxLength + in: header + schema: + type: string + maxLength: 1 + - name: DateWithMaxLength + in: header + schema: + type: string + format: date + maxLength: 10 + - name: DateTimeWithMaxLength + in: header + schema: + type: string + format: date-time + maxLength: 20 + - name: ByteWithMaxLength + in: header + schema: + type: string + format: byte + maxLength: 10 + - name: BinaryWithMaxLength + in: header + schema: + type: string + format: binary + maxLength: 10 + - name: IntegerWithMultipleOf + in: header + schema: + type: integer + multipleOf: 2 + - name: Integer32WithMultipleOf + in: header + schema: + type: integer + format: int32 + multipleOf: 2 + - name: Integer64WithMultipleOf + in: header + schema: + type: integer + format: int64 + multipleOf: 2 + - name: NumberWithMultipleOf + in: header + schema: + type: number + multipleOf: 2 + - name: NumberFloatWithMultipleOf + in: header + schema: + type: number + format: float + multipleOf: 2 + - name: NumberDoubleWithMultipleOf + in: header + schema: + type: number + format: double + multipleOf: 2 + - name: StringWithPattern + in: header + schema: + type: string + pattern: '^2021.+' + - name: DateWithPattern + in: header + schema: + type: string + format: date + pattern: '^2021.+' + - name: DateTimeWithPattern + in: header + schema: + type: string + format: date-time + pattern: '^2021.+' + - name: ByteWithPattern + in: header + schema: + type: string + format: byte + pattern: '^2021.+' + - name: BinaryWithPattern + in: header + schema: + type: string + format: binary + pattern: '^2021.+' + - name: IntegerWithMinimum + in: header + schema: + type: integer + minimum: 1 + - name: Integer32WithMinimum + in: header + schema: + type: integer + format: int32 + minimum: 1 + - name: Integer64WithMinimum + in: header + schema: + type: integer + format: int364 + minimum: 1 + - name: NumberWithMinimum + in: header + schema: + type: number + minimum: 1 + - name: NumberFloatWithMinimum + in: header + schema: + type: number + format: float + minimum: 1 + - name: NumberDoubleWithMinimum + in: header + schema: + type: number + format: double + minimum: 1 + - name: IntegerWithMaximum + in: header + schema: + type: integer + maximum: 10 + - name: Integer32WithMaximum + in: header + schema: + type: integer + format: int32 + maximum: 10 + - name: Integer64WithMaximum + in: header + schema: + type: integer + format: int64 + maximum: 10 + - name: NumberWithMaximum + in: header + schema: + type: number + maximum: 10 + - name: NumberFloatWithMaximum + in: header + schema: + type: number + format: float + maximum: 10 + - name: NumberDoubleWithMaximum + in: header + schema: + type: number + format: double + maximum: 10 + - name: IntegerWithExclusiveMinimum + in: header + schema: + type: integer + minimum: 1 + exclusiveMinimum: true + - name: Integer32WithExclusiveMinimum + in: header + schema: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + - name: Integer64WithExclusiveMinimum + in: header + schema: + type: integer + format: int364 + minimum: 1 + exclusiveMinimum: true + - name: NumberWithExclusiveMinimum + in: header + schema: + type: number + minimum: 1 + exclusiveMinimum: true + - name: NumberFloatWithExclusiveMinimum + in: header + schema: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + - name: NumberDoubleWithExclusiveMinimum + in: header + schema: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + - name: IntegerWithExclusiveMaximum + in: header + schema: + type: integer + maximum: 10 + exclusiveMaximum: true + - name: Integer32WithExclusiveMaximum + in: header + schema: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + - name: Integer64WithExclusiveMaximum + in: header + schema: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + - name: NumberWithExclusiveMaximum + in: header + schema: + type: number + maximum: 10 + exclusiveMaximum: true + - name: NumberFloatWithExclusiveMaximum + in: header + schema: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + - name: NumberDoubleWithExclusiveMaximum + in: header + schema: + type: number + format: double + maximum: 10 + exclusiveMaximum: true + requestBody: + content: + application/json: + schema: + type: string + required: true + responses: + 200: + description: success + content: + application/json: + schema: + type: string + /queryParametersWithValidation: + post: + tags: + - isX + operationId: queryParametersWithValidation + parameters: + - name: ArrayWithMaxItems + in: query + schema: + type: array + maxItems: 2 + items: + type: string + - name: ArrayWithMinItems + in: query + schema: + type: array + minItems: 2 + items: + type: string + - name: ArrayWithUniqueItems + in: query + schema: + type: array + uniqueItems: true + items: + type: string + - name: ObjectWithMinProperties + in: query + schema: + type: object + minProperties: 2 + - name: ObjectWithMaxProperties + in: query + schema: + type: object + maxProperties: 2 + - name: StringWithMinLength + in: query + schema: + type: string + minLength: 1 + - name: DateWithMinLength + in: query + schema: + type: string + format: date + minLength: 10 + - name: DateTimeWithMinLength + in: query + schema: + type: string + format: date-time + minLength: 20 + - name: ByteWithMinLength + in: query + schema: + type: string + format: byte + minLength: 10 + - name: BinaryWithMinLength + in: query + schema: + type: string + format: binary + minLength: 10 + - name: StringWithMaxLength + in: query + schema: + type: string + maxLength: 1 + - name: DateWithMaxLength + in: query + schema: + type: string + format: date + maxLength: 10 + - name: DateTimeWithMaxLength + in: query + schema: + type: string + format: date-time + maxLength: 20 + - name: ByteWithMaxLength + in: query + schema: + type: string + format: byte + maxLength: 10 + - name: BinaryWithMaxLength + in: query + schema: + type: string + format: binary + maxLength: 10 + - name: IntegerWithMultipleOf + in: query + schema: + type: integer + multipleOf: 2 + - name: Integer32WithMultipleOf + in: query + schema: + type: integer + format: int32 + multipleOf: 2 + - name: Integer64WithMultipleOf + in: query + schema: + type: integer + format: int64 + multipleOf: 2 + - name: NumberWithMultipleOf + in: query + schema: + type: number + multipleOf: 2 + - name: NumberFloatWithMultipleOf + in: query + schema: + type: number + format: float + multipleOf: 2 + - name: NumberDoubleWithMultipleOf + in: query + schema: + type: number + format: double + multipleOf: 2 + - name: StringWithPattern + in: query + schema: + type: string + pattern: '^2021.+' + - name: DateWithPattern + in: query + schema: + type: string + format: date + pattern: '^2021.+' + - name: DateTimeWithPattern + in: query + schema: + type: string + format: date-time + pattern: '^2021.+' + - name: ByteWithPattern + in: query + schema: + type: string + format: byte + pattern: '^2021.+' + - name: BinaryWithPattern + in: query + schema: + type: string + format: binary + pattern: '^2021.+' + - name: IntegerWithMinimum + in: query + schema: + type: integer + minimum: 1 + - name: Integer32WithMinimum + in: query + schema: + type: integer + format: int32 + minimum: 1 + - name: Integer64WithMinimum + in: query + schema: + type: integer + format: int364 + minimum: 1 + - name: NumberWithMinimum + in: query + schema: + type: number + minimum: 1 + - name: NumberFloatWithMinimum + in: query + schema: + type: number + format: float + minimum: 1 + - name: NumberDoubleWithMinimum + in: query + schema: + type: number + format: double + minimum: 1 + - name: IntegerWithMaximum + in: query + schema: + type: integer + maximum: 10 + - name: Integer32WithMaximum + in: query + schema: + type: integer + format: int32 + maximum: 10 + - name: Integer64WithMaximum + in: query + schema: + type: integer + format: int64 + maximum: 10 + - name: NumberWithMaximum + in: query + schema: + type: number + maximum: 10 + - name: NumberFloatWithMaximum + in: query + schema: + type: number + format: float + maximum: 10 + - name: NumberDoubleWithMaximum + in: query + schema: + type: number + format: double + maximum: 10 + - name: IntegerWithExclusiveMinimum + in: query + schema: + type: integer + minimum: 1 + exclusiveMinimum: true + - name: Integer32WithExclusiveMinimum + in: query + schema: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + - name: Integer64WithExclusiveMinimum + in: query + schema: + type: integer + format: int364 + minimum: 1 + exclusiveMinimum: true + - name: NumberWithExclusiveMinimum + in: query + schema: + type: number + minimum: 1 + exclusiveMinimum: true + - name: NumberFloatWithExclusiveMinimum + in: query + schema: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + - name: NumberDoubleWithExclusiveMinimum + in: query + schema: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + - name: IntegerWithExclusiveMaximum + in: query + schema: + type: integer + maximum: 10 + exclusiveMaximum: true + - name: Integer32WithExclusiveMaximum + in: query + schema: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + - name: Integer64WithExclusiveMaximum + in: query + schema: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + - name: NumberWithExclusiveMaximum + in: query + schema: + type: number + maximum: 10 + exclusiveMaximum: true + - name: NumberFloatWithExclusiveMaximum + in: query + schema: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + - name: NumberDoubleWithExclusiveMaximum + in: query + schema: + type: number + format: double + maximum: 10 + exclusiveMaximum: true + requestBody: + content: + application/json: + schema: + type: string + required: true + responses: + 200: + description: success + content: + application/json: + schema: + type: string /ref_date_with_validation/{date}: post: tags: @@ -124,7 +2450,7 @@ paths: post: tags: - isX - operationId: null + operationId: 'null' parameters: - name: param in: path @@ -148,7 +2474,7 @@ paths: post: tags: - isX - operationId: null + operationId: refNull parameters: - name: param in: path @@ -170,6 +2496,409 @@ paths: $ref: '#/components/schemas/NullModel' components: schemas: + ArrayWithMaxItems: + type: array + maxItems: 2 + items: + type: string + ArrayWithMinItems: + type: array + minItems: 2 + items: + type: string + ArrayWithUniqueItems: + type: array + uniqueItems: true + items: + type: string + ObjectWithMinProperties: + type: object + minProperties: 2 + ObjectWithMaxProperties: + type: object + maxProperties: 2 + StringWithMinLength: + type: string + minLength: 1 + DateWithMinLength: + type: string + format: date + minLength: 10 + DateTimeWithMinLength: + type: string + format: date-time + minLength: 20 + ByteWithMinLength: + type: string + format: byte + minLength: 10 + BinaryWithMinLength: + type: string + format: binary + minLength: 10 + StringWithMaxLength: + type: string + maxLength: 1 + DateWithMaxLength: + type: string + format: date + maxLength: 10 + DateTimeWithMaxLength: + type: string + format: date-time + maxLength: 20 + ByteWithMaxLength: + type: string + format: byte + maxLength: 10 + BinaryWithMaxLength: + type: string + format: binary + maxLength: 10 + IntegerWithMultipleOf: + type: integer + multipleOf: 2 + Integer32WithMultipleOf: + type: integer + format: int32 + multipleOf: 2 + Integer64WithMultipleOf: + type: integer + format: int64 + multipleOf: 2 + NumberWithMultipleOf: + type: number + multipleOf: 2 + NumberFloatWithMultipleOf: + type: number + format: float + multipleOf: 2 + NumberDoubleWithMultipleOf: + type: number + format: double + multipleOf: 2 + StringWithPattern: + type: string + pattern: '^2021.+' + DateWithPattern: + type: string + format: date + pattern: '^2021.+' + DateTimeWithPattern: + type: string + format: date-time + pattern: '^2021.+' + ByteWithPattern: + type: string + format: byte + pattern: '^2021.+' + BinaryWithPattern: + type: string + format: binary + pattern: '^2021.+' + IntegerWithMinimum: + type: integer + minimum: 1 + Integer32WithMinimum: + type: integer + format: int32 + minimum: 1 + Integer64WithMinimum: + type: integer + format: int364 + minimum: 1 + NumberWithMinimum: + type: number + minimum: 1 + NumberFloatWithMinimum: + type: number + format: float + minimum: 1 + NumberDoubleWithMinimum: + type: number + format: double + minimum: 1 + IntegerWithMaximum: + type: integer + maximum: 10 + Integer32WithMaximum: + type: integer + format: int32 + maximum: 10 + Integer64WithMaximum: + type: integer + format: int64 + maximum: 10 + NumberWithMaximum: + type: number + maximum: 10 + NumberFloatWithMaximum: + type: number + format: float + maximum: 10 + NumberDoubleWithMaximum: + type: number + format: double + maximum: 10 + IntegerWithExclusiveMinimum: + type: integer + minimum: 1 + exclusiveMinimum: true + Integer32WithExclusiveMinimum: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + Integer64WithExclusiveMinimum: + type: integer + format: int364 + minimum: 1 + exclusiveMinimum: true + NumberWithExclusiveMinimum: + type: number + minimum: 1 + exclusiveMinimum: true + NumberFloatWithExclusiveMinimum: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + NumberDoubleWithExclusiveMinimum: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + IntegerWithExclusiveMaximum: + type: integer + maximum: 10 + exclusiveMaximum: true + Integer32WithExclusiveMaximum: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + Integer64WithExclusiveMaximum: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + NumberWithExclusiveMaximum: + type: number + maximum: 10 + exclusiveMaximum: true + NumberFloatWithExclusiveMaximum: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + NumberDoubleWithExclusiveMaximum: + type: number + format: double + maximum: 10 + exclusiveMaximum: true + ObjectWithPropertiesThatHaveValidations: + type: object + properties: + ArrayWithMaxItems: + type: array + maxItems: 2 + items: + type: string + ArrayWithMinItems: + type: array + minItems: 2 + items: + type: string + ArrayWithUniqueItems: + type: array + uniqueItems: true + items: + type: string + ObjectWithMinProperties: + type: object + minProperties: 2 + ObjectWithMaxProperties: + type: object + maxProperties: 2 + StringWithMinLength: + type: string + minLength: 1 + DateWithMinLength: + type: string + format: date + minLength: 10 + DateTimeWithMinLength: + type: string + format: date-time + minLength: 20 + ByteWithMinLength: + type: string + format: byte + minLength: 10 + BinaryWithMinLength: + type: string + format: binary + minLength: 10 + StringWithMaxLength: + type: string + maxLength: 1 + DateWithMaxLength: + type: string + format: date + maxLength: 10 + DateTimeWithMaxLength: + type: string + format: date-time + maxLength: 20 + ByteWithMaxLength: + type: string + format: byte + maxLength: 10 + BinaryWithMaxLength: + type: string + format: binary + maxLength: 10 + IntegerWithMultipleOf: + type: integer + multipleOf: 2 + Integer32WithMultipleOf: + type: integer + format: int32 + multipleOf: 2 + Integer64WithMultipleOf: + type: integer + format: int64 + multipleOf: 2 + NumberWithMultipleOf: + type: number + multipleOf: 2 + NumberFloatWithMultipleOf: + type: number + format: float + multipleOf: 2 + NumberDoubleWithMultipleOf: + type: number + format: double + multipleOf: 2 + StringWithPattern: + type: string + pattern: '^2021.+' + DateWithPattern: + type: string + format: date + pattern: '^2021.+' + DateTimeWithPattern: + type: string + format: date-time + pattern: '^2021.+' + ByteWithPattern: + type: string + format: byte + pattern: '^2021.+' + BinaryWithPattern: + type: string + format: binary + pattern: '^2021.+' + IntegerWithMinimum: + type: integer + minimum: 1 + Integer32WithMinimum: + type: integer + format: int32 + minimum: 1 + Integer64WithMinimum: + type: integer + format: int364 + minimum: 1 + NumberWithMinimum: + type: number + minimum: 1 + NumberFloatWithMinimum: + type: number + format: float + minimum: 1 + NumberDoubleWithMinimum: + type: number + format: double + minimum: 1 + IntegerWithMaximum: + type: integer + maximum: 10 + Integer32WithMaximum: + type: integer + format: int32 + maximum: 10 + Integer64WithMaximum: + type: integer + format: int64 + maximum: 10 + NumberWithMaximum: + type: number + maximum: 10 + NumberFloatWithMaximum: + type: number + format: float + maximum: 10 + NumberDoubleWithMaximum: + type: number + format: double + maximum: 10 + IntegerWithExclusiveMinimum: + type: integer + minimum: 1 + exclusiveMinimum: true + Integer32WithExclusiveMinimum: + type: integer + format: int32 + minimum: 1 + exclusiveMinimum: true + Integer64WithExclusiveMinimum: + type: integer + format: int364 + minimum: 1 + exclusiveMinimum: true + NumberWithExclusiveMinimum: + type: number + minimum: 1 + exclusiveMinimum: true + NumberFloatWithExclusiveMinimum: + type: number + format: float + minimum: 1 + exclusiveMinimum: true + NumberDoubleWithExclusiveMinimum: + type: number + format: double + minimum: 1 + exclusiveMinimum: true + IntegerWithExclusiveMaximum: + type: integer + maximum: 10 + exclusiveMaximum: true + Integer32WithExclusiveMaximum: + type: integer + format: int32 + maximum: 10 + exclusiveMaximum: true + Integer64WithExclusiveMaximum: + type: integer + format: int64 + maximum: 10 + exclusiveMaximum: true + NumberWithExclusiveMaximum: + type: number + maximum: 10 + exclusiveMaximum: true + NumberFloatWithExclusiveMaximum: + type: number + format: float + maximum: 10 + exclusiveMaximum: true + NumberDoubleWithExclusiveMaximum: + type: number + format: double + maximum: 10 + exclusiveMaximum: true NullModel: type: 'null' ObjectWithTypeNullProperties: