Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions openapi_schema_pydantic/v3/v3_1_0/_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from pydantic import Extra


class DefaultConfig:
extra = Extra.ignore
6 changes: 3 additions & 3 deletions openapi_schema_pydantic/v3/v3_1_0/components.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import Dict, Optional, Union

from pydantic import BaseModel, Extra
from pydantic import BaseModel

from ._config import DefaultConfig
from .callback import Callback
from .example import Example
from .header import Header
Expand Down Expand Up @@ -52,8 +53,7 @@ class Components(BaseModel):
pathItems: Optional[Dict[str, Union[PathItem, Reference]]] = None
"""An object to hold reusable [Path Item Object](#pathItemObject)."""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
schema_extra = {
"examples": [
{
Expand Down
5 changes: 3 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from pydantic import AnyUrl, BaseModel, Extra

from ._config import DefaultConfig


class Contact(BaseModel):
"""
Expand All @@ -25,8 +27,7 @@ class Contact(BaseModel):
MUST be in the form of an email address.
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
schema_extra = {
"examples": [
{"name": "API Support", "url": "http://www.example.com/support", "email": "[email protected]"}
Expand Down
5 changes: 3 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/discriminator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from pydantic import BaseModel, Extra

from ._config import DefaultConfig


class Discriminator(BaseModel):
"""
Expand All @@ -24,8 +26,7 @@ class Discriminator(BaseModel):
An object to hold mappings between payload values and schema names or references.
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
schema_extra = {
"examples": [
{
Expand Down
4 changes: 2 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pydantic import BaseModel, Extra

from ._config import DefaultConfig
from .reference import Reference


Expand Down Expand Up @@ -67,8 +68,7 @@ class Encoding(BaseModel):
then the value of [`contentType`](#encodingContentType) (implicit or explicit) SHALL be ignored.
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
schema_extra = {
"examples": [
{
Expand Down
6 changes: 3 additions & 3 deletions openapi_schema_pydantic/v3/v3_1_0/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

from pydantic import BaseModel, Extra

from ._config import DefaultConfig

class Example(BaseModel):

class Example(BaseModel):
summary: Optional[str] = None
"""
Short description for the example.
Expand Down Expand Up @@ -33,8 +34,7 @@ class Example(BaseModel):
See the rules for resolving [Relative References](#relativeReferencesURI).
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
schema_extra = {
"examples": [
{"summary": "A foo example", "value": {"foo": "bar"}},
Expand Down
4 changes: 2 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/external_documentation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Optional

from ._config import DefaultConfig
from pydantic import AnyUrl, BaseModel, Extra


Expand All @@ -18,6 +19,5 @@ class ExternalDocumentation(BaseModel):
Value MUST be in the form of a URL.
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
schema_extra = {"examples": [{"description": "Find more info here", "url": "https://example.com"}]}
4 changes: 2 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/header.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pydantic import Extra, Field

from ._config import DefaultConfig
from .parameter import Parameter


Expand All @@ -16,8 +17,7 @@ class Header(Parameter):
name = Field(default="", const=True)
param_in = Field(default="header", const=True, alias="in")

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
allow_population_by_field_name = True
schema_extra = {
"examples": [
Expand Down
4 changes: 2 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pydantic import AnyUrl, BaseModel, Extra

from ._config import DefaultConfig
from .contact import Contact
from .license import License

Expand Down Expand Up @@ -51,8 +52,7 @@ class Info(BaseModel):
(which is distinct from the [OpenAPI Specification version](#oasVersion) or the API implementation version).
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
schema_extra = {
"examples": [
{
Expand Down
4 changes: 2 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/license.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Optional

from pydantic import AnyUrl, BaseModel, Extra
from ._config import DefaultConfig


class License(BaseModel):
Expand All @@ -26,8 +27,7 @@ class License(BaseModel):
The `url` field is mutually exclusive of the `identifier` field.
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
schema_extra = {
"examples": [
{"name": "Apache 2.0", "identifier": "Apache-2.0"},
Expand Down
4 changes: 2 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pydantic import BaseModel, Extra

from ._config import DefaultConfig
from .server import Server


Expand Down Expand Up @@ -62,8 +63,7 @@ class Link(BaseModel):
A server object to be used by the target operation.
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
schema_extra = {
"examples": [
{"operationId": "getUserAddressByUUID", "parameters": {"userUuid": "$response.body#/uuid"}},
Expand Down
4 changes: 2 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/media_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pydantic import BaseModel, Extra, Field

from ._config import DefaultConfig
from .encoding import Encoding
from .example import Example
from .reference import Reference
Expand Down Expand Up @@ -48,8 +49,7 @@ class MediaType(BaseModel):
when the media type is `multipart` or `application/x-www-form-urlencoded`.
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
allow_population_by_field_name = True
schema_extra = {
"examples": [
Expand Down
5 changes: 3 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/oauth_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from pydantic import AnyUrl, BaseModel, Extra

from ._config import DefaultConfig


class OAuthFlow(BaseModel):
"""
Expand Down Expand Up @@ -38,8 +40,7 @@ class OAuthFlow(BaseModel):
The map MAY be empty.
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
schema_extra = {
"examples": [
{
Expand Down
5 changes: 3 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/oauth_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pydantic import BaseModel, Extra

from ._config import DefaultConfig
from .oauth_flow import OAuthFlow


Expand Down Expand Up @@ -34,5 +35,5 @@ class OAuthFlows(BaseModel):
Previously called `accessCode` in OpenAPI 2.0.
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
pass
5 changes: 3 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/open_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pydantic import BaseModel, Extra

from ._config import DefaultConfig
from .components import Components
from .external_documentation import ExternalDocumentation
from .info import Info
Expand Down Expand Up @@ -86,5 +87,5 @@ class OpenAPI(BaseModel):
Additional external documentation.
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
pass
4 changes: 2 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pydantic import BaseModel, Extra

from ._config import DefaultConfig
from .callback import Callback
from .external_documentation import ExternalDocumentation
from .parameter import Parameter
Expand Down Expand Up @@ -106,8 +107,7 @@ class Operation(BaseModel):
it will be overridden by this value.
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
schema_extra = {
"examples": [
{
Expand Down
4 changes: 2 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pydantic import BaseModel, Field, Extra

from ._config import DefaultConfig
from .example import Example
from .media_type import MediaType
from .reference import Reference
Expand Down Expand Up @@ -140,8 +141,7 @@ class Parameter(BaseModel):
The map MUST only contain one entry.
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
allow_population_by_field_name = True
schema_extra = {
"examples": [
Expand Down
4 changes: 2 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/path_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pydantic import BaseModel, Extra, Field

from ._config import DefaultConfig
from .operation import Operation
from .parameter import Parameter
from .reference import Reference
Expand Down Expand Up @@ -92,8 +93,7 @@ class PathItem(BaseModel):
[OpenAPI Object's components/parameters](#componentsParameters).
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
allow_population_by_field_name = True
schema_extra = {
"examples": [
Expand Down
5 changes: 3 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from pydantic import BaseModel, Extra, Field

from ._config import DefaultConfig


class Reference(BaseModel):
"""
Expand Down Expand Up @@ -29,8 +31,7 @@ class Reference(BaseModel):
If the referenced object-type does not allow a `description` field, then this field has no effect.
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
allow_population_by_field_name = True
schema_extra = {
"examples": [{"$ref": "#/components/schemas/Pet"}, {"$ref": "Pet.json"}, {"$ref": "definitions.json#/Pet"}]
Expand Down
4 changes: 2 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/request_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pydantic import BaseModel, Extra

from ._config import DefaultConfig
from .media_type import MediaType


Expand Down Expand Up @@ -30,8 +31,7 @@ class RequestBody(BaseModel):
Determines if the request body is required in the request. Defaults to `false`.
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
schema_extra = {
"examples": [
{
Expand Down
4 changes: 2 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pydantic import BaseModel, Extra

from ._config import DefaultConfig
from .header import Header
from .link import Link
from .media_type import MediaType
Expand Down Expand Up @@ -43,8 +44,7 @@ class Response(BaseModel):
following the naming constraints of the names for [Component Objects](#componentsObject).
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
schema_extra = {
"examples": [
{
Expand Down
1 change: 1 addition & 0 deletions openapi_schema_pydantic/v3/v3_1_0/responses.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Dict, Union

from ._config import DefaultConfig
from .response import Response
from .reference import Reference

Expand Down
5 changes: 3 additions & 2 deletions openapi_schema_pydantic/v3/v3_1_0/schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from typing import Any, Dict, List, Optional, Union

from pydantic import BaseModel, Extra, Field

from ._config import DefaultConfig
from .discriminator import Discriminator
from .external_documentation import ExternalDocumentation
from .reference import Reference
Expand Down Expand Up @@ -830,8 +832,7 @@ class Schema(BaseModel):
Use of example is discouraged, and later versions of this specification may remove it.
"""

class Config:
extra = Extra.ignore
class Config(DefaultConfig):
allow_population_by_field_name = True
schema_extra = {
"examples": [
Expand Down
Loading