mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-28 20:40:52 +00:00
[python-nextgen] Various fixes reported by pylint (#15309)
* various pylint fixes * rearrange test * Revert "rearrange test" This reverts commit 24d777a8a87161b6fc36527f6c1a06c03216bb64.
This commit is contained in:
parent
6f24ad3625
commit
b8ccd25a79
@ -64,7 +64,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
|
||||
error_messages.append(str(e))
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
if type(v) is not {{{dataType}}}:
|
||||
if not isinstance(v, {{{dataType}}}):
|
||||
error_messages.append(f"Error! Input type `{type(v)}` is not `{{{dataType}}}`")
|
||||
else:
|
||||
return v
|
||||
|
@ -1,5 +1,4 @@
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,53 +30,56 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
|
||||
{{#vendorExtensions.x-regex}}
|
||||
|
||||
@validator('{{{name}}}')
|
||||
def {{{name}}}_validate_regular_expression(cls, v):
|
||||
def {{{name}}}_validate_regular_expression(cls, value):
|
||||
"""Validates the regular expression"""
|
||||
{{^required}}
|
||||
if v is None:
|
||||
return v
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
{{/required}}
|
||||
{{#required}}
|
||||
{{#isNullable}}
|
||||
if v is None:
|
||||
if value is None:
|
||||
return v
|
||||
|
||||
{{/isNullable}}
|
||||
{{/required}}
|
||||
if not re.match(r"{{{.}}}", v{{#vendorExtensions.x-modifiers}} ,re.{{{.}}}{{/vendorExtensions.x-modifiers}}):
|
||||
if not re.match(r"{{{.}}}", value{{#vendorExtensions.x-modifiers}} ,re.{{{.}}}{{/vendorExtensions.x-modifiers}}):
|
||||
raise ValueError(r"must validate the regular expression {{{vendorExtensions.x-pattern}}}")
|
||||
return v
|
||||
return value
|
||||
{{/vendorExtensions.x-regex}}
|
||||
{{#isEnum}}
|
||||
|
||||
@validator('{{{name}}}')
|
||||
def {{{name}}}_validate_enum(cls, v):
|
||||
def {{{name}}}_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
{{^required}}
|
||||
if v is None:
|
||||
return v
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
{{/required}}
|
||||
{{#required}}
|
||||
{{#isNullable}}
|
||||
if v is None:
|
||||
return v
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
{{/isNullable}}
|
||||
{{/required}}
|
||||
{{#isArray}}
|
||||
for i in v:
|
||||
for i in value:
|
||||
if i not in ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}):
|
||||
raise ValueError("each list item must be one of ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}})")
|
||||
{{/isArray}}
|
||||
{{^isArray}}
|
||||
if v not in ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}):
|
||||
if value not in ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}):
|
||||
raise ValueError("must be one of enum values ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}})")
|
||||
{{/isArray}}
|
||||
return v
|
||||
return value
|
||||
{{/isEnum}}
|
||||
{{/vars}}
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -210,7 +212,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return {{{classname}}}.parse_obj(obj)
|
||||
|
||||
{{#disallowAdditionalPropertiesIfNotPresent}}
|
||||
|
@ -64,7 +64,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
|
||||
error_messages.append(str(e))
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
if type(v) is not {{{dataType}}}:
|
||||
if not isinstance(v, {{{dataType}}}):
|
||||
error_messages.append(f"Error! Input type `{type(v)}` is not `{{{dataType}}}`")
|
||||
else:
|
||||
match += 1
|
||||
|
@ -23,7 +23,7 @@ tornado = ">=4.2,<5"
|
||||
pem = ">= 19.3.0"
|
||||
pycryptodome = ">= 3.9.0"
|
||||
{{/hasHttpSignatureMethods}}
|
||||
pydantic = "^1.10.5"
|
||||
pydantic = "^1.10.5, <2"
|
||||
aenum = ">=3.1.11"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
@ -35,3 +35,5 @@ flake8 = ">=4.0.0"
|
||||
requires = ["setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.pylint.'MESSAGES CONTROL']
|
||||
extension-pkg-whitelist = "pydantic"
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class Bird(BaseModel):
|
||||
__properties = ["size", "color"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -62,7 +62,7 @@ class Bird(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Bird.parse_obj(obj)
|
||||
|
||||
_obj = Bird.parse_obj({
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class Category(BaseModel):
|
||||
__properties = ["id", "name"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -62,7 +62,7 @@ class Category(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Category.parse_obj(obj)
|
||||
|
||||
_obj = Category.parse_obj({
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -34,6 +33,7 @@ class DataQuery(Query):
|
||||
__properties = ["suffix", "text", "date", "id", "outcomes"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -64,7 +64,7 @@ class DataQuery(Query):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return DataQuery.parse_obj(obj)
|
||||
|
||||
_obj = DataQuery.parse_obj({
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -33,6 +32,7 @@ class DataQueryAllOf(BaseModel):
|
||||
__properties = ["suffix", "text", "date"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -63,7 +63,7 @@ class DataQueryAllOf(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return DataQueryAllOf.parse_obj(obj)
|
||||
|
||||
_obj = DataQueryAllOf.parse_obj({
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -39,16 +38,18 @@ class DefaultValue(BaseModel):
|
||||
__properties = ["array_string_enum_ref_default", "array_string_enum_default", "array_string_default", "array_integer_default", "array_string", "array_string_nullable", "array_string_extension_nullable", "string_nullable"]
|
||||
|
||||
@validator('array_string_enum_default')
|
||||
def array_string_enum_default_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def array_string_enum_default_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
for i in v:
|
||||
for i in value:
|
||||
if i not in ('success', 'failure', 'unclassified'):
|
||||
raise ValueError("each list item must be one of ('success', 'failure', 'unclassified')")
|
||||
return v
|
||||
return value
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -94,7 +95,7 @@ class DefaultValue(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return DefaultValue.parse_obj(obj)
|
||||
|
||||
_obj = DefaultValue.parse_obj({
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -33,6 +32,7 @@ class NumberPropertiesOnly(BaseModel):
|
||||
__properties = ["number", "float", "double"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -63,7 +63,7 @@ class NumberPropertiesOnly(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return NumberPropertiesOnly.parse_obj(obj)
|
||||
|
||||
_obj = NumberPropertiesOnly.parse_obj({
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -38,15 +37,17 @@ class Pet(BaseModel):
|
||||
__properties = ["id", "name", "category", "photoUrls", "tags", "status"]
|
||||
|
||||
@validator('status')
|
||||
def status_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def status_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if v not in ('available', 'pending', 'sold'):
|
||||
if value not in ('available', 'pending', 'sold'):
|
||||
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
||||
return v
|
||||
return value
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -87,7 +88,7 @@ class Pet(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Pet.parse_obj(obj)
|
||||
|
||||
_obj = Pet.parse_obj({
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,16 +31,18 @@ class Query(BaseModel):
|
||||
__properties = ["id", "outcomes"]
|
||||
|
||||
@validator('outcomes')
|
||||
def outcomes_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def outcomes_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
for i in v:
|
||||
for i in value:
|
||||
if i not in ('SUCCESS', 'FAILURE', 'SKIPPED'):
|
||||
raise ValueError("each list item must be one of ('SUCCESS', 'FAILURE', 'SKIPPED')")
|
||||
return v
|
||||
return value
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class Tag(BaseModel):
|
||||
__properties = ["id", "name"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -62,7 +62,7 @@ class Tag(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Tag.parse_obj(obj)
|
||||
|
||||
_obj = Tag.parse_obj({
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -34,6 +33,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseMod
|
||||
__properties = ["size", "color", "id", "name"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -64,7 +64,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseMod
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.parse_obj(obj)
|
||||
|
||||
_obj = TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.parse_obj({
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel):
|
||||
__properties = ["values"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -61,7 +61,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.parse_obj(obj)
|
||||
|
||||
_obj = TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.parse_obj({
|
||||
|
@ -13,7 +13,7 @@ python = "^3.7"
|
||||
|
||||
urllib3 = ">= 1.25.3"
|
||||
python-dateutil = ">=2.8.2"
|
||||
pydantic = "^1.10.5"
|
||||
pydantic = "^1.10.5, <2"
|
||||
aenum = ">=3.1.11"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
@ -25,3 +25,5 @@ flake8 = ">=4.0.0"
|
||||
requires = ["setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.pylint.'MESSAGES CONTROL']
|
||||
extension-pkg-whitelist = "pydantic"
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class AdditionalPropertiesClass(BaseModel):
|
||||
__properties = ["map_property", "map_of_map_property"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -61,7 +61,7 @@ class AdditionalPropertiesClass(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return AdditionalPropertiesClass.parse_obj(obj)
|
||||
|
||||
_obj = AdditionalPropertiesClass.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class AllOfWithSingleRef(BaseModel):
|
||||
__properties = ["username", "SingleRefType"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -62,7 +62,7 @@ class AllOfWithSingleRef(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return AllOfWithSingleRef.parse_obj(obj)
|
||||
|
||||
_obj = AllOfWithSingleRef.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class Animal(BaseModel):
|
||||
__properties = ["className", "color"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
|
@ -47,13 +47,13 @@ class AnyOfPig(BaseModel):
|
||||
instance = cls()
|
||||
error_messages = []
|
||||
# validate data type: BasquePig
|
||||
if type(v) is not BasquePig:
|
||||
if not isinstance(v, BasquePig):
|
||||
error_messages.append(f"Error! Input type `{type(v)}` is not `BasquePig`")
|
||||
else:
|
||||
return v
|
||||
|
||||
# validate data type: DanishPig
|
||||
if type(v) is not DanishPig:
|
||||
if not isinstance(v, DanishPig):
|
||||
error_messages.append(f"Error! Input type `{type(v)}` is not `DanishPig`")
|
||||
else:
|
||||
return v
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class ApiResponse(BaseModel):
|
||||
__properties = ["code", "type", "message"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -62,7 +62,7 @@ class ApiResponse(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return ApiResponse.parse_obj(obj)
|
||||
|
||||
_obj = ApiResponse.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -30,6 +29,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel):
|
||||
__properties = ["ArrayArrayNumber"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -60,7 +60,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return ArrayOfArrayOfNumberOnly.parse_obj(obj)
|
||||
|
||||
_obj = ArrayOfArrayOfNumberOnly.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -30,6 +29,7 @@ class ArrayOfNumberOnly(BaseModel):
|
||||
__properties = ["ArrayNumber"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -60,7 +60,7 @@ class ArrayOfNumberOnly(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return ArrayOfNumberOnly.parse_obj(obj)
|
||||
|
||||
_obj = ArrayOfNumberOnly.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -33,6 +32,7 @@ class ArrayTest(BaseModel):
|
||||
__properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -70,7 +70,7 @@ class ArrayTest(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return ArrayTest.parse_obj(obj)
|
||||
|
||||
_obj = ArrayTest.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class BasquePig(BaseModel):
|
||||
__properties = ["className", "color"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -61,7 +61,7 @@ class BasquePig(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return BasquePig.parse_obj(obj)
|
||||
|
||||
_obj = BasquePig.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -35,6 +34,7 @@ class Capitalization(BaseModel):
|
||||
__properties = ["smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -65,7 +65,7 @@ class Capitalization(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Capitalization.parse_obj(obj)
|
||||
|
||||
_obj = Capitalization.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class Cat(Animal):
|
||||
__properties = ["className", "color", "declawed"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -61,7 +61,7 @@ class Cat(Animal):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Cat.parse_obj(obj)
|
||||
|
||||
_obj = Cat.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -30,6 +29,7 @@ class CatAllOf(BaseModel):
|
||||
__properties = ["declawed"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -60,7 +60,7 @@ class CatAllOf(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return CatAllOf.parse_obj(obj)
|
||||
|
||||
_obj = CatAllOf.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class Category(BaseModel):
|
||||
__properties = ["id", "name"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -61,7 +61,7 @@ class Category(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Category.parse_obj(obj)
|
||||
|
||||
_obj = Category.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class CircularReferenceModel(BaseModel):
|
||||
__properties = ["size", "nested"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -64,7 +64,7 @@ class CircularReferenceModel(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return CircularReferenceModel.parse_obj(obj)
|
||||
|
||||
_obj = CircularReferenceModel.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -30,6 +29,7 @@ class ClassModel(BaseModel):
|
||||
__properties = ["_class"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -60,7 +60,7 @@ class ClassModel(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return ClassModel.parse_obj(obj)
|
||||
|
||||
_obj = ClassModel.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -30,6 +29,7 @@ class Client(BaseModel):
|
||||
__properties = ["client"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -60,7 +60,7 @@ class Client(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Client.parse_obj(obj)
|
||||
|
||||
_obj = Client.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class DanishPig(BaseModel):
|
||||
__properties = ["className", "size"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -61,7 +61,7 @@ class DanishPig(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return DanishPig.parse_obj(obj)
|
||||
|
||||
_obj = DanishPig.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -30,6 +29,7 @@ class DeprecatedObject(BaseModel):
|
||||
__properties = ["name"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -60,7 +60,7 @@ class DeprecatedObject(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return DeprecatedObject.parse_obj(obj)
|
||||
|
||||
_obj = DeprecatedObject.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class Dog(Animal):
|
||||
__properties = ["className", "color", "breed"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -61,7 +61,7 @@ class Dog(Animal):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Dog.parse_obj(obj)
|
||||
|
||||
_obj = Dog.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -30,6 +29,7 @@ class DogAllOf(BaseModel):
|
||||
__properties = ["breed"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -60,7 +60,7 @@ class DogAllOf(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return DogAllOf.parse_obj(obj)
|
||||
|
||||
_obj = DogAllOf.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class DummyModel(BaseModel):
|
||||
__properties = ["category", "self_ref"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -64,7 +64,7 @@ class DummyModel(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return DummyModel.parse_obj(obj)
|
||||
|
||||
_obj = DummyModel.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,25 +30,28 @@ class EnumArrays(BaseModel):
|
||||
__properties = ["just_symbol", "array_enum"]
|
||||
|
||||
@validator('just_symbol')
|
||||
def just_symbol_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def just_symbol_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if v not in ('>=', '$'):
|
||||
if value not in ('>=', '$'):
|
||||
raise ValueError("must be one of enum values ('>=', '$')")
|
||||
return v
|
||||
return value
|
||||
|
||||
@validator('array_enum')
|
||||
def array_enum_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def array_enum_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
for i in v:
|
||||
for i in value:
|
||||
if i not in ('fish', 'crab'):
|
||||
raise ValueError("each list item must be one of ('fish', 'crab')")
|
||||
return v
|
||||
return value
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -80,7 +82,7 @@ class EnumArrays(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return EnumArrays.parse_obj(obj)
|
||||
|
||||
_obj = EnumArrays.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -42,48 +41,54 @@ class EnumTest(BaseModel):
|
||||
__properties = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue"]
|
||||
|
||||
@validator('enum_string')
|
||||
def enum_string_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def enum_string_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if v not in ('UPPER', 'lower', ''):
|
||||
if value not in ('UPPER', 'lower', ''):
|
||||
raise ValueError("must be one of enum values ('UPPER', 'lower', '')")
|
||||
return v
|
||||
return value
|
||||
|
||||
@validator('enum_string_required')
|
||||
def enum_string_required_validate_enum(cls, v):
|
||||
if v not in ('UPPER', 'lower', ''):
|
||||
def enum_string_required_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value not in ('UPPER', 'lower', ''):
|
||||
raise ValueError("must be one of enum values ('UPPER', 'lower', '')")
|
||||
return v
|
||||
return value
|
||||
|
||||
@validator('enum_integer_default')
|
||||
def enum_integer_default_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def enum_integer_default_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if v not in (1, 5, 14):
|
||||
if value not in (1, 5, 14):
|
||||
raise ValueError("must be one of enum values (1, 5, 14)")
|
||||
return v
|
||||
return value
|
||||
|
||||
@validator('enum_integer')
|
||||
def enum_integer_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def enum_integer_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if v not in (1, -1):
|
||||
if value not in (1, -1):
|
||||
raise ValueError("must be one of enum values (1, -1)")
|
||||
return v
|
||||
return value
|
||||
|
||||
@validator('enum_number')
|
||||
def enum_number_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def enum_number_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if v not in (1.1, -1.2):
|
||||
if value not in (1.1, -1.2):
|
||||
raise ValueError("must be one of enum values (1.1, -1.2)")
|
||||
return v
|
||||
return value
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -119,7 +124,7 @@ class EnumTest(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return EnumTest.parse_obj(obj)
|
||||
|
||||
_obj = EnumTest.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -30,6 +29,7 @@ class File(BaseModel):
|
||||
__properties = ["sourceURI"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -60,7 +60,7 @@ class File(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return File.parse_obj(obj)
|
||||
|
||||
_obj = File.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class FileSchemaTestClass(BaseModel):
|
||||
__properties = ["file", "files"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -72,7 +72,7 @@ class FileSchemaTestClass(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return FileSchemaTestClass.parse_obj(obj)
|
||||
|
||||
_obj = FileSchemaTestClass.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class FirstRef(BaseModel):
|
||||
__properties = ["category", "self_ref"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -64,7 +64,7 @@ class FirstRef(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return FirstRef.parse_obj(obj)
|
||||
|
||||
_obj = FirstRef.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -30,6 +29,7 @@ class Foo(BaseModel):
|
||||
__properties = ["bar"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -60,7 +60,7 @@ class Foo(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Foo.parse_obj(obj)
|
||||
|
||||
_obj = Foo.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class FooGetDefaultResponse(BaseModel):
|
||||
__properties = ["string"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -64,7 +64,7 @@ class FooGetDefaultResponse(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return FooGetDefaultResponse.parse_obj(obj)
|
||||
|
||||
_obj = FooGetDefaultResponse.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -46,42 +45,47 @@ class FormatTest(BaseModel):
|
||||
__properties = ["integer", "int32", "int64", "number", "float", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"]
|
||||
|
||||
@validator('string')
|
||||
def string_validate_regular_expression(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def string_validate_regular_expression(cls, value):
|
||||
"""Validates the regular expression"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if not re.match(r"[a-z]", v ,re.IGNORECASE):
|
||||
if not re.match(r"[a-z]", value ,re.IGNORECASE):
|
||||
raise ValueError(r"must validate the regular expression /[a-z]/i")
|
||||
return v
|
||||
return value
|
||||
|
||||
@validator('string_with_double_quote_pattern')
|
||||
def string_with_double_quote_pattern_validate_regular_expression(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def string_with_double_quote_pattern_validate_regular_expression(cls, value):
|
||||
"""Validates the regular expression"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if not re.match(r"this is \"something\"", v):
|
||||
if not re.match(r"this is \"something\"", value):
|
||||
raise ValueError(r"must validate the regular expression /this is \"something\"/")
|
||||
return v
|
||||
return value
|
||||
|
||||
@validator('pattern_with_digits')
|
||||
def pattern_with_digits_validate_regular_expression(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def pattern_with_digits_validate_regular_expression(cls, value):
|
||||
"""Validates the regular expression"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if not re.match(r"^\d{10}$", v):
|
||||
if not re.match(r"^\d{10}$", value):
|
||||
raise ValueError(r"must validate the regular expression /^\d{10}$/")
|
||||
return v
|
||||
return value
|
||||
|
||||
@validator('pattern_with_digits_and_delimiter')
|
||||
def pattern_with_digits_and_delimiter_validate_regular_expression(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def pattern_with_digits_and_delimiter_validate_regular_expression(cls, value):
|
||||
"""Validates the regular expression"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if not re.match(r"^image_\d{1,3}$", v ,re.IGNORECASE):
|
||||
if not re.match(r"^image_\d{1,3}$", value ,re.IGNORECASE):
|
||||
raise ValueError(r"must validate the regular expression /^image_\d{1,3}$/i")
|
||||
return v
|
||||
return value
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -112,7 +116,7 @@ class FormatTest(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return FormatTest.parse_obj(obj)
|
||||
|
||||
_obj = FormatTest.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class HasOnlyReadOnly(BaseModel):
|
||||
__properties = ["bar", "foo"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -63,7 +63,7 @@ class HasOnlyReadOnly(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return HasOnlyReadOnly.parse_obj(obj)
|
||||
|
||||
_obj = HasOnlyReadOnly.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -30,6 +29,7 @@ class HealthCheckResult(BaseModel):
|
||||
__properties = ["NullableMessage"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -65,7 +65,7 @@ class HealthCheckResult(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return HealthCheckResult.parse_obj(obj)
|
||||
|
||||
_obj = HealthCheckResult.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -30,6 +29,7 @@ class InnerDictWithProperty(BaseModel):
|
||||
__properties = ["aProperty"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -60,7 +60,7 @@ class InnerDictWithProperty(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return InnerDictWithProperty.parse_obj(obj)
|
||||
|
||||
_obj = InnerDictWithProperty.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -30,6 +29,7 @@ class List(BaseModel):
|
||||
__properties = ["123-list"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -60,7 +60,7 @@ class List(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return List.parse_obj(obj)
|
||||
|
||||
_obj = List.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -33,15 +32,17 @@ class MapTest(BaseModel):
|
||||
__properties = ["map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map"]
|
||||
|
||||
@validator('map_of_enum_string')
|
||||
def map_of_enum_string_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def map_of_enum_string_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if v not in ('UPPER', 'lower'):
|
||||
if value not in ('UPPER', 'lower'):
|
||||
raise ValueError("must be one of enum values ('UPPER', 'lower')")
|
||||
return v
|
||||
return value
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -72,7 +73,7 @@ class MapTest(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return MapTest.parse_obj(obj)
|
||||
|
||||
_obj = MapTest.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -33,6 +32,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(BaseModel):
|
||||
__properties = ["uuid", "dateTime", "map"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -70,7 +70,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return MixedPropertiesAndAdditionalPropertiesClass.parse_obj(obj)
|
||||
|
||||
_obj = MixedPropertiesAndAdditionalPropertiesClass.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class Model200Response(BaseModel):
|
||||
__properties = ["name", "class"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -61,7 +61,7 @@ class Model200Response(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Model200Response.parse_obj(obj)
|
||||
|
||||
_obj = Model200Response.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -30,6 +29,7 @@ class ModelReturn(BaseModel):
|
||||
__properties = ["return"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -60,7 +60,7 @@ class ModelReturn(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return ModelReturn.parse_obj(obj)
|
||||
|
||||
_obj = ModelReturn.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -33,6 +32,7 @@ class Name(BaseModel):
|
||||
__properties = ["name", "snake_case", "property", "123Number"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -65,7 +65,7 @@ class Name(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Name.parse_obj(obj)
|
||||
|
||||
_obj = Name.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -42,6 +41,7 @@ class NullableClass(BaseModel):
|
||||
__properties = ["required_integer_prop", "integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -127,7 +127,7 @@ class NullableClass(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return NullableClass.parse_obj(obj)
|
||||
|
||||
_obj = NullableClass.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -30,6 +29,7 @@ class NumberOnly(BaseModel):
|
||||
__properties = ["JustNumber"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -60,7 +60,7 @@ class NumberOnly(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return NumberOnly.parse_obj(obj)
|
||||
|
||||
_obj = NumberOnly.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -34,6 +33,7 @@ class ObjectWithDeprecatedFields(BaseModel):
|
||||
__properties = ["uuid", "id", "deprecatedRef", "bars"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -67,7 +67,7 @@ class ObjectWithDeprecatedFields(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return ObjectWithDeprecatedFields.parse_obj(obj)
|
||||
|
||||
_obj = ObjectWithDeprecatedFields.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -35,15 +34,17 @@ class Order(BaseModel):
|
||||
__properties = ["id", "petId", "quantity", "shipDate", "status", "complete"]
|
||||
|
||||
@validator('status')
|
||||
def status_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def status_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if v not in ('placed', 'approved', 'delivered'):
|
||||
if value not in ('placed', 'approved', 'delivered'):
|
||||
raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')")
|
||||
return v
|
||||
return value
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -74,7 +75,7 @@ class Order(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Order.parse_obj(obj)
|
||||
|
||||
_obj = Order.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class OuterComposite(BaseModel):
|
||||
__properties = ["my_number", "my_string", "my_boolean"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -62,7 +62,7 @@ class OuterComposite(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return OuterComposite.parse_obj(obj)
|
||||
|
||||
_obj = OuterComposite.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -33,6 +32,7 @@ class OuterObjectWithEnumProperty(BaseModel):
|
||||
__properties = ["str_value", "value"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -68,7 +68,7 @@ class OuterObjectWithEnumProperty(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return OuterObjectWithEnumProperty.parse_obj(obj)
|
||||
|
||||
_obj = OuterObjectWithEnumProperty.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class Parent(BaseModel):
|
||||
__properties = ["optionalDict"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -68,7 +68,7 @@ class Parent(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Parent.parse_obj(obj)
|
||||
|
||||
_obj = Parent.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class ParentWithOptionalDict(BaseModel):
|
||||
__properties = ["optionalDict"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -68,7 +68,7 @@ class ParentWithOptionalDict(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return ParentWithOptionalDict.parse_obj(obj)
|
||||
|
||||
_obj = ParentWithOptionalDict.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -37,15 +36,17 @@ class Pet(BaseModel):
|
||||
__properties = ["id", "category", "name", "photoUrls", "tags", "status"]
|
||||
|
||||
@validator('status')
|
||||
def status_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def status_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if v not in ('available', 'pending', 'sold'):
|
||||
if value not in ('available', 'pending', 'sold'):
|
||||
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
||||
return v
|
||||
return value
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -86,7 +87,7 @@ class Pet(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Pet.parse_obj(obj)
|
||||
|
||||
_obj = Pet.parse_obj({
|
||||
|
@ -50,13 +50,13 @@ class Pig(BaseModel):
|
||||
error_messages = []
|
||||
match = 0
|
||||
# validate data type: BasquePig
|
||||
if type(v) is not BasquePig:
|
||||
if not isinstance(v, BasquePig):
|
||||
error_messages.append(f"Error! Input type `{type(v)}` is not `BasquePig`")
|
||||
else:
|
||||
match += 1
|
||||
|
||||
# validate data type: DanishPig
|
||||
if type(v) is not DanishPig:
|
||||
if not isinstance(v, DanishPig):
|
||||
error_messages.append(f"Error! Input type `{type(v)}` is not `DanishPig`")
|
||||
else:
|
||||
match += 1
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class ReadOnlyFirst(BaseModel):
|
||||
__properties = ["bar", "baz"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -62,7 +62,7 @@ class ReadOnlyFirst(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return ReadOnlyFirst.parse_obj(obj)
|
||||
|
||||
_obj = ReadOnlyFirst.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class SecondRef(BaseModel):
|
||||
__properties = ["category", "circular_ref"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -64,7 +64,7 @@ class SecondRef(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return SecondRef.parse_obj(obj)
|
||||
|
||||
_obj = SecondRef.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class SelfReferenceModel(BaseModel):
|
||||
__properties = ["size", "nested"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -64,7 +64,7 @@ class SelfReferenceModel(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return SelfReferenceModel.parse_obj(obj)
|
||||
|
||||
_obj = SelfReferenceModel.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -30,6 +29,7 @@ class SpecialModelName(BaseModel):
|
||||
__properties = ["$special[property.name]"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -60,7 +60,7 @@ class SpecialModelName(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return SpecialModelName.parse_obj(obj)
|
||||
|
||||
_obj = SpecialModelName.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -33,15 +32,17 @@ class SpecialName(BaseModel):
|
||||
__properties = ["property", "async", "schema"]
|
||||
|
||||
@validator('var_schema')
|
||||
def var_schema_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def var_schema_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if v not in ('available', 'pending', 'sold'):
|
||||
if value not in ('available', 'pending', 'sold'):
|
||||
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
||||
return v
|
||||
return value
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -75,7 +76,7 @@ class SpecialName(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return SpecialName.parse_obj(obj)
|
||||
|
||||
_obj = SpecialName.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class Tag(BaseModel):
|
||||
__properties = ["id", "name"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -61,7 +61,7 @@ class Tag(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Tag.parse_obj(obj)
|
||||
|
||||
_obj = Tag.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -37,6 +36,7 @@ class User(BaseModel):
|
||||
__properties = ["id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -67,7 +67,7 @@ class User(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return User.parse_obj(obj)
|
||||
|
||||
_obj = User.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class WithNestedOneOf(BaseModel):
|
||||
__properties = ["size", "nested_pig"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -65,7 +65,7 @@ class WithNestedOneOf(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return WithNestedOneOf.parse_obj(obj)
|
||||
|
||||
_obj = WithNestedOneOf.parse_obj({
|
||||
|
@ -16,7 +16,7 @@ python-dateutil = ">=2.8.2"
|
||||
aiohttp = ">= 3.8.4"
|
||||
pem = ">= 19.3.0"
|
||||
pycryptodome = ">= 3.9.0"
|
||||
pydantic = "^1.10.5"
|
||||
pydantic = "^1.10.5, <2"
|
||||
aenum = ">=3.1.11"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
@ -28,3 +28,5 @@ flake8 = ">=4.0.0"
|
||||
requires = ["setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.pylint.'MESSAGES CONTROL']
|
||||
extension-pkg-whitelist = "pydantic"
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class AdditionalPropertiesClass(BaseModel):
|
||||
__properties = ["map_property", "map_of_map_property"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -68,7 +68,7 @@ class AdditionalPropertiesClass(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return AdditionalPropertiesClass.parse_obj(obj)
|
||||
|
||||
_obj = AdditionalPropertiesClass.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -33,6 +32,7 @@ class AllOfWithSingleRef(BaseModel):
|
||||
__properties = ["username", "SingleRefType"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -69,7 +69,7 @@ class AllOfWithSingleRef(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return AllOfWithSingleRef.parse_obj(obj)
|
||||
|
||||
_obj = AllOfWithSingleRef.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -33,6 +32,7 @@ class Animal(BaseModel):
|
||||
__properties = ["className", "color"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
|
@ -47,13 +47,13 @@ class AnyOfPig(BaseModel):
|
||||
instance = cls()
|
||||
error_messages = []
|
||||
# validate data type: BasquePig
|
||||
if type(v) is not BasquePig:
|
||||
if not isinstance(v, BasquePig):
|
||||
error_messages.append(f"Error! Input type `{type(v)}` is not `BasquePig`")
|
||||
else:
|
||||
return v
|
||||
|
||||
# validate data type: DanishPig
|
||||
if type(v) is not DanishPig:
|
||||
if not isinstance(v, DanishPig):
|
||||
error_messages.append(f"Error! Input type `{type(v)}` is not `DanishPig`")
|
||||
else:
|
||||
return v
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -33,6 +32,7 @@ class ApiResponse(BaseModel):
|
||||
__properties = ["code", "type", "message"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -69,7 +69,7 @@ class ApiResponse(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return ApiResponse.parse_obj(obj)
|
||||
|
||||
_obj = ApiResponse.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel):
|
||||
__properties = ["ArrayArrayNumber"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -67,7 +67,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return ArrayOfArrayOfNumberOnly.parse_obj(obj)
|
||||
|
||||
_obj = ArrayOfArrayOfNumberOnly.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class ArrayOfNumberOnly(BaseModel):
|
||||
__properties = ["ArrayNumber"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -67,7 +67,7 @@ class ArrayOfNumberOnly(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return ArrayOfNumberOnly.parse_obj(obj)
|
||||
|
||||
_obj = ArrayOfNumberOnly.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -34,6 +33,7 @@ class ArrayTest(BaseModel):
|
||||
__properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -77,7 +77,7 @@ class ArrayTest(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return ArrayTest.parse_obj(obj)
|
||||
|
||||
_obj = ArrayTest.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class BasquePig(BaseModel):
|
||||
__properties = ["className", "color"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -68,7 +68,7 @@ class BasquePig(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return BasquePig.parse_obj(obj)
|
||||
|
||||
_obj = BasquePig.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -36,6 +35,7 @@ class Capitalization(BaseModel):
|
||||
__properties = ["smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -72,7 +72,7 @@ class Capitalization(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Capitalization.parse_obj(obj)
|
||||
|
||||
_obj = Capitalization.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class Cat(Animal):
|
||||
__properties = ["className", "color", "declawed"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -68,7 +68,7 @@ class Cat(Animal):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Cat.parse_obj(obj)
|
||||
|
||||
_obj = Cat.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class CatAllOf(BaseModel):
|
||||
__properties = ["declawed"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -67,7 +67,7 @@ class CatAllOf(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return CatAllOf.parse_obj(obj)
|
||||
|
||||
_obj = CatAllOf.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class Category(BaseModel):
|
||||
__properties = ["id", "name"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -68,7 +68,7 @@ class Category(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Category.parse_obj(obj)
|
||||
|
||||
_obj = Category.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class CircularReferenceModel(BaseModel):
|
||||
__properties = ["size", "nested"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -71,7 +71,7 @@ class CircularReferenceModel(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return CircularReferenceModel.parse_obj(obj)
|
||||
|
||||
_obj = CircularReferenceModel.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class ClassModel(BaseModel):
|
||||
__properties = ["_class"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -67,7 +67,7 @@ class ClassModel(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return ClassModel.parse_obj(obj)
|
||||
|
||||
_obj = ClassModel.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class Client(BaseModel):
|
||||
__properties = ["client"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -67,7 +67,7 @@ class Client(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Client.parse_obj(obj)
|
||||
|
||||
_obj = Client.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class DanishPig(BaseModel):
|
||||
__properties = ["className", "size"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -68,7 +68,7 @@ class DanishPig(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return DanishPig.parse_obj(obj)
|
||||
|
||||
_obj = DanishPig.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class DeprecatedObject(BaseModel):
|
||||
__properties = ["name"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -67,7 +67,7 @@ class DeprecatedObject(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return DeprecatedObject.parse_obj(obj)
|
||||
|
||||
_obj = DeprecatedObject.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class Dog(Animal):
|
||||
__properties = ["className", "color", "breed"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -68,7 +68,7 @@ class Dog(Animal):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Dog.parse_obj(obj)
|
||||
|
||||
_obj = Dog.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class DogAllOf(BaseModel):
|
||||
__properties = ["breed"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -67,7 +67,7 @@ class DogAllOf(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return DogAllOf.parse_obj(obj)
|
||||
|
||||
_obj = DogAllOf.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class DummyModel(BaseModel):
|
||||
__properties = ["category", "self_ref"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -71,7 +71,7 @@ class DummyModel(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return DummyModel.parse_obj(obj)
|
||||
|
||||
_obj = DummyModel.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,25 +31,28 @@ class EnumArrays(BaseModel):
|
||||
__properties = ["just_symbol", "array_enum"]
|
||||
|
||||
@validator('just_symbol')
|
||||
def just_symbol_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def just_symbol_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if v not in ('>=', '$'):
|
||||
if value not in ('>=', '$'):
|
||||
raise ValueError("must be one of enum values ('>=', '$')")
|
||||
return v
|
||||
return value
|
||||
|
||||
@validator('array_enum')
|
||||
def array_enum_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def array_enum_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
for i in v:
|
||||
for i in value:
|
||||
if i not in ('fish', 'crab'):
|
||||
raise ValueError("each list item must be one of ('fish', 'crab')")
|
||||
return v
|
||||
return value
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -87,7 +89,7 @@ class EnumArrays(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return EnumArrays.parse_obj(obj)
|
||||
|
||||
_obj = EnumArrays.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -43,48 +42,54 @@ class EnumTest(BaseModel):
|
||||
__properties = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue"]
|
||||
|
||||
@validator('enum_string')
|
||||
def enum_string_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def enum_string_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if v not in ('UPPER', 'lower', ''):
|
||||
if value not in ('UPPER', 'lower', ''):
|
||||
raise ValueError("must be one of enum values ('UPPER', 'lower', '')")
|
||||
return v
|
||||
return value
|
||||
|
||||
@validator('enum_string_required')
|
||||
def enum_string_required_validate_enum(cls, v):
|
||||
if v not in ('UPPER', 'lower', ''):
|
||||
def enum_string_required_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value not in ('UPPER', 'lower', ''):
|
||||
raise ValueError("must be one of enum values ('UPPER', 'lower', '')")
|
||||
return v
|
||||
return value
|
||||
|
||||
@validator('enum_integer_default')
|
||||
def enum_integer_default_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def enum_integer_default_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if v not in (1, 5, 14):
|
||||
if value not in (1, 5, 14):
|
||||
raise ValueError("must be one of enum values (1, 5, 14)")
|
||||
return v
|
||||
return value
|
||||
|
||||
@validator('enum_integer')
|
||||
def enum_integer_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def enum_integer_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if v not in (1, -1):
|
||||
if value not in (1, -1):
|
||||
raise ValueError("must be one of enum values (1, -1)")
|
||||
return v
|
||||
return value
|
||||
|
||||
@validator('enum_number')
|
||||
def enum_number_validate_enum(cls, v):
|
||||
if v is None:
|
||||
return v
|
||||
def enum_number_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if v not in (1.1, -1.2):
|
||||
if value not in (1.1, -1.2):
|
||||
raise ValueError("must be one of enum values (1.1, -1.2)")
|
||||
return v
|
||||
return value
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -126,7 +131,7 @@ class EnumTest(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return EnumTest.parse_obj(obj)
|
||||
|
||||
_obj = EnumTest.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class File(BaseModel):
|
||||
__properties = ["sourceURI"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -67,7 +67,7 @@ class File(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return File.parse_obj(obj)
|
||||
|
||||
_obj = File.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -33,6 +32,7 @@ class FileSchemaTestClass(BaseModel):
|
||||
__properties = ["file", "files"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -79,7 +79,7 @@ class FileSchemaTestClass(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return FileSchemaTestClass.parse_obj(obj)
|
||||
|
||||
_obj = FileSchemaTestClass.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -32,6 +31,7 @@ class FirstRef(BaseModel):
|
||||
__properties = ["category", "self_ref"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -71,7 +71,7 @@ class FirstRef(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return FirstRef.parse_obj(obj)
|
||||
|
||||
_obj = FirstRef.parse_obj({
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
from inspect import getfullargspec
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
@ -31,6 +30,7 @@ class Foo(BaseModel):
|
||||
__properties = ["bar"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
@ -67,7 +67,7 @@ class Foo(BaseModel):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if type(obj) is not dict:
|
||||
if not isinstance(obj, dict):
|
||||
return Foo.parse_obj(obj)
|
||||
|
||||
_obj = Foo.parse_obj({
|
||||
|
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