Skip to content

Commit 26a994a

Browse files
Format with black, ignore E501
1 parent c886893 commit 26a994a

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[flake8]
22
exclude = __pycache__,built,build,venv
3-
ignore = E203, E266, W503
3+
ignore = E203, E266, W503, E501
44
max-line-length = 88
55
max-complexity = 18
66
per-file-ignores =

openapidocs/v3.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class ParameterLocation(Enum):
2323
PATH: Parameter is part of the URL path.
2424
COOKIE: Parameter is passed as a cookie.
2525
"""
26+
2627
QUERY = "query"
2728
HEADER = "header"
2829
PATH = "path"
@@ -42,6 +43,7 @@ class ValueType(Enum):
4243
STRING: Represents a string type.
4344
NULL: Represents a null value.
4445
"""
46+
4547
ARRAY = "array"
4648
BOOLEAN = "boolean"
4749
INTEGER = "integer"
@@ -88,6 +90,7 @@ class ValueFormat(Enum):
8890
RELATIVEJSONPOINTER: Relative JSON pointer.
8991
REGEX: Regular expression.
9092
"""
93+
9194
BASE64 = "base64"
9295
BINARY = "binary"
9396
BYTE = "byte"
@@ -131,6 +134,7 @@ class SecuritySchemeType(Enum):
131134
OPENIDCONNECT: Alternative name for OpenID Connect security scheme.
132135
MUTUALTLS: Security scheme using mutual TLS authentication.
133136
"""
137+
134138
APIKEY = "apiKey"
135139
HTTP = "http"
136140
OAUTH = "oauth2"
@@ -150,6 +154,7 @@ class Contact(OpenAPIElement):
150154
url (Optional[str]): The URL pointing to the contact information.
151155
email (Optional[str]): The email address of the contact person/organization.
152156
"""
157+
153158
name: Optional[str] = None
154159
url: Optional[str] = None
155160
email: Optional[str] = None
@@ -164,6 +169,7 @@ class ExternalDocs(OpenAPIElement):
164169
url (str): The URL for the external documentation.
165170
description (Optional[str]): A description of the external documentation.
166171
"""
172+
167173
url: str
168174
description: Optional[str] = None
169175

@@ -178,6 +184,7 @@ class License(OpenAPIElement):
178184
identifier (Optional[str]): An SPDX license identifier.
179185
url (Optional[str]): A URL to the license used for the API.
180186
"""
187+
181188
name: str
182189
identifier: Optional[str] = None
183190
url: Optional[str] = None
@@ -197,6 +204,7 @@ class Info(OpenAPIElement):
197204
contact (Optional[Contact]): Contact information for the API.
198205
license (Optional[License]): License information for the API.
199206
"""
207+
200208
title: str
201209
version: str
202210
summary: Optional[str] = None
@@ -216,6 +224,7 @@ class ServerVariable(OpenAPIElement):
216224
description (Optional[str]): An optional description for the server variable.
217225
enum (Optional[List[str]]): An enumeration of string values to be used if the substitution options are limited to a specific set.
218226
"""
227+
219228
default: str
220229
description: Optional[str] = None
221230
enum: Optional[List[str]] = None
@@ -231,6 +240,7 @@ class Server(OpenAPIElement):
231240
description (Optional[str]): An optional string describing the host designated by the URL.
232241
variables (Optional[Dict[str, ServerVariable]]): A map between variable names and their definitions.
233242
"""
243+
234244
url: str
235245
description: Optional[str] = None
236246
variables: Optional[Dict[str, ServerVariable]] = None
@@ -248,6 +258,7 @@ class XML(OpenAPIElement):
248258
attribute (Optional[bool]): Whether the property is an attribute.
249259
wrapped (Optional[bool]): Whether the array is wrapped.
250260
"""
261+
251262
name: Optional[str] = None
252263
namespace: Optional[str] = None
253264
prefix: Optional[str] = None
@@ -264,6 +275,7 @@ class Discriminator(OpenAPIElement):
264275
property_name (str): The name of the property in the payload that will hold the discriminator value.
265276
mapping (Optional[Dict[str, str]]): An optional mapping from payload values to schema names or references.
266277
"""
278+
267279
property_name: str
268280
mapping: Optional[Dict[str, str]] = None
269281

@@ -340,6 +352,7 @@ class Schema(OpenAPIElement):
340352
not_ (Optional[List[Union["Schema", "Reference"]]]):
341353
A schema that must not apply.
342354
"""
355+
343356
type: Union[None, str, ValueType, List[Union[None, str, ValueType]]] = None
344357
format: Union[None, str, ValueFormat] = None
345358
required: Optional[List[str]] = None
@@ -382,6 +395,7 @@ class Header(OpenAPIElement):
382395
description (Optional[str]): A description of the header.
383396
schema (Union[None, Schema, "Reference"]): The schema defining the type used for the header.
384397
"""
398+
385399
description: Optional[str] = None
386400
schema: Union[None, Schema, "Reference"] = None
387401

