Skip to content

Commit 4b9c873

Browse files
authored
Merge pull request mike-oakley#11 from mike-oakley/u/mike/fix-relative-url-support
fix: Relative URL support and Callbacks forward references.
2 parents 2143405 + 530be1f commit 4b9c873

17 files changed

+160
-85
lines changed

openapi_pydantic/v3/v3_0_3/__init__.py

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,39 @@
66
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#table-of-contents
77
"""
88

9-
from .open_api import OpenAPI as OpenAPI
10-
from .info import Info as Info
11-
from .contact import Contact as Contact
12-
from .license import License as License
13-
from .server import Server as Server
14-
from .server_variable import ServerVariable as ServerVariable
9+
from .callback import Callback as Callback
1510
from .components import Components as Components
16-
from .paths import Paths as Paths
17-
from .path_item import PathItem as PathItem
18-
from .operation import Operation as Operation
19-
from .external_documentation import ExternalDocumentation as ExternalDocumentation
20-
from .parameter import Parameter as Parameter, ParameterLocation as ParameterLocation
21-
from .request_body import RequestBody as RequestBody
22-
from .media_type import MediaType as MediaType
11+
from .contact import Contact as Contact
12+
from .discriminator import Discriminator as Discriminator
2313
from .encoding import Encoding as Encoding
24-
from .responses import Responses as Responses
25-
from .response import Response as Response
26-
from .callback import Callback as Callback
2714
from .example import Example as Example
28-
from .link import Link as Link
15+
from .external_documentation import ExternalDocumentation as ExternalDocumentation
2916
from .header import Header as Header
30-
from .tag import Tag as Tag
17+
from .info import Info as Info
18+
from .license import License as License
19+
from .link import Link as Link
20+
from .media_type import MediaType as MediaType
21+
from .oauth_flow import OAuthFlow as OAuthFlow
22+
from .oauth_flows import OAuthFlows as OAuthFlows
23+
from .open_api import OpenAPI as OpenAPI
24+
from .operation import Operation as Operation
25+
from .parameter import Parameter as Parameter
26+
from .parameter import ParameterLocation as ParameterLocation
27+
from .path_item import PathItem as PathItem
28+
from .paths import Paths as Paths
3129
from .reference import Reference as Reference
30+
from .request_body import RequestBody as RequestBody
31+
from .response import Response as Response
32+
from .responses import Responses as Responses
3233
from .schema import Schema as Schema
33-
from .discriminator import Discriminator as Discriminator
34-
from .xml import XML as XML
35-
from .security_scheme import SecurityScheme as SecurityScheme
36-
from .oauth_flows import OAuthFlows as OAuthFlows
37-
from .oauth_flow import OAuthFlow as OAuthFlow
3834
from .security_requirement import SecurityRequirement as SecurityRequirement
39-
35+
from .security_scheme import SecurityScheme as SecurityScheme
36+
from .server import Server as Server
37+
from .server_variable import ServerVariable as ServerVariable
38+
from .tag import Tag as Tag
39+
from .xml import XML as XML
4040

4141
# resolve forward references
4242
Encoding.update_forward_refs(Header=Header)
4343
Schema.update_forward_refs()
44+
Operation.update_forward_refs(PathItem=PathItem)

openapi_pydantic/v3/v3_0_3/contact.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Optional
22

3-
from pydantic import AnyUrl, BaseModel, Extra
3+
from pydantic import BaseModel, Extra
44

55

66
class Contact(BaseModel):
@@ -13,7 +13,7 @@ class Contact(BaseModel):
1313
The identifying name of the contact person/organization.
1414
"""
1515

16-
url: Optional[AnyUrl] = None
16+
url: Optional[str] = None
1717
"""
1818
The URL pointing to the contact information.
1919
MUST be in the format of a URL.

openapi_pydantic/v3/v3_0_3/external_documentation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Optional
22

3-
from pydantic import AnyUrl, BaseModel, Extra
3+
from pydantic import BaseModel, Extra
44

55

66
class ExternalDocumentation(BaseModel):
@@ -13,7 +13,7 @@ class ExternalDocumentation(BaseModel):
1313
representation.
1414
"""
1515

16-
url: AnyUrl
16+
url: str
1717
"""
1818
**REQUIRED**. The URL for the target documentation.
1919
Value MUST be in the format of a URL.

openapi_pydantic/v3/v3_0_3/info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Optional
22

3-
from pydantic import AnyUrl, BaseModel, Extra
3+
from pydantic import BaseModel, Extra
44

55
from .contact import Contact
66
from .license import License
@@ -25,7 +25,7 @@ class Info(BaseModel):
2525
representation.
2626
"""
2727

28-
termsOfService: Optional[AnyUrl] = None
28+
termsOfService: Optional[str] = None
2929
"""
3030
A URL to the Terms of Service for the API.
3131
MUST be in the format of a URL.

openapi_pydantic/v3/v3_0_3/license.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Optional
22

3-
from pydantic import AnyUrl, BaseModel, Extra
3+
from pydantic import BaseModel, Extra
44

55

66
class License(BaseModel):
@@ -13,7 +13,7 @@ class License(BaseModel):
1313
**REQUIRED**. The license name used for the API.
1414
"""
1515

