diff --git a/openapi_python_client/parser/properties/__init__.py b/openapi_python_client/parser/properties/__init__.py index 5920987af..524ff5ba0 100644 --- a/openapi_python_client/parser/properties/__init__.py +++ b/openapi_python_client/parser/properties/__init__.py @@ -453,6 +453,7 @@ def build_union_property( constructed `UnionProperty` or a `PropertyError` describing what went wrong. """ sub_properties: List[Property] = [] + for i, sub_prop_data in enumerate(chain(data.anyOf, data.oneOf)): sub_prop, schemas = property_from_data( name=f"{name}_type_{i}", @@ -570,8 +571,8 @@ def _property_from_data( if isinstance(data, oai.Reference): return _property_from_ref(name=name, required=required, parent=None, data=data, schemas=schemas, config=config) + sub_data: List[Union[oai.Schema, oai.Reference]] = data.allOf + data.anyOf + data.oneOf # A union of a single reference should just be passed through to that reference (don't create copy class) - sub_data = (data.allOf or []) + data.anyOf + data.oneOf if len(sub_data) == 1 and isinstance(sub_data[0], oai.Reference): return _property_from_ref( name=name, required=required, parent=data, data=sub_data[0], schemas=schemas, config=config diff --git a/openapi_python_client/parser/properties/model_property.py b/openapi_python_client/parser/properties/model_property.py index cfaea08b0..6e68a8f8e 100644 --- a/openapi_python_client/parser/properties/model_property.py +++ b/openapi_python_client/parser/properties/model_property.py @@ -135,7 +135,7 @@ def _add_if_no_conflict(new_prop: Property) -> Optional[PropertyError]: return None unprocessed_props = data.properties or {} - for sub_prop in data.allOf or []: + for sub_prop in data.allOf: if isinstance(sub_prop, oai.Reference): ref_path = parse_reference_path(sub_prop.ref) if isinstance(ref_path, ParseError): diff --git a/openapi_python_client/schema/openapi_schema_pydantic/README.md b/openapi_python_client/schema/openapi_schema_pydantic/README.md index 0e4d40146..f58b36909 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/README.md +++ b/openapi_python_client/schema/openapi_schema_pydantic/README.md @@ -1,5 +1,8 @@ Everything in this directory (including the rest of this file after this paragraph) is a vendored copy of [openapi-schem-pydantic](https://github.com/kuimono/openapi-schema-pydantic) and is licensed under the LICENSE file in this directory. +Included vendored version is the [following](https://github.com/kuimono/openapi-schema-pydantic/commit/0836b429086917feeb973de3367a7ac4c2b3a665) +Small patches has been applied to it. + ## Alias Due to the reserved words in python and pydantic, diff --git a/openapi_python_client/schema/openapi_schema_pydantic/__init__.py b/openapi_python_client/schema/openapi_schema_pydantic/__init__.py index 9edb7d3d9..6b02446a8 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/__init__.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/__init__.py @@ -36,8 +36,11 @@ "ServerVariable", "Tag", "XML", + "Callback", ] + +from .callback import Callback from .components import Components from .contact import Contact from .discriminator import Discriminator diff --git a/openapi_python_client/schema/openapi_schema_pydantic/callback.py b/openapi_python_client/schema/openapi_schema_pydantic/callback.py new file mode 100644 index 000000000..7535cdab8 --- /dev/null +++ b/openapi_python_client/schema/openapi_schema_pydantic/callback.py @@ -0,0 +1,15 @@ +from typing import TYPE_CHECKING, Dict + +if TYPE_CHECKING: # pragma: no cover + from .path_item import PathItem +else: + PathItem = "PathItem" # pylint: disable=invalid-name + +Callback = Dict[str, PathItem] +""" +A map of possible out-of band callbacks related to the parent operation. +Each value in the map is a [Path Item Object](#pathItemObject) +that describes a set of requests that may be initiated by the API provider and the expected responses. +The key value used to identify the path item object is an expression, evaluated at runtime, +that identifies a URL to use for the callback operation. +""" diff --git a/openapi_python_client/schema/openapi_schema_pydantic/components.py b/openapi_python_client/schema/openapi_schema_pydantic/components.py index 3798a5c13..442b376c1 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/components.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/components.py @@ -1,7 +1,8 @@ from typing import Dict, Optional, Union -from pydantic import BaseModel +from pydantic import BaseModel, Extra +from .callback import Callback from .example import Example from .header import Header from .link import Link @@ -32,8 +33,10 @@ class Components(BaseModel): headers: Optional[Dict[str, Union[Header, Reference]]] = None securitySchemes: Optional[Dict[str, Union[SecurityScheme, Reference]]] = None links: Optional[Dict[str, Union[Link, Reference]]] = None + callbacks: Optional[Dict[str, Union[Callback, Reference]]] = None class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = { "examples": [ { diff --git a/openapi_python_client/schema/openapi_schema_pydantic/contact.py b/openapi_python_client/schema/openapi_schema_pydantic/contact.py index 236548ea9..a02c2638e 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/contact.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/contact.py @@ -1,6 +1,6 @@ from typing import Optional -from pydantic import AnyUrl, BaseModel +from pydantic import AnyUrl, BaseModel, Extra class Contact(BaseModel): @@ -16,6 +16,7 @@ class Contact(BaseModel): email: Optional[str] = None class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = { "examples": [ {"name": "API Support", "url": "http://www.example.com/support", "email": "support@example.com"} diff --git a/openapi_python_client/schema/openapi_schema_pydantic/discriminator.py b/openapi_python_client/schema/openapi_schema_pydantic/discriminator.py index 1c84833c9..aa96efa9d 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/discriminator.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/discriminator.py @@ -1,6 +1,6 @@ from typing import Dict, Optional -from pydantic import BaseModel +from pydantic import BaseModel, Extra class Discriminator(BaseModel): @@ -22,6 +22,7 @@ class Discriminator(BaseModel): mapping: Optional[Dict[str, str]] = None class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = { "examples": [ { diff --git a/openapi_python_client/schema/openapi_schema_pydantic/encoding.py b/openapi_python_client/schema/openapi_schema_pydantic/encoding.py index 89bec3f00..7497b1650 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/encoding.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/encoding.py @@ -1,9 +1,14 @@ -from typing import Dict, Optional +from typing import TYPE_CHECKING, Dict, Optional, Union -from pydantic import BaseModel +from pydantic import BaseModel, Extra from .reference import Reference +if TYPE_CHECKING: # pragma: no cover + from .header import Header +else: + Header = "Header" # pylint: disable=invalid-name + class Encoding(BaseModel): """A single encoding definition applied to a single schema property. @@ -14,12 +19,13 @@ class Encoding(BaseModel): """ contentType: Optional[str] = None - headers: Optional[Dict[str, Reference]] = None + headers: Optional[Dict[str, Union[Header, Reference]]] = None style: Optional[str] = None explode: bool = False allowReserved: bool = False class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = { "examples": [ { diff --git a/openapi_python_client/schema/openapi_schema_pydantic/example.py b/openapi_python_client/schema/openapi_schema_pydantic/example.py index b95df2b62..fdd233f0f 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/example.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/example.py @@ -1,6 +1,6 @@ from typing import Any, Optional -from pydantic import BaseModel +from pydantic import BaseModel, Extra class Example(BaseModel): @@ -17,6 +17,7 @@ class Example(BaseModel): externalValue: Optional[str] = None class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = { "examples": [ {"summary": "A foo example", "value": {"foo": "bar"}}, diff --git a/openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py b/openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py index 624a662a9..6f6a27156 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py @@ -1,6 +1,6 @@ from typing import Optional -from pydantic import AnyUrl, BaseModel +from pydantic import AnyUrl, BaseModel, Extra class ExternalDocumentation(BaseModel): @@ -14,4 +14,5 @@ class ExternalDocumentation(BaseModel): url: AnyUrl class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = {"examples": [{"description": "Find more info here", "url": "https://example.com"}]} diff --git a/openapi_python_client/schema/openapi_schema_pydantic/header.py b/openapi_python_client/schema/openapi_schema_pydantic/header.py index 69200a7fa..a3eb731e2 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/header.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/header.py @@ -1,4 +1,4 @@ -from pydantic import Field +from pydantic import Extra, Field from ..parameter_location import ParameterLocation from .parameter import Parameter @@ -22,6 +22,7 @@ class Header(Parameter): param_in = Field(default=ParameterLocation.HEADER, const=True, alias="in") class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow allow_population_by_field_name = True schema_extra = { "examples": [ diff --git a/openapi_python_client/schema/openapi_schema_pydantic/info.py b/openapi_python_client/schema/openapi_schema_pydantic/info.py index ea5337f50..2c87c8605 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/info.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/info.py @@ -1,6 +1,6 @@ from typing import Optional -from pydantic import AnyUrl, BaseModel +from pydantic import AnyUrl, BaseModel, Extra from .contact import Contact from .license import License @@ -25,6 +25,7 @@ class Info(BaseModel): version: str class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = { "examples": [ { diff --git a/openapi_python_client/schema/openapi_schema_pydantic/license.py b/openapi_python_client/schema/openapi_schema_pydantic/license.py index ca40f1ac5..d055eb902 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/license.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/license.py @@ -1,6 +1,6 @@ from typing import Optional -from pydantic import AnyUrl, BaseModel +from pydantic import AnyUrl, BaseModel, Extra class License(BaseModel): @@ -15,4 +15,5 @@ class License(BaseModel): url: Optional[AnyUrl] = None class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = {"examples": [{"name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html"}]} diff --git a/openapi_python_client/schema/openapi_schema_pydantic/link.py b/openapi_python_client/schema/openapi_schema_pydantic/link.py index 965508123..162938d3d 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/link.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/link.py @@ -1,6 +1,6 @@ from typing import Any, Dict, Optional -from pydantic import BaseModel +from pydantic import BaseModel, Extra from .server import Server @@ -31,6 +31,7 @@ class Link(BaseModel): server: Optional[Server] = None class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = { "examples": [ {"operationId": "getUserAddressByUUID", "parameters": {"userUuid": "$response.body#/uuid"}}, diff --git a/openapi_python_client/schema/openapi_schema_pydantic/media_type.py b/openapi_python_client/schema/openapi_schema_pydantic/media_type.py index e4eb4542a..851ca3462 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/media_type.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/media_type.py @@ -1,6 +1,6 @@ from typing import Any, Dict, Optional, Union -from pydantic import BaseModel, Field +from pydantic import BaseModel, Extra, Field from .encoding import Encoding from .example import Example @@ -22,6 +22,7 @@ class MediaType(BaseModel): encoding: Optional[Dict[str, Encoding]] = None class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow allow_population_by_field_name = True schema_extra = { "examples": [ diff --git a/openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py b/openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py index 09a170acb..32c70e351 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py @@ -1,6 +1,6 @@ from typing import Dict, Optional -from pydantic import AnyUrl, BaseModel +from pydantic import AnyUrl, BaseModel, Extra class OAuthFlow(BaseModel): @@ -13,11 +13,12 @@ class OAuthFlow(BaseModel): """ authorizationUrl: Optional[AnyUrl] = None - tokenUrl: Optional[str] = None + tokenUrl: Optional[AnyUrl] = None refreshUrl: Optional[AnyUrl] = None scopes: Dict[str, str] class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = { "examples": [ { diff --git a/openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py b/openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py index 2e363aac6..4f9c739d4 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py @@ -1,6 +1,6 @@ from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, Extra from .oauth_flow import OAuthFlow @@ -18,3 +18,6 @@ class OAuthFlows(BaseModel): password: Optional[OAuthFlow] = None clientCredentials: Optional[OAuthFlow] = None authorizationCode: Optional[OAuthFlow] = None + + class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow diff --git a/openapi_python_client/schema/openapi_schema_pydantic/open_api.py b/openapi_python_client/schema/openapi_schema_pydantic/open_api.py index 9c1dfcbf4..50fdebd5e 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/open_api.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/open_api.py @@ -2,7 +2,7 @@ import sys from typing import List, Optional, Union -from pydantic import BaseModel +from pydantic import BaseModel, Extra from .components import Components from .external_documentation import ExternalDocumentation @@ -34,3 +34,6 @@ class OpenAPI(BaseModel): tags: Optional[List[Tag]] = None externalDocs: Optional[ExternalDocumentation] = None openapi: 'Union[Literal["3.0.0"], Literal["3.0.1"], Literal["3.0.2"], Literal["3.0.3"]]' + + class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow diff --git a/openapi_python_client/schema/openapi_schema_pydantic/operation.py b/openapi_python_client/schema/openapi_schema_pydantic/operation.py index 06fea6936..19c78c6d5 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/operation.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/operation.py @@ -1,7 +1,8 @@ -from typing import List, Optional, Union +from typing import Dict, List, Optional, Union -from pydantic import BaseModel +from pydantic import BaseModel, Extra +from .callback import Callback from .external_documentation import ExternalDocumentation from .parameter import Parameter from .reference import Reference @@ -27,11 +28,14 @@ class Operation(BaseModel): parameters: Optional[List[Union[Parameter, Reference]]] = None requestBody: Optional[Union[RequestBody, Reference]] = None responses: Responses + callbacks: Optional[Dict[str, Callback]] = None + deprecated: bool = False security: Optional[List[SecurityRequirement]] = None servers: Optional[List[Server]] = None class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = { "examples": [ { diff --git a/openapi_python_client/schema/openapi_schema_pydantic/parameter.py b/openapi_python_client/schema/openapi_schema_pydantic/parameter.py index 4bf99185d..cf883a9d2 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/parameter.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/parameter.py @@ -1,6 +1,6 @@ from typing import Any, Dict, Optional, Union -from pydantic import BaseModel, Field +from pydantic import BaseModel, Extra, Field from ..parameter_location import ParameterLocation from .example import Example @@ -36,6 +36,7 @@ class Parameter(BaseModel): content: Optional[Dict[str, MediaType]] = None class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow allow_population_by_field_name = True schema_extra = { "examples": [ diff --git a/openapi_python_client/schema/openapi_schema_pydantic/path_item.py b/openapi_python_client/schema/openapi_schema_pydantic/path_item.py index d0b3598dd..af1a1a6a3 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/path_item.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/path_item.py @@ -1,6 +1,6 @@ from typing import List, Optional, Union -from pydantic import BaseModel, Field +from pydantic import BaseModel, Extra, Field from .operation import Operation from .parameter import Parameter @@ -35,6 +35,7 @@ class PathItem(BaseModel): parameters: Optional[List[Union[Parameter, Reference]]] = None class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow allow_population_by_field_name = True schema_extra = { "examples": [ diff --git a/openapi_python_client/schema/openapi_schema_pydantic/reference.py b/openapi_python_client/schema/openapi_schema_pydantic/reference.py index ad21a2fe0..3e99d0d8e 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/reference.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/reference.py @@ -1,4 +1,4 @@ -from pydantic import BaseModel, Field +from pydantic import BaseModel, Extra, Field class Reference(BaseModel): @@ -19,6 +19,7 @@ class Reference(BaseModel): ref: str = Field(alias="$ref") class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow allow_population_by_field_name = True schema_extra = { "examples": [{"$ref": "#/components/schemas/Pet"}, {"$ref": "Pet.json"}, {"$ref": "definitions.json#/Pet"}] diff --git a/openapi_python_client/schema/openapi_schema_pydantic/request_body.py b/openapi_python_client/schema/openapi_schema_pydantic/request_body.py index 1b0df2ea3..60b5cda5d 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/request_body.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/request_body.py @@ -1,6 +1,6 @@ from typing import Dict, Optional -from pydantic import BaseModel +from pydantic import BaseModel, Extra from .media_type import MediaType @@ -18,6 +18,7 @@ class RequestBody(BaseModel): required: bool = False class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = { "examples": [ { diff --git a/openapi_python_client/schema/openapi_schema_pydantic/response.py b/openapi_python_client/schema/openapi_schema_pydantic/response.py index a8723b124..a690ebebb 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/response.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/response.py @@ -1,6 +1,6 @@ from typing import Dict, Optional, Union -from pydantic import BaseModel +from pydantic import BaseModel, Extra from .header import Header from .link import Link @@ -24,6 +24,7 @@ class Response(BaseModel): links: Optional[Dict[str, Union[Link, Reference]]] = None class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = { "examples": [ { diff --git a/openapi_python_client/schema/openapi_schema_pydantic/schema.py b/openapi_python_client/schema/openapi_schema_pydantic/schema.py index bfd0b2719..f8cfa51e8 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/schema.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/schema.py @@ -1,6 +1,6 @@ from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel, Field, StrictInt, StrictStr +from pydantic import BaseModel, Extra, Field, StrictInt, StrictStr from ..data_type import DataType from .discriminator import Discriminator @@ -37,9 +37,9 @@ class Schema(BaseModel): required: Optional[List[str]] = Field(default=None, min_items=1) enum: Union[None, List[Optional[StrictInt]], List[Optional[StrictStr]]] = Field(default=None, min_items=1) type: Optional[DataType] = Field(default=None) - allOf: Optional[List[Union[Reference, "Schema"]]] = None - oneOf: List[Union[Reference, "Schema"]] = [] - anyOf: List[Union[Reference, "Schema"]] = [] + allOf: List[Union[Reference, "Schema"]] = Field(default_factory=list) + oneOf: List[Union[Reference, "Schema"]] = Field(default_factory=list) + anyOf: List[Union[Reference, "Schema"]] = Field(default_factory=list) schema_not: Optional[Union[Reference, "Schema"]] = Field(default=None, alias="not") items: Optional[Union[Reference, "Schema"]] = None properties: Optional[Dict[str, Union[Reference, "Schema"]]] = None @@ -57,6 +57,7 @@ class Schema(BaseModel): deprecated: Optional[bool] = None class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow allow_population_by_field_name = True schema_extra = { "examples": [ diff --git a/openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py b/openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py index 25ee2df8f..1e16ffcdc 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py @@ -1,6 +1,6 @@ from typing import Optional -from pydantic import AnyUrl, BaseModel, Field +from pydantic import AnyUrl, BaseModel, Extra, Field from .oauth_flows import OAuthFlows @@ -29,6 +29,7 @@ class SecurityScheme(BaseModel): openIdConnectUrl: Optional[AnyUrl] = None class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow allow_population_by_field_name = True schema_extra = { "examples": [ diff --git a/openapi_python_client/schema/openapi_schema_pydantic/server.py b/openapi_python_client/schema/openapi_schema_pydantic/server.py index 9a37b566a..3850cea0f 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/server.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/server.py @@ -1,6 +1,6 @@ from typing import Dict, Optional -from pydantic import BaseModel +from pydantic import BaseModel, Extra from .server_variable import ServerVariable @@ -18,6 +18,7 @@ class Server(BaseModel): variables: Optional[Dict[str, ServerVariable]] = None class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = { "examples": [ {"url": "https://development.gigantic-server.com/v1", "description": "Development server"}, diff --git a/openapi_python_client/schema/openapi_schema_pydantic/server_variable.py b/openapi_python_client/schema/openapi_schema_pydantic/server_variable.py index f6286f883..5a51b50da 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/server_variable.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/server_variable.py @@ -1,6 +1,6 @@ from typing import List, Optional -from pydantic import BaseModel +from pydantic import BaseModel, Extra class ServerVariable(BaseModel): @@ -14,3 +14,6 @@ class ServerVariable(BaseModel): enum: Optional[List[str]] = None default: str description: Optional[str] = None + + class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow diff --git a/openapi_python_client/schema/openapi_schema_pydantic/tag.py b/openapi_python_client/schema/openapi_schema_pydantic/tag.py index cf112fc47..e4ff5f362 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/tag.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/tag.py @@ -1,6 +1,6 @@ from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, Extra from .external_documentation import ExternalDocumentation @@ -20,4 +20,5 @@ class Tag(BaseModel): externalDocs: Optional[ExternalDocumentation] = None class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = {"examples": [{"name": "pet", "description": "Pets operations"}]} diff --git a/openapi_python_client/schema/openapi_schema_pydantic/xml.py b/openapi_python_client/schema/openapi_schema_pydantic/xml.py index ddb0e7205..bc6106222 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/xml.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/xml.py @@ -1,6 +1,6 @@ from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, Extra class XML(BaseModel): @@ -23,6 +23,7 @@ class XML(BaseModel): wrapped: bool = False class Config: # pylint: disable=missing-class-docstring + extra = Extra.allow schema_extra = { "examples": [ {"namespace": "http://example.com/schema/sample", "prefix": "sample"},