diff --git a/openapi_python_client/parser/properties/__init__.py b/openapi_python_client/parser/properties/__init__.py index 908745a6a..65dfe42f5 100644 --- a/openapi_python_client/parser/properties/__init__.py +++ b/openapi_python_client/parser/properties/__init__.py @@ -352,6 +352,7 @@ def build_union_property( *, data: oai.Schema, name: str, required: bool, schemas: Schemas, parent_name: str, config: Config ) -> Tuple[Union[UnionProperty, PropertyError], Schemas]: 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}", @@ -439,8 +440,8 @@ def _property_from_data( if isinstance(data, oai.Reference): return _property_from_ref(name=name, required=required, parent=None, data=data, schemas=schemas) + 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) diff --git a/openapi_python_client/parser/properties/model_property.py b/openapi_python_client/parser/properties/model_property.py index a40460886..7ed00553d 100644 --- a/openapi_python_client/parser/properties/model_property.py +++ b/openapi_python_client/parser/properties/model_property.py @@ -88,7 +88,7 @@ def _check_existing(prop: Property) -> Union[Property, PropertyError]: return prop_or_error 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..9d95ffe89 --- /dev/null +++ b/openapi_python_client/schema/openapi_schema_pydantic/callback.py @@ -0,0 +1,22 @@ +from typing import TYPE_CHECKING, Dict + +if TYPE_CHECKING: + from .path_item import PathItem + +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. +""" + +"""Patterned Fields""" + +# {expression}: 'PathItem' = ... +""" +A Path Item Object used to define a callback request and expected responses. + +A [complete example](../examples/v3.0/callback-example.yaml) is available. +""" diff --git a/openapi_python_client/schema/openapi_schema_pydantic/components.py b/openapi_python_client/schema/openapi_schema_pydantic/components.py index 8ad888906..a9a2f0339 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 @@ -44,7 +45,11 @@ class Components(BaseModel): links: Optional[Dict[str, Union[Link, Reference]]] = None """An object to hold reusable [Link Objects](#linkObject).""" + callbacks: Optional[Dict[str, Union[Callback, Reference]]] = None + """An object to hold reusable [Callback Objects](#callbackObject).""" + class Config: + 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 c41aa8406..cbe2fb8eb 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): @@ -26,6 +26,7 @@ class Contact(BaseModel): """ class Config: + 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 1dfd06a5b..c2deb5a17 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): @@ -25,6 +25,7 @@ class Discriminator(BaseModel): """ class Config: + 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 9bf2ea177..a9c08a67e 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/encoding.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/encoding.py @@ -1,9 +1,12 @@ -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: + from .header import Header + class Encoding(BaseModel): """A single encoding definition applied to a single schema property.""" @@ -22,7 +25,7 @@ class Encoding(BaseModel): or a comma-separated list of the two types. """ - headers: Optional[Dict[str, Reference]] = None + headers: Optional[Dict[str, Union["Header", Reference]]] = None """ A map allowing additional information to be provided as headers, for example `Content-Disposition`. @@ -60,6 +63,7 @@ class Encoding(BaseModel): """ class Config: + 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 6da3710b1..4ac234b37 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): @@ -33,6 +33,7 @@ class Example(BaseModel): """ class Config: + 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 92676a2ae..467c98150 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): @@ -19,4 +19,5 @@ class ExternalDocumentation(BaseModel): """ class Config: + 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 5e59e8a66..8d6ee2ff1 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 @@ -18,6 +18,7 @@ class Header(Parameter): param_in = Field(default=ParameterLocation.HEADER, const=True, alias="in") class Config: + 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 36caba733..fcff5b742 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 @@ -47,6 +47,7 @@ class Info(BaseModel): """ class Config: + 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 567a5d117..7e8b7f3d9 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): @@ -20,4 +20,5 @@ class License(BaseModel): """ class Config: + 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 97bbc8aeb..de1403a8c 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 @@ -63,6 +63,7 @@ class Link(BaseModel): """ class Config: + 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 7c00d3bc1..387f33b92 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 @@ -49,6 +49,7 @@ class MediaType(BaseModel): """ class Config: + 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 cdf474bee..7b3c93bfe 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): @@ -15,7 +15,7 @@ class OAuthFlow(BaseModel): This MUST be in the form of a URL. """ - tokenUrl: Optional[str] = None + tokenUrl: Optional[AnyUrl] = None """ **REQUIRED** for `oauth2 ("password", "clientCredentials", "authorizationCode")`. The token URL to be used for this flow. @@ -35,6 +35,7 @@ class OAuthFlow(BaseModel): """ class Config: + 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 fcb9ba348..e23b3d5dd 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 @@ -33,3 +33,6 @@ class OAuthFlows(BaseModel): Previously called `accessCode` in OpenAPI 2.0. """ + + class Config: + 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 dd480a8f5..cbfaa2038 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/open_api.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/open_api.py @@ -1,6 +1,6 @@ from typing import List, Optional -from pydantic import BaseModel +from pydantic import BaseModel, Extra from .components import Components from .external_documentation import ExternalDocumentation @@ -58,3 +58,6 @@ class OpenAPI(BaseModel): """ Additional external documentation. """ + + class Config: + 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 860c3c24a..98b2bd2ad 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 @@ -70,6 +71,14 @@ class Operation(BaseModel): **REQUIRED**. The list of possible responses as they are returned from executing this operation. """ + callbacks: Optional[Dict[str, Callback]] = None + """ + A map of possible out-of band callbacks related to the parent operation. + The key is a unique identifier for the Callback Object. + Each value in the map is a [Callback Object](#callbackObject) + that describes a request that may be initiated by the API provider and the expected responses. + """ + deprecated: bool = False """ Declares this operation to be deprecated. @@ -95,6 +104,7 @@ class Operation(BaseModel): """ class Config: + 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 52f1b6885..56070a720 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 @@ -26,7 +26,7 @@ class Parameter(BaseModel): - If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to a template expression occurring within the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information. - - If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`. + - If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored. - For all other cases, the `name` corresponds to the parameter name used by the [`in`](#parameterIn) property. """ @@ -142,6 +142,7 @@ class Parameter(BaseModel): """ class Config: + 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 911c1e805..cdbd6b564 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 @@ -92,6 +92,7 @@ class PathItem(BaseModel): """ class Config: + 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 7803b3a54..851b28301 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): @@ -16,6 +16,7 @@ class Reference(BaseModel): """**REQUIRED**. The reference string.""" class Config: + 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 626b795d7..3f7a602d9 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 @@ -31,6 +31,7 @@ class RequestBody(BaseModel): """ class Config: + 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 8c8e539ec..24899815e 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 @@ -44,6 +44,7 @@ class Response(BaseModel): """ class Config: + 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 5941d79f5..87492eadc 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 +from pydantic import BaseModel, Extra, Field from .discriminator import Discriminator from .external_documentation import ExternalDocumentation @@ -224,7 +224,7 @@ class Schema(BaseModel): types defined by keyword. Recall: "number" includes "integer". """ - allOf: Optional[List[Union[Reference, "Schema"]]] = None + allOf: List[Union[Reference, "Schema"]] = Field(default_factory=list) """ **From OpenAPI spec: Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.** @@ -241,7 +241,7 @@ class Schema(BaseModel): value. """ - oneOf: List[Union[Reference, "Schema"]] = [] + oneOf: List[Union[Reference, "Schema"]] = Field(default_factory=list) """ **From OpenAPI spec: Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.** @@ -258,7 +258,7 @@ class Schema(BaseModel): keyword's value. """ - anyOf: List[Union[Reference, "Schema"]] = [] + anyOf: List[Union[Reference, "Schema"]] = Field(default_factory=list) """ **From OpenAPI spec: Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.** @@ -472,6 +472,7 @@ class Schema(BaseModel): """ class Config: + 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 aee65bc2b..7bd3b4e8e 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 @@ -66,6 +66,7 @@ class SecurityScheme(BaseModel): """ class Config: + 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 43c511f34..949fec8c8 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 @@ -31,6 +31,7 @@ class Server(BaseModel): """ class Config: + 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 224c79411..8aa4fac46 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): @@ -26,3 +26,6 @@ class ServerVariable(BaseModel): An optional description for the server variable. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. """ + + class Config: + 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 531de02b4..1db40d325 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 @@ -28,4 +28,5 @@ class Tag(BaseModel): """ class Config: + 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 9ddaf13e3..cfc9c64cb 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): @@ -48,6 +48,7 @@ class XML(BaseModel): """ class Config: + extra = Extra.allow schema_extra = { "examples": [ {"namespace": "http://example.com/schema/sample", "prefix": "sample"},