forked from loafle/openapi-generator-original
[python-experimental] removes enum cls factory (#13491)
* Movs enum info, changes cls factory to base class + updates samples * Fixed docs for enums, they show the allowed bool and None values now
This commit is contained in:
parent
e146afbea1
commit
d25cdbb2ce
@ -55,6 +55,7 @@ import org.openapitools.codegen.api.TemplateProcessor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.file.Path;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
@ -1226,6 +1227,8 @@ public class PythonExperimentalClientCodegen extends AbstractPythonCodegen {
|
||||
// our enum var names are keys in a python dict, so change spaces to underscores
|
||||
if (value.length() == 0) {
|
||||
return "EMPTY";
|
||||
} else if (value.equals("null")) {
|
||||
return "NONE";
|
||||
}
|
||||
|
||||
String intPattern = "^[-\\+]?\\d+$";
|
||||
@ -1289,26 +1292,80 @@ public class PythonExperimentalClientCodegen extends AbstractPythonCodegen {
|
||||
return varName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the enum value in the language specified format
|
||||
* e.g. status becomes "status"
|
||||
*
|
||||
* @param value enum variable name
|
||||
* @param datatype data type
|
||||
* @return the sanitized value for enum
|
||||
*/
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
if ("int".equals(datatype) || "float".equals(datatype) || datatype.equals("int, float")) {
|
||||
return value;
|
||||
} else if ("bool".equals(datatype)) {
|
||||
if (value.equals("true")) {
|
||||
return "schemas.BoolClass.TRUE";
|
||||
}
|
||||
return "schemas.BoolClass.FALSE";
|
||||
} else {
|
||||
String fixedValue = (String) processTestExampleData(value);
|
||||
return ensureQuotes(fixedValue);
|
||||
protected List<Map<String, Object>> buildEnumVars(List<Object> values, String dataType) {
|
||||
List<Map<String, Object>> enumVars = new ArrayList<>();
|
||||
int truncateIdx = 0;
|
||||
|
||||
if (isRemoveEnumValuePrefix()) {
|
||||
String commonPrefix = findCommonPrefixOfVars(values);
|
||||
truncateIdx = commonPrefix.length();
|
||||
}
|
||||
|
||||
for (Object value : values) {
|
||||
Map<String, Object> enumVar = new HashMap<>();
|
||||
String enumName;
|
||||
if (truncateIdx == 0) {
|
||||
enumName = String.valueOf(value);
|
||||
} else {
|
||||
enumName = value.toString().substring(truncateIdx);
|
||||
if (enumName.isEmpty()) {
|
||||
enumName = value.toString();
|
||||
}
|
||||
}
|
||||
|
||||
enumVar.put("name", toEnumVarName(enumName, dataType));
|
||||
if (value instanceof Integer) {
|
||||
enumVar.put("value", value);
|
||||
} else if (value instanceof Double) {
|
||||
enumVar.put("value", value);
|
||||
} else if (value instanceof Long) {
|
||||
enumVar.put("value", value);
|
||||
} else if (value instanceof Float) {
|
||||
enumVar.put("value", value);
|
||||
} else if (value instanceof BigDecimal) {
|
||||
enumVar.put("value", value);
|
||||
} else if (value == null) {
|
||||
enumVar.put("value", "schemas.NoneClass.NONE");
|
||||
} else if (value instanceof Boolean) {
|
||||
if (value.equals(Boolean.TRUE)) {
|
||||
enumVar.put("value", "schemas.BoolClass.TRUE");
|
||||
} else {
|
||||
enumVar.put("value", "schemas.BoolClass.FALSE");
|
||||
}
|
||||
} else {
|
||||
String fixedValue = (String) processTestExampleData(value);
|
||||
enumVar.put("value", ensureQuotes(fixedValue));
|
||||
}
|
||||
enumVar.put("isString", isDataTypeString(dataType));
|
||||
enumVars.add(enumVar);
|
||||
}
|
||||
|
||||
if (enumUnknownDefaultCase) {
|
||||
// If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.
|
||||
// With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.
|
||||
Map<String, Object> enumVar = new HashMap<>();
|
||||
String enumName = enumUnknownDefaultCaseName;
|
||||
|
||||
String enumValue;
|
||||
if (isDataTypeString(dataType)) {
|
||||
enumValue = enumUnknownDefaultCaseName;
|
||||
} else {
|
||||
// This is a dummy value that attempts to avoid collisions with previously specified cases.
|
||||
// Int.max / 192
|
||||
// The number 192 that is used to calculate this random value, is the Swift Evolution proposal for frozen/non-frozen enums.
|
||||
// [SE-0192](https://github.com/apple/swift-evolution/blob/master/proposals/0192-non-exhaustive-enums.md)
|
||||
// Since this functionality was born in the Swift 5 generator and latter on broth to all generators
|
||||
// https://github.com/OpenAPITools/openapi-generator/pull/11013
|
||||
enumValue = String.valueOf(11184809);
|
||||
}
|
||||
|
||||
enumVar.put("name", toEnumVarName(enumName, dataType));
|
||||
enumVar.put("value", toEnumValue(enumValue, dataType));
|
||||
enumVar.put("isString", isDataTypeString(dataType));
|
||||
enumVars.add(enumVar);
|
||||
}
|
||||
|
||||
return enumVars;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,12 +0,0 @@
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
{{#if isNull}}
|
||||
schemas.NoneClass.NONE: "NONE",
|
||||
{{/if}}
|
||||
{{#with allowableValues}}
|
||||
{{#each enumVars}}
|
||||
{{{value}}}: "{{name}}",
|
||||
{{/each}}
|
||||
{{/with}}
|
||||
}
|
||||
),
|
@ -1,14 +1,20 @@
|
||||
{{#if isNull}}
|
||||
|
||||
@schemas.classproperty
|
||||
def NONE(cls):
|
||||
return cls(None)
|
||||
{{/if}}
|
||||
{{#with allowableValues}}
|
||||
{{#each enumVars}}
|
||||
|
||||
@schemas.classproperty
|
||||
def {{name}}(cls):
|
||||
{{#eq value "schemas.NoneClass.NONE"}}
|
||||
return cls(None)
|
||||
{{else}}
|
||||
{{#eq value "schemas.BoolClass.TRUE"}}
|
||||
return cls(True)
|
||||
{{else}}
|
||||
{{#eq value "schemas.BoolClass.FALSE"}}
|
||||
return cls(False)
|
||||
{{else}}
|
||||
return cls({{{value}}})
|
||||
{{/eq}}
|
||||
{{/eq}}
|
||||
{{/eq}}
|
||||
{{/each}}
|
||||
{{/with}}
|
@ -1 +1 @@
|
||||
{{#unless isArray}}{{#unless complexType}}{{#with allowableValues}}must be one of [{{#each enumVars}}{{{value}}}, {{/each}}] {{/with}}{{#if defaultValue}}{{#unless hasRequired}}if omitted the server will use the default value of {{{defaultValue}}}{{/unless}}{{/if}}{{#eq getFormat "uuid"}}value must be a uuid{{/eq}}{{#eq getFormat "date"}}value must conform to RFC-3339 full-date YYYY-MM-DD{{/eq}}{{#eq getFormat "date-time"}}value must conform to RFC-3339 date-time{{/eq}}{{#eq getFormat "number"}}value must be numeric and storable in decimal.Decimal{{/eq}}{{#eq getFormat "int32"}}value must be a 32 bit integer{{/eq}}{{#eq getFormat "int64"}}value must be a 64 bit integer{{/eq}}{{#eq getFormat "double"}}value must be a 64 bit float{{/eq}}{{#eq getFormat "float"}}value must be a 32 bit float{{/eq}}{{/unless}}{{/unless}}
|
||||
{{#unless isArray}}{{#unless complexType}}{{#with allowableValues}}must be one of [{{#each enumVars}}{{#eq value "schemas.NoneClass.NONE"}}None{{else}}{{#eq value "schemas.BoolClass.TRUE"}}True{{else}}{{#eq value "schemas.BoolClass.FALSE"}}False{{else}}{{{value}}}{{/eq}}{{/eq}}{{/eq}}, {{/each}}] {{/with}}{{#if defaultValue}}{{#unless hasRequired}}if omitted the server will use the default value of {{{defaultValue}}}{{/unless}}{{/if}}{{#eq getFormat "uuid"}}value must be a uuid{{/eq}}{{#eq getFormat "date"}}value must conform to RFC-3339 full-date YYYY-MM-DD{{/eq}}{{#eq getFormat "date-time"}}value must conform to RFC-3339 date-time{{/eq}}{{#eq getFormat "number"}}value must be numeric and storable in decimal.Decimal{{/eq}}{{#eq getFormat "int32"}}value must be a 32 bit integer{{/eq}}{{#eq getFormat "int64"}}value must be a 64 bit integer{{/eq}}{{#eq getFormat "double"}}value must be a 64 bit float{{/eq}}{{#eq getFormat "float"}}value must be a 32 bit float{{/eq}}{{/unless}}{{/unless}}
|
@ -15,7 +15,7 @@ class {{#if this.classname}}{{classname}}{{else}}{{#if nameInSnakeCase}}{{name}}
|
||||
schemas.ComposedBase,
|
||||
{{/if}}
|
||||
{{#if isEnum}}
|
||||
{{> model_templates/enum_value_to_name }}
|
||||
schemas.EnumBase,
|
||||
{{/if}}
|
||||
{{> model_templates/xbase_schema }}
|
||||
{{/if}}
|
||||
@ -31,13 +31,22 @@ class {{#if this.classname}}{{classname}}{{else}}{{#if nameInSnakeCase}}{{name}}
|
||||
{{/if}}
|
||||
"""
|
||||
{{/if}}
|
||||
{{#or hasValidation composedSchemas getItems additionalProperties getRequiredVarsMap getHasDiscriminatorWithNonEmptyMapping vars getFormat}}
|
||||
{{#or hasValidation composedSchemas getItems additionalProperties getRequiredVarsMap getHasDiscriminatorWithNonEmptyMapping vars getFormat isEnum}}
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
{{#if getFormat}}
|
||||
format = '{{getFormat}}'
|
||||
{{/if}}
|
||||
{{#if isEnum}}
|
||||
{{#with allowableValues}}
|
||||
enum_value_to_name = {
|
||||
{{#each enumVars}}
|
||||
{{{value}}}: "{{name}}",
|
||||
{{/each}}
|
||||
}
|
||||
{{/with}}
|
||||
{{/if}}
|
||||
{{#if getItems}}
|
||||
{{> model_templates/list_partial }}
|
||||
{{/if}}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
class {{#if this.classname}}{{classname}}{{else}}{{#if nameInSnakeCase}}{{name}}{{else}}{{baseName}}{{/if}}{{/if}}(
|
||||
{{#if isEnum}}
|
||||
{{> model_templates/enum_value_to_name }}
|
||||
schemas.EnumBase,
|
||||
{{/if}}
|
||||
{{> model_templates/xbase_schema }}
|
||||
):
|
||||
@ -18,12 +18,24 @@ class {{#if this.classname}}{{classname}}{{else}}{{#if nameInSnakeCase}}{{name}}
|
||||
"""
|
||||
{{/if}}
|
||||
{{#unless isStub}}
|
||||
{{#if hasValidation}}
|
||||
{{#or hasValidation isEnum getFormat}}
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
{{> model_templates/validations }}
|
||||
{{#if getFormat}}
|
||||
format = '{{getFormat}}'
|
||||
{{/if}}
|
||||
{{> model_templates/validations }}
|
||||
{{#if isEnum}}
|
||||
{{#with allowableValues}}
|
||||
enum_value_to_name = {
|
||||
{{#each enumVars}}
|
||||
{{{value}}}: "{{name}}",
|
||||
{{/each}}
|
||||
}
|
||||
{{/with}}
|
||||
{{/if}}
|
||||
{{/or}}
|
||||
{{/unless}}
|
||||
{{#if isEnum}}
|
||||
{{> model_templates/enums }}
|
||||
|
@ -404,7 +404,7 @@ class Schema:
|
||||
"""
|
||||
cls._process_schema_classes_oapg(schema_classes)
|
||||
enum_schema = any(
|
||||
hasattr(this_cls, '_enum_value_to_name') for this_cls in schema_classes)
|
||||
issubclass(this_cls, EnumBase) for this_cls in schema_classes)
|
||||
inheritable_primitive_type = schema_classes.intersection(cls.__inheritable_primitive_types_set)
|
||||
chosen_schema_classes = schema_classes - inheritable_primitive_type
|
||||
suffix = tuple(inheritable_primitive_type)
|
||||
@ -873,41 +873,22 @@ class ValidatorBase:
|
||||
)
|
||||
|
||||
|
||||
class EnumMakerBase:
|
||||
pass
|
||||
|
||||
|
||||
def SchemaEnumMakerClsFactory(enum_value_to_name: typing.Dict[typing.Union[str, decimal.Decimal, bool, none_type], str]) -> 'SchemaEnumMaker':
|
||||
class SchemaEnumMaker(EnumMakerBase):
|
||||
@classmethod
|
||||
def _enum_value_to_name(
|
||||
cls
|
||||
) -> typing.Dict[typing.Union[str, decimal.Decimal, bool, none_type], str]:
|
||||
pass
|
||||
try:
|
||||
super_enum_value_to_name = super()._enum_value_to_name()
|
||||
except AttributeError:
|
||||
return enum_value_to_name
|
||||
intersection = dict(enum_value_to_name.items() & super_enum_value_to_name.items())
|
||||
return intersection
|
||||
|
||||
@classmethod
|
||||
def _validate_oapg(
|
||||
cls,
|
||||
arg,
|
||||
validation_metadata: ValidationMetadata,
|
||||
) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]:
|
||||
"""
|
||||
SchemaEnumMaker _validate_oapg
|
||||
Validates that arg is in the enum's allowed values
|
||||
"""
|
||||
try:
|
||||
cls._enum_value_to_name()[arg]
|
||||
except KeyError:
|
||||
raise ApiValueError("Invalid value {} passed in to {}, {}".format(arg, cls, cls._enum_value_to_name()))
|
||||
return super()._validate_oapg(arg, validation_metadata=validation_metadata)
|
||||
|
||||
return SchemaEnumMaker
|
||||
class EnumBase:
|
||||
@classmethod
|
||||
def _validate_oapg(
|
||||
cls,
|
||||
arg,
|
||||
validation_metadata: ValidationMetadata,
|
||||
) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]:
|
||||
"""
|
||||
EnumBase _validate_oapg
|
||||
Validates that arg is in the enum's allowed values
|
||||
"""
|
||||
try:
|
||||
cls.MetaOapg.enum_value_to_name[arg]
|
||||
except KeyError:
|
||||
raise ApiValueError("Invalid value {} passed in to {}, allowed_values={}".format(arg, cls, cls.MetaOapg.enum_value_to_name.keys()))
|
||||
return super()._validate_oapg(arg, validation_metadata=validation_metadata)
|
||||
|
||||
|
||||
class BoolBase:
|
||||
|
@ -2224,6 +2224,7 @@ components:
|
||||
multiple
|
||||
lines
|
||||
- "double quote \n with newline"
|
||||
- null
|
||||
IntegerEnum:
|
||||
type: integer
|
||||
enum:
|
||||
|
@ -3,7 +3,7 @@
|
||||
## Model Type Info
|
||||
Input Type | Accessed Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
bool, | BoolClass, | | must be one of [schemas.BoolClass.FALSE, ]
|
||||
bool, | BoolClass, | | must be one of [False, ]
|
||||
|
||||
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
## Model Type Info
|
||||
Input Type | Accessed Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
bool, | BoolClass, | | must be one of [schemas.BoolClass.TRUE, ]
|
||||
bool, | BoolClass, | | must be one of [True, ]
|
||||
|
||||
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
|
||||
|
||||
|
@ -24,11 +24,7 @@ from unit_test_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class EnumWith0DoesNotMatchFalse(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
0: "POSITIVE_0",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.NumberSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -37,6 +33,12 @@ class EnumWith0DoesNotMatchFalse(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
0: "POSITIVE_0",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def POSITIVE_0(cls):
|
||||
return cls(0)
|
||||
|
@ -24,11 +24,7 @@ from unit_test_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class EnumWith0DoesNotMatchFalse(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
0: "POSITIVE_0",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.NumberSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
|
@ -24,11 +24,7 @@ from unit_test_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class EnumWith1DoesNotMatchTrue(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
1: "POSITIVE_1",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.NumberSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -37,6 +33,12 @@ class EnumWith1DoesNotMatchTrue(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
1: "POSITIVE_1",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def POSITIVE_1(cls):
|
||||
return cls(1)
|
||||
|
@ -24,11 +24,7 @@ from unit_test_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class EnumWith1DoesNotMatchTrue(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
1: "POSITIVE_1",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.NumberSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
|
@ -24,12 +24,7 @@ from unit_test_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class EnumWithEscapedCharacters(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"foo\nbar": "FOO_BAR",
|
||||
"foo\rbar": "FOO_BAR",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -38,6 +33,13 @@ class EnumWithEscapedCharacters(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"foo\nbar": "FOO_BAR",
|
||||
"foo\rbar": "FOO_BAR",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def FOO_BAR(cls):
|
||||
return cls("foo\nbar")
|
||||
|
@ -24,12 +24,7 @@ from unit_test_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class EnumWithEscapedCharacters(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"foo\nbar": "FOO_BAR",
|
||||
"foo\rbar": "FOO_BAR",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
|
@ -24,11 +24,7 @@ from unit_test_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class EnumWithFalseDoesNotMatch0(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.BoolClass.FALSE: "FALSE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.BoolSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -37,6 +33,12 @@ class EnumWithFalseDoesNotMatch0(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
schemas.BoolClass.FALSE: "FALSE",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def FALSE(cls):
|
||||
return cls(schemas.BoolClass.FALSE)
|
||||
return cls(False)
|
||||
|
@ -24,11 +24,7 @@ from unit_test_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class EnumWithFalseDoesNotMatch0(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.BoolClass.FALSE: "FALSE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.BoolSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -39,4 +35,4 @@ class EnumWithFalseDoesNotMatch0(
|
||||
|
||||
@schemas.classproperty
|
||||
def FALSE(cls):
|
||||
return cls(schemas.BoolClass.FALSE)
|
||||
return cls(False)
|
||||
|
@ -24,11 +24,7 @@ from unit_test_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class EnumWithTrueDoesNotMatch1(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.BoolClass.TRUE: "TRUE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.BoolSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -37,6 +33,12 @@ class EnumWithTrueDoesNotMatch1(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
schemas.BoolClass.TRUE: "TRUE",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def TRUE(cls):
|
||||
return cls(schemas.BoolClass.TRUE)
|
||||
return cls(True)
|
||||
|
@ -24,11 +24,7 @@ from unit_test_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class EnumWithTrueDoesNotMatch1(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.BoolClass.TRUE: "TRUE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.BoolSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -39,4 +35,4 @@ class EnumWithTrueDoesNotMatch1(
|
||||
|
||||
@schemas.classproperty
|
||||
def TRUE(cls):
|
||||
return cls(schemas.BoolClass.TRUE)
|
||||
return cls(True)
|
||||
|
@ -42,28 +42,32 @@ class EnumsInProperties(
|
||||
|
||||
|
||||
class bar(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"bar": "BAR",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"bar": "BAR",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def BAR(cls):
|
||||
return cls("bar")
|
||||
|
||||
|
||||
class foo(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"foo": "FOO",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"foo": "FOO",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def FOO(cls):
|
||||
return cls("foo")
|
||||
|
@ -42,11 +42,7 @@ class EnumsInProperties(
|
||||
|
||||
|
||||
class bar(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"bar": "BAR",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@ -56,11 +52,7 @@ class EnumsInProperties(
|
||||
|
||||
|
||||
class foo(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"foo": "FOO",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -24,11 +24,7 @@ from unit_test_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class NulCharactersInStrings(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"hello\x00there": "HELLOTHERE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -37,6 +33,12 @@ class NulCharactersInStrings(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"hello\x00there": "HELLOTHERE",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def HELLOTHERE(cls):
|
||||
return cls("hello\x00there")
|
||||
|
@ -24,11 +24,7 @@ from unit_test_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class NulCharactersInStrings(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"hello\x00there": "HELLOTHERE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
|
@ -24,13 +24,7 @@ from unit_test_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class SimpleEnumValidation(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
1: "POSITIVE_1",
|
||||
2: "POSITIVE_2",
|
||||
3: "POSITIVE_3",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.NumberSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -39,6 +33,14 @@ class SimpleEnumValidation(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
1: "POSITIVE_1",
|
||||
2: "POSITIVE_2",
|
||||
3: "POSITIVE_3",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def POSITIVE_1(cls):
|
||||
return cls(1)
|
||||
|
@ -24,13 +24,7 @@ from unit_test_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class SimpleEnumValidation(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
1: "POSITIVE_1",
|
||||
2: "POSITIVE_2",
|
||||
3: "POSITIVE_3",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.NumberSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
|
@ -411,7 +411,7 @@ class Schema:
|
||||
"""
|
||||
cls._process_schema_classes_oapg(schema_classes)
|
||||
enum_schema = any(
|
||||
hasattr(this_cls, '_enum_value_to_name') for this_cls in schema_classes)
|
||||
issubclass(this_cls, EnumBase) for this_cls in schema_classes)
|
||||
inheritable_primitive_type = schema_classes.intersection(cls.__inheritable_primitive_types_set)
|
||||
chosen_schema_classes = schema_classes - inheritable_primitive_type
|
||||
suffix = tuple(inheritable_primitive_type)
|
||||
@ -880,41 +880,22 @@ class ValidatorBase:
|
||||
)
|
||||
|
||||
|
||||
class EnumMakerBase:
|
||||
pass
|
||||
|
||||
|
||||
def SchemaEnumMakerClsFactory(enum_value_to_name: typing.Dict[typing.Union[str, decimal.Decimal, bool, none_type], str]) -> 'SchemaEnumMaker':
|
||||
class SchemaEnumMaker(EnumMakerBase):
|
||||
@classmethod
|
||||
def _enum_value_to_name(
|
||||
cls
|
||||
) -> typing.Dict[typing.Union[str, decimal.Decimal, bool, none_type], str]:
|
||||
pass
|
||||
try:
|
||||
super_enum_value_to_name = super()._enum_value_to_name()
|
||||
except AttributeError:
|
||||
return enum_value_to_name
|
||||
intersection = dict(enum_value_to_name.items() & super_enum_value_to_name.items())
|
||||
return intersection
|
||||
|
||||
@classmethod
|
||||
def _validate_oapg(
|
||||
cls,
|
||||
arg,
|
||||
validation_metadata: ValidationMetadata,
|
||||
) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]:
|
||||
"""
|
||||
SchemaEnumMaker _validate_oapg
|
||||
Validates that arg is in the enum's allowed values
|
||||
"""
|
||||
try:
|
||||
cls._enum_value_to_name()[arg]
|
||||
except KeyError:
|
||||
raise ApiValueError("Invalid value {} passed in to {}, {}".format(arg, cls, cls._enum_value_to_name()))
|
||||
return super()._validate_oapg(arg, validation_metadata=validation_metadata)
|
||||
|
||||
return SchemaEnumMaker
|
||||
class EnumBase:
|
||||
@classmethod
|
||||
def _validate_oapg(
|
||||
cls,
|
||||
arg,
|
||||
validation_metadata: ValidationMetadata,
|
||||
) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]:
|
||||
"""
|
||||
EnumBase _validate_oapg
|
||||
Validates that arg is in the enum's allowed values
|
||||
"""
|
||||
try:
|
||||
cls.MetaOapg.enum_value_to_name[arg]
|
||||
except KeyError:
|
||||
raise ApiValueError("Invalid value {} passed in to {}, allowed_values={}".format(arg, cls, cls.MetaOapg.enum_value_to_name.keys()))
|
||||
return super()._validate_oapg(arg, validation_metadata=validation_metadata)
|
||||
|
||||
|
||||
class BoolBase:
|
||||
|
@ -3,7 +3,7 @@
|
||||
## Model Type Info
|
||||
Input Type | Accessed Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
bool, | BoolClass, | | must be one of [schemas.BoolClass.TRUE, ]
|
||||
bool, | BoolClass, | | must be one of [True, ]
|
||||
|
||||
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
## Model Type Info
|
||||
Input Type | Accessed Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
None, str, | NoneClass, str, | | must be one of ["placed", "approved", "delivered", "single quoted", "multiple\nlines", "double quote \n with newline", ]
|
||||
None, str, | NoneClass, str, | | must be one of ["placed", "approved", "delivered", "single quoted", "multiple\nlines", "double quote \n with newline", None, ]
|
||||
|
||||
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
|
||||
|
||||
|
@ -43,6 +43,7 @@ class ArrayWithValidationsInItems(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'int64'
|
||||
inclusive_maximum = 7
|
||||
|
||||
def __new__(
|
||||
|
@ -42,14 +42,16 @@ class BasquePig(
|
||||
|
||||
|
||||
class className(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"BasquePig": "BASQUE_PIG",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"BasquePig": "BASQUE_PIG",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def BASQUE_PIG(cls):
|
||||
return cls("BasquePig")
|
||||
|
@ -42,11 +42,7 @@ class BasquePig(
|
||||
|
||||
|
||||
class className(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"BasquePig": "BASQUE_PIG",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -24,11 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class BooleanEnum(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.BoolClass.TRUE: "TRUE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.BoolSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -37,6 +33,12 @@ class BooleanEnum(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
schemas.BoolClass.TRUE: "TRUE",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def TRUE(cls):
|
||||
return cls(schemas.BoolClass.TRUE)
|
||||
return cls(True)
|
||||
|
@ -24,11 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class BooleanEnum(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.BoolClass.TRUE: "TRUE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.BoolSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -39,4 +35,4 @@ class BooleanEnum(
|
||||
|
||||
@schemas.classproperty
|
||||
def TRUE(cls):
|
||||
return cls(schemas.BoolClass.TRUE)
|
||||
return cls(True)
|
||||
|
@ -47,14 +47,16 @@ class ComplexQuadrilateral(
|
||||
|
||||
|
||||
class quadrilateralType(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"ComplexQuadrilateral": "COMPLEX_QUADRILATERAL",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"ComplexQuadrilateral": "COMPLEX_QUADRILATERAL",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def COMPLEX_QUADRILATERAL(cls):
|
||||
return cls("ComplexQuadrilateral")
|
||||
|
@ -47,11 +47,7 @@ class ComplexQuadrilateral(
|
||||
|
||||
|
||||
class quadrilateralType(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"ComplexQuadrilateral": "COMPLEX_QUADRILATERAL",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -94,6 +94,7 @@ class ComposedOneOfDifferentTypes(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'date-time'
|
||||
regex=[{
|
||||
'pattern': r'^2020.*', # noqa: E501
|
||||
}]
|
||||
|
@ -24,12 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class Currency(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"eur": "EUR",
|
||||
"usd": "USD",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -38,6 +33,13 @@ class Currency(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"eur": "EUR",
|
||||
"usd": "USD",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def EUR(cls):
|
||||
return cls("eur")
|
||||
|
@ -24,12 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class Currency(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"eur": "EUR",
|
||||
"usd": "USD",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
|
@ -42,14 +42,16 @@ class DanishPig(
|
||||
|
||||
|
||||
class className(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"DanishPig": "DANISH_PIG",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"DanishPig": "DANISH_PIG",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def DANISH_PIG(cls):
|
||||
return cls("DanishPig")
|
||||
|
@ -42,11 +42,7 @@ class DanishPig(
|
||||
|
||||
|
||||
class className(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"DanishPig": "DANISH_PIG",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -34,6 +34,7 @@ class DateTimeWithValidations(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'date-time'
|
||||
regex=[{
|
||||
'pattern': r'^2020.*', # noqa: E501
|
||||
}]
|
||||
|
@ -34,6 +34,7 @@ class DateWithValidations(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'date'
|
||||
regex=[{
|
||||
'pattern': r'^2020.*', # noqa: E501
|
||||
}]
|
||||
|
@ -39,14 +39,16 @@ class EnumArrays(
|
||||
|
||||
|
||||
class just_symbol(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
">=": "GREATER_THAN_EQUALS",
|
||||
"$": "DOLLAR",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def GREATER_THAN_EQUALS(cls):
|
||||
@ -66,14 +68,16 @@ class EnumArrays(
|
||||
|
||||
|
||||
class items(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"fish": "FISH",
|
||||
"crab": "CRAB",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def FISH(cls):
|
||||
|
@ -39,12 +39,7 @@ class EnumArrays(
|
||||
|
||||
|
||||
class just_symbol(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
">=": "GREATER_THAN_EQUALS",
|
||||
"$": "DOLLAR",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@ -66,12 +61,7 @@ class EnumArrays(
|
||||
|
||||
|
||||
class items(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"fish": "FISH",
|
||||
"crab": "CRAB",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -24,15 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class EnumClass(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"_abc": "_ABC",
|
||||
"-efg": "EFG",
|
||||
"(xyz)": "XYZ",
|
||||
"COUNT_1M": "COUNT_1M",
|
||||
"COUNT_50M": "COUNT_50M",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -41,6 +33,16 @@ class EnumClass(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"_abc": "_ABC",
|
||||
"-efg": "EFG",
|
||||
"(xyz)": "XYZ",
|
||||
"COUNT_1M": "COUNT_1M",
|
||||
"COUNT_50M": "COUNT_50M",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def _ABC(cls):
|
||||
return cls("_abc")
|
||||
|
@ -24,15 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class EnumClass(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"_abc": "_ABC",
|
||||
"-efg": "EFG",
|
||||
"(xyz)": "XYZ",
|
||||
"COUNT_1M": "COUNT_1M",
|
||||
"COUNT_50M": "COUNT_50M",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
|
@ -42,15 +42,17 @@ class EnumTest(
|
||||
|
||||
|
||||
class enum_string_required(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"UPPER": "UPPER",
|
||||
"lower": "LOWER",
|
||||
"": "EMPTY",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def UPPER(cls):
|
||||
@ -66,15 +68,17 @@ class EnumTest(
|
||||
|
||||
|
||||
class enum_string(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"UPPER": "UPPER",
|
||||
"lower": "LOWER",
|
||||
"": "EMPTY",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def UPPER(cls):
|
||||
@ -90,14 +94,17 @@ class EnumTest(
|
||||
|
||||
|
||||
class enum_integer(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.Int32Schema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'int32'
|
||||
enum_value_to_name = {
|
||||
1: "POSITIVE_1",
|
||||
-1: "NEGATIVE_1",
|
||||
}
|
||||
),
|
||||
schemas.Int32Schema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def POSITIVE_1(cls):
|
||||
@ -109,14 +116,17 @@ class EnumTest(
|
||||
|
||||
|
||||
class enum_number(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.Float64Schema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'double'
|
||||
enum_value_to_name = {
|
||||
1.1: "POSITIVE_1_PT_1",
|
||||
-1.2: "NEGATIVE_1_PT_2",
|
||||
}
|
||||
),
|
||||
schemas.Float64Schema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def POSITIVE_1_PT_1(cls):
|
||||
|
@ -42,13 +42,7 @@ class EnumTest(
|
||||
|
||||
|
||||
class enum_string_required(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"UPPER": "UPPER",
|
||||
"lower": "LOWER",
|
||||
"": "EMPTY",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@ -66,13 +60,7 @@ class EnumTest(
|
||||
|
||||
|
||||
class enum_string(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"UPPER": "UPPER",
|
||||
"lower": "LOWER",
|
||||
"": "EMPTY",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@ -90,12 +78,7 @@ class EnumTest(
|
||||
|
||||
|
||||
class enum_integer(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
1: "POSITIVE_1",
|
||||
-1: "NEGATIVE_1",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.Int32Schema
|
||||
):
|
||||
|
||||
@ -109,12 +92,7 @@ class EnumTest(
|
||||
|
||||
|
||||
class enum_number(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
1.1: "POSITIVE_1_PT_1",
|
||||
-1.2: "NEGATIVE_1_PT_2",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.Float64Schema
|
||||
):
|
||||
|
||||
|
@ -47,14 +47,16 @@ class EquilateralTriangle(
|
||||
|
||||
|
||||
class triangleType(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"EquilateralTriangle": "EQUILATERAL_TRIANGLE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"EquilateralTriangle": "EQUILATERAL_TRIANGLE",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def EQUILATERAL_TRIANGLE(cls):
|
||||
return cls("EquilateralTriangle")
|
||||
|
@ -47,11 +47,7 @@ class EquilateralTriangle(
|
||||
|
||||
|
||||
class triangleType(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"EquilateralTriangle": "EQUILATERAL_TRIANGLE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -63,6 +63,7 @@ class FormatTest(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'password'
|
||||
max_length = 64
|
||||
min_length = 10
|
||||
|
||||
@ -85,6 +86,7 @@ class FormatTest(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'int32'
|
||||
inclusive_maximum = 200
|
||||
inclusive_minimum = 20
|
||||
int64 = schemas.Int64Schema
|
||||
@ -96,6 +98,7 @@ class FormatTest(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'float'
|
||||
inclusive_maximum = 987.6
|
||||
inclusive_minimum = 54.3
|
||||
float32 = schemas.Float32Schema
|
||||
@ -107,6 +110,7 @@ class FormatTest(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'double'
|
||||
inclusive_maximum = 123.4
|
||||
inclusive_minimum = 67.8
|
||||
float64 = schemas.Float64Schema
|
||||
|
@ -24,13 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class IntegerEnum(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
0: "POSITIVE_0",
|
||||
1: "POSITIVE_1",
|
||||
2: "POSITIVE_2",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.IntSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -39,6 +33,14 @@ class IntegerEnum(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
0: "POSITIVE_0",
|
||||
1: "POSITIVE_1",
|
||||
2: "POSITIVE_2",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def POSITIVE_0(cls):
|
||||
return cls(0)
|
||||
|
@ -24,13 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class IntegerEnum(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
0: "POSITIVE_0",
|
||||
1: "POSITIVE_1",
|
||||
2: "POSITIVE_2",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.IntSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
|
@ -24,13 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class IntegerEnumBig(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
10: "POSITIVE_10",
|
||||
11: "POSITIVE_11",
|
||||
12: "POSITIVE_12",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.IntSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -39,6 +33,14 @@ class IntegerEnumBig(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
10: "POSITIVE_10",
|
||||
11: "POSITIVE_11",
|
||||
12: "POSITIVE_12",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def POSITIVE_10(cls):
|
||||
return cls(10)
|
||||
|
@ -24,13 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class IntegerEnumBig(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
10: "POSITIVE_10",
|
||||
11: "POSITIVE_11",
|
||||
12: "POSITIVE_12",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.IntSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
|
@ -24,11 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class IntegerEnumOneValue(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
0: "POSITIVE_0",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.IntSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -37,6 +33,12 @@ class IntegerEnumOneValue(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
0: "POSITIVE_0",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def POSITIVE_0(cls):
|
||||
return cls(0)
|
||||
|
@ -24,11 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class IntegerEnumOneValue(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
0: "POSITIVE_0",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.IntSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
|
@ -24,13 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class IntegerEnumWithDefaultValue(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
0: "POSITIVE_0",
|
||||
1: "POSITIVE_1",
|
||||
2: "POSITIVE_2",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.IntSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -39,6 +33,14 @@ class IntegerEnumWithDefaultValue(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
0: "POSITIVE_0",
|
||||
1: "POSITIVE_1",
|
||||
2: "POSITIVE_2",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def POSITIVE_0(cls):
|
||||
return cls(0)
|
||||
|
@ -24,13 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class IntegerEnumWithDefaultValue(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
0: "POSITIVE_0",
|
||||
1: "POSITIVE_1",
|
||||
2: "POSITIVE_2",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.IntSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
|
@ -34,4 +34,5 @@ class IntegerMax10(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'int64'
|
||||
inclusive_maximum = 10
|
||||
|
@ -34,4 +34,5 @@ class IntegerMin15(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'int64'
|
||||
inclusive_minimum = 15
|
||||
|
@ -47,14 +47,16 @@ class IsoscelesTriangle(
|
||||
|
||||
|
||||
class triangleType(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"IsoscelesTriangle": "ISOSCELES_TRIANGLE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"IsoscelesTriangle": "ISOSCELES_TRIANGLE",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def ISOSCELES_TRIANGLE(cls):
|
||||
return cls("IsoscelesTriangle")
|
||||
|
@ -47,11 +47,7 @@ class IsoscelesTriangle(
|
||||
|
||||
|
||||
class triangleType(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"IsoscelesTriangle": "ISOSCELES_TRIANGLE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -46,15 +46,17 @@ class JSONPatchRequestAddReplaceTest(
|
||||
|
||||
|
||||
class op(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"add": "ADD",
|
||||
"replace": "REPLACE",
|
||||
"test": "TEST",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def ADD(cls):
|
||||
|
@ -46,13 +46,7 @@ class JSONPatchRequestAddReplaceTest(
|
||||
|
||||
|
||||
class op(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"add": "ADD",
|
||||
"replace": "REPLACE",
|
||||
"test": "TEST",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -46,14 +46,16 @@ class JSONPatchRequestMoveCopy(
|
||||
|
||||
|
||||
class op(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"move": "MOVE",
|
||||
"copy": "COPY",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def MOVE(cls):
|
||||
|
@ -46,12 +46,7 @@ class JSONPatchRequestMoveCopy(
|
||||
|
||||
|
||||
class op(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"move": "MOVE",
|
||||
"copy": "COPY",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -44,14 +44,16 @@ class JSONPatchRequestRemove(
|
||||
|
||||
|
||||
class op(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"remove": "REMOVE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"remove": "REMOVE",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def REMOVE(cls):
|
||||
return cls("remove")
|
||||
|
@ -44,11 +44,7 @@ class JSONPatchRequestRemove(
|
||||
|
||||
|
||||
class op(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"remove": "REMOVE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -104,14 +104,16 @@ class MapTest(
|
||||
|
||||
|
||||
class additional_properties(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"UPPER": "UPPER",
|
||||
"lower": "LOWER",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def UPPER(cls):
|
||||
|
@ -104,12 +104,7 @@ class MapTest(
|
||||
|
||||
|
||||
class additional_properties(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"UPPER": "UPPER",
|
||||
"lower": "LOWER",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -43,15 +43,17 @@ class Order(
|
||||
|
||||
|
||||
class status(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"placed": "PLACED",
|
||||
"approved": "APPROVED",
|
||||
"delivered": "DELIVERED",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def PLACED(cls):
|
||||
|
@ -43,13 +43,7 @@ class Order(
|
||||
|
||||
|
||||
class status(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"placed": "PLACED",
|
||||
"approved": "APPROVED",
|
||||
"delivered": "DELIVERED",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -100,15 +100,17 @@ class Pet(
|
||||
|
||||
|
||||
class status(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"available": "AVAILABLE",
|
||||
"pending": "PENDING",
|
||||
"sold": "SOLD",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def AVAILABLE(cls):
|
||||
|
@ -100,13 +100,7 @@ class Pet(
|
||||
|
||||
|
||||
class status(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"available": "AVAILABLE",
|
||||
"pending": "PENDING",
|
||||
"sold": "SOLD",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -43,14 +43,16 @@ class QuadrilateralInterface(
|
||||
|
||||
|
||||
class shapeType(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"Quadrilateral": "QUADRILATERAL",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"Quadrilateral": "QUADRILATERAL",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def QUADRILATERAL(cls):
|
||||
return cls("Quadrilateral")
|
||||
|
@ -43,11 +43,7 @@ class QuadrilateralInterface(
|
||||
|
||||
|
||||
class shapeType(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"Quadrilateral": "QUADRILATERAL",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -47,14 +47,16 @@ class ScaleneTriangle(
|
||||
|
||||
|
||||
class triangleType(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"ScaleneTriangle": "SCALENE_TRIANGLE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"ScaleneTriangle": "SCALENE_TRIANGLE",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def SCALENE_TRIANGLE(cls):
|
||||
return cls("ScaleneTriangle")
|
||||
|
@ -47,11 +47,7 @@ class ScaleneTriangle(
|
||||
|
||||
|
||||
class triangleType(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"ScaleneTriangle": "SCALENE_TRIANGLE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -47,14 +47,16 @@ class SimpleQuadrilateral(
|
||||
|
||||
|
||||
class quadrilateralType(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"SimpleQuadrilateral": "SIMPLE_QUADRILATERAL",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"SimpleQuadrilateral": "SIMPLE_QUADRILATERAL",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def SIMPLE_QUADRILATERAL(cls):
|
||||
return cls("SimpleQuadrilateral")
|
||||
|
@ -47,11 +47,7 @@ class SimpleQuadrilateral(
|
||||
|
||||
|
||||
class quadrilateralType(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"SimpleQuadrilateral": "SIMPLE_QUADRILATERAL",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -24,17 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class StringEnum(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.NoneClass.NONE: "NONE",
|
||||
"placed": "PLACED",
|
||||
"approved": "APPROVED",
|
||||
"delivered": "DELIVERED",
|
||||
"single quoted": "SINGLE_QUOTED",
|
||||
"multiple\nlines": "MULTIPLE_LINES",
|
||||
"double quote \n with newline": "DOUBLE_QUOTE_WITH_NEWLINE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrBase,
|
||||
schemas.NoneBase,
|
||||
schemas.Schema,
|
||||
@ -46,9 +36,17 @@ class StringEnum(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@schemas.classproperty
|
||||
def NONE(cls):
|
||||
return cls(None)
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"placed": "PLACED",
|
||||
"approved": "APPROVED",
|
||||
"delivered": "DELIVERED",
|
||||
"single quoted": "SINGLE_QUOTED",
|
||||
"multiple\nlines": "MULTIPLE_LINES",
|
||||
"double quote \n with newline": "DOUBLE_QUOTE_WITH_NEWLINE",
|
||||
schemas.NoneClass.NONE: "NONE",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def PLACED(cls):
|
||||
@ -74,6 +72,10 @@ class StringEnum(
|
||||
def DOUBLE_QUOTE_WITH_NEWLINE(cls):
|
||||
return cls("double quote \n with newline")
|
||||
|
||||
@schemas.classproperty
|
||||
def NONE(cls):
|
||||
return cls(None)
|
||||
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -24,17 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class StringEnum(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.NoneClass.NONE: "NONE",
|
||||
"placed": "PLACED",
|
||||
"approved": "APPROVED",
|
||||
"delivered": "DELIVERED",
|
||||
"single quoted": "SINGLE_QUOTED",
|
||||
"multiple\nlines": "MULTIPLE_LINES",
|
||||
"double quote \n with newline": "DOUBLE_QUOTE_WITH_NEWLINE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrBase,
|
||||
schemas.NoneBase,
|
||||
schemas.Schema,
|
||||
@ -46,9 +36,17 @@ class StringEnum(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
@schemas.classproperty
|
||||
def NONE(cls):
|
||||
return cls(None)
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"placed": "PLACED",
|
||||
"approved": "APPROVED",
|
||||
"delivered": "DELIVERED",
|
||||
"single quoted": "SINGLE_QUOTED",
|
||||
"multiple\nlines": "MULTIPLE_LINES",
|
||||
"double quote \n with newline": "DOUBLE_QUOTE_WITH_NEWLINE",
|
||||
schemas.NoneClass.NONE: "NONE",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def PLACED(cls):
|
||||
@ -74,6 +72,10 @@ class StringEnum(
|
||||
def DOUBLE_QUOTE_WITH_NEWLINE(cls):
|
||||
return cls("double quote \n with newline")
|
||||
|
||||
@schemas.classproperty
|
||||
def NONE(cls):
|
||||
return cls(None)
|
||||
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
|
@ -24,13 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class StringEnumWithDefaultValue(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"placed": "PLACED",
|
||||
"approved": "APPROVED",
|
||||
"delivered": "DELIVERED",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
@ -39,6 +33,14 @@ class StringEnumWithDefaultValue(
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"placed": "PLACED",
|
||||
"approved": "APPROVED",
|
||||
"delivered": "DELIVERED",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def PLACED(cls):
|
||||
return cls("placed")
|
||||
|
@ -24,13 +24,7 @@ from petstore_api import schemas # noqa: F401
|
||||
|
||||
|
||||
class StringEnumWithDefaultValue(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"placed": "PLACED",
|
||||
"approved": "APPROVED",
|
||||
"delivered": "DELIVERED",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
||||
|
@ -43,14 +43,16 @@ class TriangleInterface(
|
||||
|
||||
|
||||
class shapeType(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"Triangle": "TRIANGLE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"Triangle": "TRIANGLE",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def TRIANGLE(cls):
|
||||
return cls("Triangle")
|
||||
|
@ -43,11 +43,7 @@ class TriangleInterface(
|
||||
|
||||
|
||||
class shapeType(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"Triangle": "TRIANGLE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -34,4 +34,5 @@ class UUIDString(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'uuid'
|
||||
min_length = 1
|
||||
|
@ -42,14 +42,16 @@ class Whale(
|
||||
|
||||
|
||||
class className(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"whale": "WHALE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"whale": "WHALE",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def WHALE(cls):
|
||||
return cls("whale")
|
||||
|
@ -42,11 +42,7 @@ class Whale(
|
||||
|
||||
|
||||
class className(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"whale": "WHALE",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -42,29 +42,33 @@ class Zebra(
|
||||
|
||||
|
||||
class className(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"zebra": "ZEBRA",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"zebra": "ZEBRA",
|
||||
}
|
||||
|
||||
@schemas.classproperty
|
||||
def ZEBRA(cls):
|
||||
return cls("zebra")
|
||||
|
||||
|
||||
class type(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"plains": "PLAINS",
|
||||
"mountain": "MOUNTAIN",
|
||||
"grevys": "GREVYS",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def PLAINS(cls):
|
||||
|
@ -42,11 +42,7 @@ class Zebra(
|
||||
|
||||
|
||||
class className(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"zebra": "ZEBRA",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@ -56,13 +52,7 @@ class Zebra(
|
||||
|
||||
|
||||
class type(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"plains": "PLAINS",
|
||||
"mountain": "MOUNTAIN",
|
||||
"grevys": "GREVYS",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -39,14 +39,16 @@ class EnumQueryStringArraySchema(
|
||||
|
||||
|
||||
class items(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
">": "GREATER_THAN",
|
||||
"$": "DOLLAR",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def GREATER_THAN(cls):
|
||||
@ -72,15 +74,17 @@ class EnumQueryStringArraySchema(
|
||||
|
||||
|
||||
class EnumQueryStringSchema(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"_abc": "_ABC",
|
||||
"-efg": "EFG",
|
||||
"(xyz)": "XYZ",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def _ABC(cls):
|
||||
@ -96,14 +100,17 @@ class EnumQueryStringSchema(
|
||||
|
||||
|
||||
class EnumQueryIntegerSchema(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.Int32Schema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'int32'
|
||||
enum_value_to_name = {
|
||||
1: "POSITIVE_1",
|
||||
-2: "NEGATIVE_2",
|
||||
}
|
||||
),
|
||||
schemas.Int32Schema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def POSITIVE_1(cls):
|
||||
@ -115,14 +122,17 @@ class EnumQueryIntegerSchema(
|
||||
|
||||
|
||||
class EnumQueryDoubleSchema(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.Float64Schema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'double'
|
||||
enum_value_to_name = {
|
||||
1.1: "POSITIVE_1_PT_1",
|
||||
-1.2: "NEGATIVE_1_PT_2",
|
||||
}
|
||||
),
|
||||
schemas.Float64Schema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def POSITIVE_1_PT_1(cls):
|
||||
@ -188,14 +198,16 @@ class EnumHeaderStringArraySchema(
|
||||
|
||||
|
||||
class items(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
">": "GREATER_THAN",
|
||||
"$": "DOLLAR",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def GREATER_THAN(cls):
|
||||
@ -221,15 +233,17 @@ class EnumHeaderStringArraySchema(
|
||||
|
||||
|
||||
class EnumHeaderStringSchema(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"_abc": "_ABC",
|
||||
"-efg": "EFG",
|
||||
"(xyz)": "XYZ",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def _ABC(cls):
|
||||
@ -293,14 +307,16 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded(
|
||||
|
||||
|
||||
class items(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
">": "GREATER_THAN",
|
||||
"$": "DOLLAR",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def GREATER_THAN(cls):
|
||||
@ -326,15 +342,17 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded(
|
||||
|
||||
|
||||
class enum_form_string(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"_abc": "_ABC",
|
||||
"-efg": "EFG",
|
||||
"(xyz)": "XYZ",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def _ABC(cls):
|
||||
|
@ -37,12 +37,7 @@ class EnumQueryStringArraySchema(
|
||||
|
||||
|
||||
class items(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
">": "GREATER_THAN",
|
||||
"$": "DOLLAR",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@ -70,13 +65,7 @@ class EnumQueryStringArraySchema(
|
||||
|
||||
|
||||
class EnumQueryStringSchema(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"_abc": "_ABC",
|
||||
"-efg": "EFG",
|
||||
"(xyz)": "XYZ",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@ -94,12 +83,7 @@ class EnumQueryStringSchema(
|
||||
|
||||
|
||||
class EnumQueryIntegerSchema(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
1: "POSITIVE_1",
|
||||
-2: "NEGATIVE_2",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.Int32Schema
|
||||
):
|
||||
|
||||
@ -113,12 +97,7 @@ class EnumQueryIntegerSchema(
|
||||
|
||||
|
||||
class EnumQueryDoubleSchema(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
1.1: "POSITIVE_1_PT_1",
|
||||
-1.2: "NEGATIVE_1_PT_2",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.Float64Schema
|
||||
):
|
||||
|
||||
@ -141,12 +120,7 @@ class EnumHeaderStringArraySchema(
|
||||
|
||||
|
||||
class items(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
">": "GREATER_THAN",
|
||||
"$": "DOLLAR",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@ -174,13 +148,7 @@ class EnumHeaderStringArraySchema(
|
||||
|
||||
|
||||
class EnumHeaderStringSchema(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"_abc": "_ABC",
|
||||
"-efg": "EFG",
|
||||
"(xyz)": "XYZ",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@ -217,12 +185,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded(
|
||||
|
||||
|
||||
class items(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
">": "GREATER_THAN",
|
||||
"$": "DOLLAR",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@ -250,13 +213,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded(
|
||||
|
||||
|
||||
class enum_form_string(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"_abc": "_ABC",
|
||||
"-efg": "EFG",
|
||||
"(xyz)": "XYZ",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -62,6 +62,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'int32'
|
||||
inclusive_maximum = 200
|
||||
inclusive_minimum = 20
|
||||
int64 = schemas.Int64Schema
|
||||
@ -83,6 +84,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'float'
|
||||
inclusive_maximum = 987.6
|
||||
|
||||
|
||||
@ -92,6 +94,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'double'
|
||||
inclusive_maximum = 123.4
|
||||
inclusive_minimum = 67.8
|
||||
|
||||
@ -131,6 +134,7 @@ class SchemaForRequestBodyApplicationXWwwFormUrlencoded(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'password'
|
||||
max_length = 64
|
||||
min_length = 10
|
||||
callback = schemas.StrSchema
|
||||
|
@ -41,15 +41,17 @@ class StatusSchema(
|
||||
|
||||
|
||||
class items(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
enum_value_to_name = {
|
||||
"available": "AVAILABLE",
|
||||
"pending": "PENDING",
|
||||
"sold": "SOLD",
|
||||
}
|
||||
),
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
@schemas.classproperty
|
||||
def AVAILABLE(cls):
|
||||
|
@ -39,13 +39,7 @@ class StatusSchema(
|
||||
|
||||
|
||||
class items(
|
||||
schemas.SchemaEnumMakerClsFactory(
|
||||
enum_value_to_name={
|
||||
"available": "AVAILABLE",
|
||||
"pending": "PENDING",
|
||||
"sold": "SOLD",
|
||||
}
|
||||
),
|
||||
schemas.EnumBase,
|
||||
schemas.StrSchema
|
||||
):
|
||||
|
||||
|
@ -38,6 +38,7 @@ class OrderIdSchema(
|
||||
|
||||
|
||||
class MetaOapg:
|
||||
format = 'int64'
|
||||
inclusive_maximum = 5
|
||||
inclusive_minimum = 1
|
||||
RequestRequiredPathParams = typing_extensions.TypedDict(
|
||||
|
@ -411,7 +411,7 @@ class Schema:
|
||||
"""
|
||||
cls._process_schema_classes_oapg(schema_classes)
|
||||
enum_schema = any(
|
||||
hasattr(this_cls, '_enum_value_to_name') for this_cls in schema_classes)
|
||||
issubclass(this_cls, EnumBase) for this_cls in schema_classes)
|
||||
inheritable_primitive_type = schema_classes.intersection(cls.__inheritable_primitive_types_set)
|
||||
chosen_schema_classes = schema_classes - inheritable_primitive_type
|
||||
suffix = tuple(inheritable_primitive_type)
|
||||
@ -880,41 +880,22 @@ class ValidatorBase:
|
||||
)
|
||||
|
||||
|
||||
class EnumMakerBase:
|
||||
pass
|
||||
|
||||
|
||||
def SchemaEnumMakerClsFactory(enum_value_to_name: typing.Dict[typing.Union[str, decimal.Decimal, bool, none_type], str]) -> 'SchemaEnumMaker':
|
||||
class SchemaEnumMaker(EnumMakerBase):
|
||||
@classmethod
|
||||
def _enum_value_to_name(
|
||||
cls
|
||||
) -> typing.Dict[typing.Union[str, decimal.Decimal, bool, none_type], str]:
|
||||
pass
|
||||
try:
|
||||
super_enum_value_to_name = super()._enum_value_to_name()
|
||||
except AttributeError:
|
||||
return enum_value_to_name
|
||||
intersection = dict(enum_value_to_name.items() & super_enum_value_to_name.items())
|
||||
return intersection
|
||||
|
||||
@classmethod
|
||||
def _validate_oapg(
|
||||
cls,
|
||||
arg,
|
||||
validation_metadata: ValidationMetadata,
|
||||
) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]:
|
||||
"""
|
||||
SchemaEnumMaker _validate_oapg
|
||||
Validates that arg is in the enum's allowed values
|
||||
"""
|
||||
try:
|
||||
cls._enum_value_to_name()[arg]
|
||||
except KeyError:
|
||||
raise ApiValueError("Invalid value {} passed in to {}, {}".format(arg, cls, cls._enum_value_to_name()))
|
||||
return super()._validate_oapg(arg, validation_metadata=validation_metadata)
|
||||
|
||||
return SchemaEnumMaker
|
||||
class EnumBase:
|
||||
@classmethod
|
||||
def _validate_oapg(
|
||||
cls,
|
||||
arg,
|
||||
validation_metadata: ValidationMetadata,
|
||||
) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]:
|
||||
"""
|
||||
EnumBase _validate_oapg
|
||||
Validates that arg is in the enum's allowed values
|
||||
"""
|
||||
try:
|
||||
cls.MetaOapg.enum_value_to_name[arg]
|
||||
except KeyError:
|
||||
raise ApiValueError("Invalid value {} passed in to {}, allowed_values={}".format(arg, cls, cls.MetaOapg.enum_value_to_name.keys()))
|
||||
return super()._validate_oapg(arg, validation_metadata=validation_metadata)
|
||||
|
||||
|
||||
class BoolBase:
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user