@@ -397,6 +411,7 @@ class Example(OpenAPIElement):
397411
value (Any): The embedded literal example. This field and external_value are mutually exclusive.
398412
external_value (Optional[str]): A URL that points to the literal example. This field and value are mutually exclusive.
399413
"""
414+
400415
summary: Optional[str] = None
401416
description: Optional[str] = None
402417
value: Any = None
@@ -416,6 +431,7 @@ class Reference(OpenAPIElement):
416431
description (Optional[str]): A description which by default should override that of the
417432
referenced component.
418433
"""
434+
419435
ref: str
420436
summary: Optional[str] = None
421437
description: Optional[str] = None
@@ -441,6 +457,7 @@ class Encoding(OpenAPIElement):
441457
explode (Optional[bool]): When style is form, the default value is true, otherwise the default value is false.
442458
allow_reserved (Optional[bool]): Determines whether the parameter value should allow reserved characters.
443459
"""
460+
444461
content_type: Optional[str] = None
445462
headers: Optional[Dict[str, Union[Header, Reference]]] = None
446463
style: Optional[str] = None
@@ -461,6 +478,7 @@ class Link(OpenAPIElement):
461478
description (Optional[str]): A description of the link.
462479
server (Optional[Server]): A server object to be used by the target operation.
463480
"""
481+
464482
operation_ref: Optional[str] = None
465483
operation_id: Optional[str] = None
466484
parameters: Optional[Dict[str, Any]] = None
@@ -479,6 +497,7 @@ class MediaType(OpenAPIElement):
479497
examples (Optional[Dict[str, Union[Example, Reference]]]): Examples of the media type with their values.
480498
encoding (Optional[Dict[str, Encoding]]): A map between property names and their encoding information.
481499
"""
500+
482501
schema: Union[None, Schema, Reference] = None
483502
examples: Optional[Dict[str, Union[Example, Reference]]] = None
484503
encoding: Optional[Dict[str, Encoding]] = None
@@ -495,6 +514,7 @@ class Response(OpenAPIElement):
495514
content (Optional[Dict[str, Union[MediaType, Reference]]]): A map containing descriptions of potential response payloads.
496515
links (Optional[Dict[str, Union[Link, Reference]]]): A map of operations that can be called from the response.
497516
"""
517+
498518
description: Optional[str] = None
499519
headers: Optional[Dict[str, Union[Header, Reference]]] = None
500520
content: Optional[Dict[str, Union[MediaType, Reference]]] = None
@@ -518,6 +538,7 @@ class Parameter(OpenAPIElement):
518538
example (Optional[Any]): Example of the parameter's potential value.
519539
examples (Optional[Dict[str, Union[Example, Reference]]]): Examples of the parameter's potential value.
520540
"""
541+
521542
name: str
522543
in_: ParameterLocation
523544
schema: Union[None, Schema, Reference] = None
@@ -540,6 +561,7 @@ class RequestBody(OpenAPIElement):
540561
description (Optional[str]): A brief description of the request body.
541562
required (Optional[bool]): Determines whether the request body is required in the API call.
542563
"""
564+
543565
content: Dict[str, MediaType]
544566
description: Optional[str] = None
545567
required: Optional[bool] = None
@@ -554,6 +576,7 @@ class SecurityRequirement(OpenAPIElement):
554576
name (str): The name of the security scheme to use.
555577
value (List[str]): List of scope names required for the execution. Empty list means no scopes.
556578
"""
579+
557580
name: str
558581
value: List[str]
559582

@@ -580,6 +603,7 @@ class Operation(OpenAPIElement):
580603
security (Optional[List[SecurityRequirement]]): Security requirements for this operation.
581604
servers (Optional[List[Server]]): Servers that provide this operation.
582605
"""
606+
583607
responses: Dict[str, Response]
584608
tags: Optional[List[str]] = None
585609
summary: Optional[str] = None
@@ -617,6 +641,7 @@ class PathItem(OpenAPIElement):
617641
servers (Optional[List[Server]]): Servers overriding the global servers for this path.
618642
parameters (Optional[List[Union[Parameter, Reference]]]): Parameters common to all operations on this path.
619643
"""
644+
620645
summary: Optional[str] = None
621646
ref: Optional[str] = None
622647
description: Optional[str] = None
@@ -646,6 +671,7 @@ class Callback(OpenAPIElement):
646671
path (Union[PathItem, Reference]): The path item object or reference that defines
647672
the operations available on the callback destination.
648673
"""
674+
649675
expression: str
650676
path: Union[PathItem, Reference]
651677