16-
url: Optional[AnyUrl] = None
16+
url: Optional[str] = None
1717
"""
1818
A URL to the license used for the API.
1919
MUST be in the format of a URL.

openapi_pydantic/v3/v3_0_3/oauth_flow.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
from typing import Dict, Optional, Union
1+
from typing import Dict, Optional
22

3-
from pydantic import AnyUrl, BaseModel, Extra
3+
from pydantic import BaseModel, Extra
44

55

66
class OAuthFlow(BaseModel):
77
"""
88
Configuration details for a supported OAuth Flow
99
"""
1010

11-
authorizationUrl: Optional[Union[AnyUrl, str]] = None
11+
authorizationUrl: Optional[str] = None
1212
"""
1313
**REQUIRED** for `oauth2 ("implicit", "authorizationCode")`.
1414
The authorization URL to be used for this flow.
1515
This MUST be in the form of a URL.
1616
"""
1717

18-
tokenUrl: Optional[Union[AnyUrl, str]] = None
18+
tokenUrl: Optional[str] = None
1919
"""
2020
**REQUIRED** for `oauth2 ("password", "clientCredentials", "authorizationCode")`.
2121
The token URL to be used for this flow.
2222
This MUST be in the form of a URL.
2323
"""
2424

25-
refreshUrl: Optional[Union[AnyUrl, str]] = None
25+
refreshUrl: Optional[str] = None
2626
"""
2727
The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.
2828
"""

openapi_pydantic/v3/v3_0_3/security_scheme.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from typing import Optional, Union
1+
from typing import Optional
22

3-
from pydantic import AnyUrl, BaseModel, Extra, Field
3+
from pydantic import BaseModel, Extra, Field
44

55
from .oauth_flows import OAuthFlows
66

@@ -63,7 +63,7 @@ class SecurityScheme(BaseModel):
6363
flow types supported.
6464
"""
6565

66-
openIdConnectUrl: Optional[Union[AnyUrl, str]] = None
66+
openIdConnectUrl: Optional[str] = None
6767
"""
6868
**REQUIRED** for `openIdConnect`. OpenId Connect URL to discover OAuth2
6969
configuration values. This MUST be in the form of a URL.

openapi_pydantic/v3/v3_1_0/__init__.py

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,39 @@
66
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#table-of-contents
77
"""
88

9-
from .open_api import OpenAPI as OpenAPI
10-
from .info import Info as Info
11-
from .contact import Contact as Contact
12-
from .license import License as License
13-
from .server import Server as Server
14-
from .server_variable import ServerVariable as ServerVariable
9+
from .callback import Callback as Callback
1510
from .components import Components as Components
16-
from .paths import Paths as Paths
17-
from .path_item import PathItem as PathItem
18-
from .operation import Operation as Operation
19-
from .external_documentation import ExternalDocumentation as ExternalDocumentation
20-
from .parameter import Parameter as Parameter, ParameterLocation as ParameterLocation
21-
from .request_body import RequestBody as RequestBody
22-
from .media_type import MediaType as MediaType
11+
from .contact import Contact as Contact
12+
from .discriminator import Discriminator as Discriminator
2313
from .encoding import Encoding as Encoding
24-
from .responses import Responses as Responses
25-
from .response import Response as Response
26-
from .callback import Callback as Callback
2714
from .example import Example as Example
28-
from .link import Link as Link
15+
from .external_documentation import ExternalDocumentation as ExternalDocumentation
2916
from .header import Header as Header
30-
from .tag import Tag as Tag
17+
from .info import Info as Info
18+
from .license import License as License
19+
from .link import Link as Link
20+
from .media_type import MediaType as MediaType
21+
from .oauth_flow import OAuthFlow as OAuthFlow
22+
from .oauth_flows import OAuthFlows as OAuthFlows
23+
from .open_api import OpenAPI as OpenAPI
24+
from .operation import Operation as Operation
25+
from .parameter import Parameter as Parameter
26+
from .parameter import ParameterLocation as ParameterLocation
27+
from .path_item import PathItem as PathItem
28+
from .paths import Paths as Paths
3129
from .reference import Reference as Reference
30+
from .request_body import RequestBody as RequestBody
31+
from .response import Response as Response
32+
from .responses import Responses as Responses
3233
from .schema import Schema as Schema
33-
from .discriminator import Discriminator as Discriminator
34-
from .xml import XML as XML
35-
from .security_scheme import SecurityScheme as SecurityScheme
36-
from .oauth_flows import OAuthFlows as OAuthFlows
37-
from .oauth_flow import OAuthFlow as OAuthFlow
3834
from .security_requirement import SecurityRequirement as SecurityRequirement
35+
from .security_scheme import SecurityScheme as SecurityScheme
36+
from .server import Server as Server
37+
from .server_variable import ServerVariable as ServerVariable
38+
from .tag import Tag as Tag
39+
from .xml import XML as XML
3940

4041
# resolve forward references
4142
Encoding.update_forward_refs(Header=Header)
4243
Schema.update_forward_refs()
44+
Operation.update_forward_refs(PathItem=PathItem)

openapi_pydantic/v3/v3_1_0/contact.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Optional
22

3-
from pydantic import AnyUrl, BaseModel, Extra
3+
from pydantic import BaseModel, Extra
44

55

66
class Contact(BaseModel):
@@ -13,7 +13,7 @@ class Contact(BaseModel):
1313
The identifying name of the contact person/organization.
1414
"""
1515

16-
url: Optional[AnyUrl] = None
16+
url: Optional[str] = None
1717
"""
1818
The URL pointing to the contact information.
1919
MUST be in the form of a URL.

openapi_pydantic/v3/v3_1_0/external_documentation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Optional
22

3-
from pydantic import AnyUrl, BaseModel, Extra
3+
from pydantic import BaseModel, Extra
44

55

66
class ExternalDocumentation(BaseModel):
@@ -13,7 +13,7 @@ class ExternalDocumentation(BaseModel):
1313
representation.
1414
"""
1515

16-
url: AnyUrl
16+
url: str
1717
"""
1818
**REQUIRED**. The URL for the target documentation.
1919
Value MUST be in the form of a URL.

0 commit comments

Comments
 (0)