@@ -669,6 +695,7 @@ class OAuthFlow(OpenAPIElement):
669695
Required for password, clientCredentials, and authorizationCode flows.
670696
refresh_url (Optional[str]): The URL to be used for obtaining refresh tokens.
671697
"""
698+
672699
scopes: Dict[str, str]
673700
authorization_url: Optional[str] = None
674701
token_url: Optional[str] = None
@@ -689,6 +716,7 @@ class OAuthFlows(OpenAPIElement):
689716
client_credentials (Optional[OAuthFlow]): Configuration for the OAuth Client Credentials flow.
690717
authorization_code (Optional[OAuthFlow]): Configuration for the OAuth Authorization Code flow.
691718
"""
719+
692720
implicit: Optional[OAuthFlow] = None
693721
password: Optional[OAuthFlow] = None
694722
client_credentials: Optional[OAuthFlow] = None
@@ -714,6 +742,7 @@ class HTTPSecurity(SecurityScheme):
714742
bearer_format (Optional[str]): A hint to the client to identify how the bearer token is formatted.
715743
For example, "JWT" for JSON Web Tokens.
716744
"""
745+
717746
scheme: str
718747
type: SecuritySchemeType = SecuritySchemeType.HTTP
719748
description: Optional[str] = None
@@ -735,6 +764,7 @@ class APIKeySecurity(SecurityScheme):
735764
type (SecuritySchemeType): The type of the security scheme, always APIKEY for this class.
736765
description (Optional[str]): A description of the security scheme.
737766
"""
767+
738768
name: str
739769
in_: ParameterLocation
740770
type: SecuritySchemeType = SecuritySchemeType.APIKEY
@@ -755,6 +785,7 @@ class OAuth2Security(SecurityScheme):
755785
type (SecuritySchemeType): The type of the security scheme, always OAUTH2 for this class.
756786
description (Optional[str]): A description of the security scheme.
757787
"""
788+
758789
flows: OAuthFlows
759790
type: SecuritySchemeType = SecuritySchemeType.OAUTH2
760791
description: Optional[str] = None
@@ -774,6 +805,7 @@ class OpenIdConnectSecurity(SecurityScheme):
774805
type (SecuritySchemeType): The type of the security scheme, always OPENIDCONNECT for this class.
775806
description (Optional[str]): A description of the security scheme.
776807
"""
808+
777809
open_id_connect_url: str
778810
type: SecuritySchemeType = SecuritySchemeType.OPENIDCONNECT
779811
description: Optional[str] = None
@@ -791,6 +823,7 @@ class MutualTLSSecurity(SecurityScheme):
791823
type (SecuritySchemeType): The type of the security scheme, always MUTUALTLS for this class.
792824
description (Optional[str]): A description of the security scheme.
793825
"""
826+
794827
type: SecuritySchemeType = SecuritySchemeType.MUTUALTLS
795828
description: Optional[str] = None
796829

@@ -822,6 +855,7 @@ class Components(OpenAPIElement):
822855
path_items (Optional[Dict[str, Union[PathItem, Reference]]]):
823856
A dictionary of reusable PathItem Objects or references to them.
824857
"""
858+
825859
schemas: Optional[Dict[str, Union[Schema, Reference]]] = None
826860
responses: Optional[Dict[str, Union[Response, Reference]]] = None
827861
parameters: Optional[Dict[str, Union[Parameter, Reference]]] = None
@@ -847,6 +881,7 @@ class Tag(OpenAPIElement):
847881
description (Optional[str]): A short description of the tag.
848882
external_docs (Optional[ExternalDocs]): Additional external documentation for this tag.
849883
"""
884+
850885
name: str
851886
description: Optional[str] = None
852887
external_docs: Optional[ExternalDocs] = None
@@ -866,6 +901,7 @@ class Security(OpenAPIElement):
866901
optional (bool): When set to True, indicates that security is optional by adding an
867902
empty security requirement at the beginning of the list.
868903
"""
904+
869905
requirements: List[SecurityRequirement]
870906
optional: bool = False
871907

@@ -898,6 +934,7 @@ class OpenAPI(OpenAPIRoot):
898934
external_docs (Optional[ExternalDocs]): Additional external documentation.
899935
webhooks (Optional[Dict[str, Union[PathItem, Reference]]]): Webhook definitions that MAY be called by the API provider.
900936
"""
937+
901938
openapi: str = "3.1.0"
902939
info: Optional[Info] = None
903940
json_schema_dialect: str = "https://json-schema.org/draft/2020-12/schema"

0 commit comments

Comments
 (0)