diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
index 2fe0a5b27..3780fe5f3 100644
--- a/.github/workflows/checks.yml
+++ b/.github/workflows/checks.yml
@@ -50,6 +50,9 @@ jobs:
- name: Run mypy
run: poetry run mypy --show-error-codes openapi_python_client
+ - name: Run pylint
+ run: poetry run pylint openapi_python_client
+
- name: Run pytest
run: poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests/test_end_to_end.py
diff --git a/openapi_python_client/__init__.py b/openapi_python_client/__init__.py
index b1458e1a4..ebf6c3fda 100644
--- a/openapi_python_client/__init__.py
+++ b/openapi_python_client/__init__.py
@@ -28,6 +28,8 @@
class MetaType(str, Enum):
+ """The types of metadata supported for project generation."""
+
NONE = "none"
POETRY = "poetry"
SETUP = "setup"
@@ -41,7 +43,9 @@ class MetaType(str, Enum):
}
-class Project:
+class Project: # pylint: disable=too-many-instance-attributes
+ """Represents a Python project (the top level file-tree) to generate"""
+
def __init__(
self,
*,
@@ -129,6 +133,7 @@ def _reformat(self) -> None:
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
+ check=True,
)
subprocess.run(
"isort .",
@@ -136,8 +141,11 @@ def _reformat(self) -> None:
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
+ check=True,
+ )
+ subprocess.run(
+ "black .", cwd=self.project_dir, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True
)
- subprocess.run("black .", cwd=self.project_dir, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
def _get_errors(self) -> Sequence[GeneratorError]:
errors = []
@@ -263,7 +271,7 @@ def _build_api(self) -> None:
module_path.write_text(endpoint_template.render(endpoint=endpoint), encoding=self.file_encoding)
-def _get_project_for_url_or_path(
+def _get_project_for_url_or_path( # pylint: disable=too-many-arguments
url: Optional[str],
path: Optional[Path],
meta: MetaType,
diff --git a/openapi_python_client/cli.py b/openapi_python_client/cli.py
index d122bd592..954e66fed 100644
--- a/openapi_python_client/cli.py
+++ b/openapi_python_client/cli.py
@@ -27,28 +27,28 @@ def _process_config(path: Optional[pathlib.Path]) -> Config:
try:
return Config.load_from_path(path=path)
- except: # noqa
- raise typer.BadParameter("Unable to parse config")
+ except Exception as err:
+ raise typer.BadParameter("Unable to parse config") from err
# noinspection PyUnusedLocal
+# pylint: disable=unused-argument
@app.callback(name="openapi-python-client")
def cli(
version: bool = typer.Option(False, "--version", callback=_version_callback, help="Print the version and exit"),
) -> None:
"""Generate a Python client from an OpenAPI JSON document"""
- pass
-def _print_parser_error(e: GeneratorError, color: str) -> None:
- typer.secho(e.header, bold=True, fg=color, err=True)
+def _print_parser_error(err: GeneratorError, color: str) -> None:
+ typer.secho(err.header, bold=True, fg=color, err=True)
typer.echo()
- if e.detail:
- typer.secho(e.detail, fg=color, err=True)
+ if err.detail:
+ typer.secho(err.detail, fg=color, err=True)
typer.echo()
- if isinstance(e, ParseError) and e.data is not None:
- formatted_data = pformat(e.data)
+ if isinstance(err, ParseError) and err.data is not None:
+ formatted_data = pformat(err.data)
typer.secho(formatted_data, fg=color, err=True)
typer.echo()
@@ -111,6 +111,7 @@ def handle_errors(errors: Sequence[GeneratorError], fail_on_warning: bool = Fals
CONFIG_OPTION = typer.Option(None, "--config", help="Path to the config file to use")
+# pylint: disable=too-many-arguments
@app.command()
def generate(
url: Optional[str] = typer.Option(None, help="A URL to read the JSON from"),
@@ -133,9 +134,9 @@ def generate(
try:
codecs.getencoder(file_encoding)
- except LookupError:
+ except LookupError as err:
typer.secho("Unknown encoding : {}".format(file_encoding), fg=typer.colors.RED)
- raise typer.Exit(code=1)
+ raise typer.Exit(code=1) from err
config = _process_config(config_path)
errors = create_new_client(
@@ -149,6 +150,7 @@ def generate(
handle_errors(errors, fail_on_warning)
+# pylint: disable=too-many-arguments
@app.command()
def update(
url: Optional[str] = typer.Option(None, help="A URL to read the JSON from"),
@@ -171,9 +173,9 @@ def update(
try:
codecs.getencoder(file_encoding)
- except LookupError:
+ except LookupError as err:
typer.secho("Unknown encoding : {}".format(file_encoding), fg=typer.colors.RED)
- raise typer.Exit(code=1)
+ raise typer.Exit(code=1) from err
config = _process_config(config_path)
errors = update_existing_client(
diff --git a/openapi_python_client/config.py b/openapi_python_client/config.py
index d93cef6ae..d9bd9e18e 100644
--- a/openapi_python_client/config.py
+++ b/openapi_python_client/config.py
@@ -6,11 +6,21 @@
class ClassOverride(BaseModel):
+ """An override of a single generated class.
+
+ See https://github.com/openapi-generators/openapi-python-client#class_overrides
+ """
+
class_name: Optional[str] = None
module_name: Optional[str] = None
class Config(BaseModel):
+ """Contains any configurable values passed by the user.
+
+ See https://github.com/openapi-generators/openapi-python-client#configuration
+ """
+
class_overrides: Dict[str, ClassOverride] = {}
project_name_override: Optional[str]
package_name_override: Optional[str]
diff --git a/openapi_python_client/parser/errors.py b/openapi_python_client/parser/errors.py
index 562e54428..dfa2d54cb 100644
--- a/openapi_python_client/parser/errors.py
+++ b/openapi_python_client/parser/errors.py
@@ -40,4 +40,4 @@ class PropertyError(ParseError):
class ValidationError(Exception):
- pass
+ """Used internally to exit quickly from property parsing due to some internal exception."""
diff --git a/openapi_python_client/parser/openapi.py b/openapi_python_client/parser/openapi.py
index ff733a496..3cc59370e 100644
--- a/openapi_python_client/parser/openapi.py
+++ b/openapi_python_client/parser/openapi.py
@@ -81,6 +81,7 @@ def generate_operation_id(*, path: str, method: str) -> str:
return f"{method}_{clean_path}"
+# pylint: disable=too-many-instance-attributes
@dataclass
class Endpoint:
"""
@@ -244,10 +245,32 @@ def _add_responses(
endpoint.responses.append(response)
return endpoint, schemas
+ # pylint: disable=too-many-return-statements
@staticmethod
def add_parameters(
*, endpoint: "Endpoint", data: Union[oai.Operation, oai.PathItem], schemas: Schemas, config: Config
) -> Tuple[Union["Endpoint", ParseError], Schemas]:
+ """Process the defined `parameters` for an Endpoint.
+
+ Any existing parameters will be ignored, so earlier instances of a parameter take precedence. PathItem
+ parameters should therefore be added __after__ operation parameters.
+
+ Args:
+ endpoint: The endpoint to add parameters to.
+ data: The Operation or PathItem to add parameters from.
+ schemas: The cumulative Schemas of processing so far which should contain details for any references.
+ config: User-provided config for overrides within parameters.
+
+ Returns:
+ `(result, schemas)` where `result` is either an updated Endpoint containing the parameters or a ParseError
+ describing what went wrong. `schemas` is an updated version of the `schemas` input, adding any new enums
+ or classes.
+
+ See Also:
+ - https://swagger.io/docs/specification/describing-parameters/
+ - https://swagger.io/docs/specification/paths-and-operations/
+ """
+
endpoint = deepcopy(endpoint)
if data.parameters is None:
return endpoint, schemas
@@ -329,6 +352,16 @@ def add_parameters(
@staticmethod
def sort_parameters(*, endpoint: "Endpoint") -> Union["Endpoint", ParseError]:
+ """
+ Sorts the path parameters of an `endpoint` so that they match the order declared in `endpoint.path`.
+
+ Args:
+ endpoint: The endpoint to sort the parameters of.
+
+ Returns:
+ Either an updated `endpoint` with sorted path parameters or a `ParseError` if something was wrong with
+ the path parameters and they could not be sorted.
+ """
endpoint = deepcopy(endpoint)
parameters_from_path = re.findall(_PATH_PARAM_REGEX, endpoint.path)
try:
@@ -338,8 +371,8 @@ def sort_parameters(*, endpoint: "Endpoint") -> Union["Endpoint", ParseError]:
endpoint.path_parameters = OrderedDict((param.name, param) for param in sorted_params)
except ValueError:
pass # We're going to catch the difference down below
- path_parameter_names = [name for name in endpoint.path_parameters]
- if parameters_from_path != path_parameter_names:
+
+ if parameters_from_path != list(endpoint.path_parameters):
return ParseError(
detail=f"Incorrect path templating for {endpoint.path} (Path parameters do not match with path)",
)
@@ -397,22 +430,17 @@ class GeneratorData:
enums: Iterator[EnumProperty]
@staticmethod
- def from_dict(d: Dict[str, Any], *, config: Config) -> Union["GeneratorData", GeneratorError]:
+ def from_dict(data: Dict[str, Any], *, config: Config) -> Union["GeneratorData", GeneratorError]:
"""Create an OpenAPI from dict"""
try:
- openapi = oai.OpenAPI.parse_obj(d)
- except ValidationError as e:
- detail = str(e)
- if "swagger" in d:
+ openapi = oai.OpenAPI.parse_obj(data)
+ except ValidationError as err:
+ detail = str(err)
+ if "swagger" in data:
detail = (
"You may be trying to use a Swagger document; this is not supported by this project.\n\n" + detail
)
return GeneratorError(header="Failed to parse OpenAPI document", detail=detail)
- if openapi.openapi.major != 3:
- return GeneratorError(
- header="openapi-python-client only supports OpenAPI 3.x",
- detail=f"The version of the provided document was {openapi.openapi}",
- )
schemas = Schemas()
if openapi.components and openapi.components.schemas:
schemas = build_schemas(components=openapi.components.schemas, schemas=schemas, config=config)
diff --git a/openapi_python_client/parser/properties/__init__.py b/openapi_python_client/parser/properties/__init__.py
index 839ef05ff..b1701959f 100644
--- a/openapi_python_client/parser/properties/__init__.py
+++ b/openapi_python_client/parser/properties/__init__.py
@@ -184,11 +184,11 @@ def __attrs_post_init__(self) -> None:
def _get_inner_type_strings(self, json: bool = False) -> Set[str]:
return {p.get_type_string(no_optional=True, json=json) for p in self.inner_properties}
- def _get_type_string_from_inner_type_strings(self, inner_types: Set[str]) -> str:
+ @staticmethod
+ def _get_type_string_from_inner_type_strings(inner_types: Set[str]) -> str:
if len(inner_types) == 1:
return inner_types.pop()
- else:
- return f"Union[{', '.join(sorted(inner_types))}]"
+ return f"Union[{', '.join(sorted(inner_types))}]"
def get_base_type_string(self) -> str:
return self._get_type_string_from_inner_type_strings(self._get_inner_type_strings(json=False))
@@ -197,6 +197,18 @@ def get_base_json_type_string(self) -> str:
return self._get_type_string_from_inner_type_strings(self._get_inner_type_strings(json=True))
def get_type_strings_in_union(self, no_optional: bool = False, json: bool = False) -> Set[str]:
+ """
+ Get the set of all the types that should appear within the `Union` representing this property.
+
+ This function is called from the union property macros, thus the public visibility.
+
+ Args:
+ no_optional: Do not include `None` or `Unset` in this set.
+ json: If True, this returns the JSON types, not the Python types, of this property.
+
+ Returns:
+ A set of strings containing the types that should appear within `Union`.
+ """
type_strings = self._get_inner_type_strings(json=json)
if no_optional:
return type_strings
@@ -230,6 +242,11 @@ def get_imports(self, *, prefix: str) -> Set[str]:
return imports
def inner_properties_with_template(self) -> Iterator[Property]:
+ """
+ Get all the properties that make up this `Union`.
+
+ Called by the union property macros to aid in construction / deserialization.
+ """
return (prop for prop in self.inner_properties if prop.template)
@@ -247,7 +264,7 @@ def _string_based_property(
nullable=data.nullable,
python_name=python_name,
)
- elif string_format == "date":
+ if string_format == "date":
return DateProperty(
name=name,
required=required,
@@ -255,7 +272,7 @@ def _string_based_property(
nullable=data.nullable,
python_name=python_name,
)
- elif string_format == "binary":
+ if string_format == "binary":
return FileProperty(
name=name,
required=required,
@@ -263,15 +280,14 @@ def _string_based_property(
nullable=data.nullable,
python_name=python_name,
)
- else:
- return StringProperty(
- name=name,
- default=convert("str", data.default),
- required=required,
- pattern=data.pattern,
- nullable=data.nullable,
- python_name=python_name,
- )
+ return StringProperty(
+ name=name,
+ default=convert("str", data.default),
+ required=required,
+ pattern=data.pattern,
+ nullable=data.nullable,
+ python_name=python_name,
+ )
def build_enum_property(
@@ -342,20 +358,49 @@ def build_enum_property(
return prop, schemas
-def get_enum_default(prop: EnumProperty, data: oai.Schema) -> Union[Optional[Any], PropertyError]:
- if data.default is None:
+def get_enum_default(prop: EnumProperty, data: oai.Schema) -> Union[Optional[str], PropertyError]:
+ """
+ Run through the available values in an EnumProperty and return the string representing the default value
+ in `data`.
+
+ Args:
+ prop: The EnumProperty to search for the default value.
+ data: The schema containing the default value for this enum.
+
+ Returns:
+ If `default` is `None`, then `None`.
+ If `default` is a valid value in `prop`, then the string representing that variant (e.g. MyEnum.MY_VARIANT)
+ If `default` is a value that doesn't match a variant of the enum, then a `PropertyError`.
+ """
+ default = data.default
+ if default is None:
return None
inverse_values = {v: k for k, v in prop.values.items()}
try:
- return f"{prop.class_info.name}.{inverse_values[data.default]}"
+ return f"{prop.class_info.name}.{inverse_values[default]}"
except KeyError:
- return PropertyError(detail=f"{data.default} is an invalid default for enum {prop.class_info.name}", data=data)
+ return PropertyError(detail=f"{default} is an invalid default for enum {prop.class_info.name}", data=data)
def build_union_property(
*, data: oai.Schema, name: str, required: bool, schemas: Schemas, parent_name: str, config: Config
) -> Tuple[Union[UnionProperty, PropertyError], Schemas]:
+ """
+ Create a `UnionProperty` the right way.
+
+ Args:
+ data: The `Schema` describing the `UnionProperty`.
+ name: The name of the property where it appears in the OpenAPI document.
+ required: Whether or not this property is required where it's being used.
+ schemas: The `Schemas` so far describing existing classes / references.
+ parent_name: The name of the thing which holds this property (used for renaming inner classes).
+ config: User-defined config values for modifying inner properties.
+
+ Returns:
+ `(result, schemas)` where `schemas` is the updated version of the input `schemas` and `result` is the
+ 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(
@@ -370,7 +415,7 @@ def build_union_property(
return PropertyError(detail=f"Invalid property in union {name}", data=sub_prop_data), schemas
sub_properties.append(sub_prop)
- default = convert_chain((prop._type_string for prop in sub_properties), data.default)
+ default = convert_chain((prop.get_base_type_string() for prop in sub_properties), data.default)
return (
UnionProperty(
name=name,
@@ -387,6 +432,21 @@ def build_union_property(
def build_list_property(
*, data: oai.Schema, name: str, required: bool, schemas: Schemas, parent_name: str, config: Config
) -> Tuple[Union[ListProperty[Any], PropertyError], Schemas]:
+ """
+ Build a ListProperty the right way, use this instead of the normal constructor.
+
+ Args:
+ data: `oai.Schema` representing this `ListProperty`.
+ name: The name of this property where it's used.
+ required: Whether or not this `ListProperty` can be `Unset` where it's used.
+ schemas: Collected `Schemas` so far containing any classes or references.
+ parent_name: The name of the thing containing this property (used for naming inner classes).
+ config: User-provided config for overriding default behaviors.
+
+ Returns:
+ `(result, schemas)` where `schemas` is an updated version of the input named the same including any inner
+ classes that were defined and `result` is either the `ListProperty` or a `PropertyError`.
+ """
if data.items is None:
return PropertyError(data=data, detail="type array must have items defined"), schemas
inner_prop, schemas = property_from_data(
@@ -407,6 +467,7 @@ def build_list_property(
)
+# pylint: disable=too-many-arguments
def _property_from_ref(
name: str,
required: bool,
@@ -439,6 +500,7 @@ def _property_from_ref(
return prop, schemas
+# pylint: disable=too-many-arguments,too-many-return-statements
def _property_from_data(
name: str,
required: bool,
@@ -469,13 +531,13 @@ def _property_from_data(
parent_name=parent_name,
config=config,
)
- elif data.anyOf or data.oneOf:
+ if data.anyOf or data.oneOf:
return build_union_property(
data=data, name=name, required=required, schemas=schemas, parent_name=parent_name, config=config
)
- elif data.type == "string":
+ if data.type == "string":
return _string_based_property(name=name, required=required, data=data, config=config), schemas
- elif data.type == "number":
+ if data.type == "number":
return (
FloatProperty(
name=name,
@@ -486,7 +548,7 @@ def _property_from_data(
),
schemas,
)
- elif data.type == "integer":
+ if data.type == "integer":
return (
IntProperty(
name=name,
@@ -497,7 +559,7 @@ def _property_from_data(
),
schemas,
)
- elif data.type == "boolean":
+ if data.type == "boolean":
return (
BooleanProperty(
name=name,
@@ -508,15 +570,15 @@ def _property_from_data(
),
schemas,
)
- elif data.type == "array":
+ if data.type == "array":
return build_list_property(
data=data, name=name, required=required, schemas=schemas, parent_name=parent_name, config=config
)
- elif data.type == "object" or data.allOf:
+ if data.type == "object" or data.allOf:
return build_model_property(
data=data, name=name, schemas=schemas, required=required, parent_name=parent_name, config=config
)
- elif not data.type:
+ if not data.type:
return (
AnyProperty(
name=name,
diff --git a/openapi_python_client/parser/properties/converter.py b/openapi_python_client/parser/properties/converter.py
index d8556e118..9b8f27073 100644
--- a/openapi_python_client/parser/properties/converter.py
+++ b/openapi_python_client/parser/properties/converter.py
@@ -1,15 +1,13 @@
""" Utils for converting default values into valid Python """
__all__ = ["convert", "convert_chain"]
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+from typing import Any, Callable, Dict, Iterable, Optional
from dateutil.parser import isoparse
from ... import utils
from ..errors import ValidationError
-T = TypeVar("T")
-
def convert(type_string: str, value: Any) -> Optional[Any]:
"""
@@ -31,8 +29,8 @@ def convert(type_string: str, value: Any) -> Optional[Any]:
raise ValidationError()
try:
return _CONVERTERS[type_string](value)
- except (KeyError, ValueError, AttributeError) as e:
- raise ValidationError from e
+ except (KeyError, ValueError, AttributeError) as err:
+ raise ValidationError from err
def convert_chain(type_strings: Iterable[str], value: Any) -> Optional[Any]:
diff --git a/openapi_python_client/parser/properties/enum_property.py b/openapi_python_client/parser/properties/enum_property.py
index cdee94b5e..ef8f144e0 100644
--- a/openapi_python_client/parser/properties/enum_property.py
+++ b/openapi_python_client/parser/properties/enum_property.py
@@ -22,10 +22,10 @@ class EnumProperty(Property):
template: ClassVar[str] = "enum_property.py.jinja"
- def get_base_type_string(self, json: bool = False) -> str:
+ def get_base_type_string(self) -> str:
return self.class_info.name
- def get_base_json_type_string(self, json: bool = False) -> str:
+ def get_base_json_type_string(self) -> str:
return self.value_type.__name__
def get_imports(self, *, prefix: str) -> Set[str]:
diff --git a/openapi_python_client/parser/properties/model_property.py b/openapi_python_client/parser/properties/model_property.py
index aab642f0d..0cfb7a902 100644
--- a/openapi_python_client/parser/properties/model_property.py
+++ b/openapi_python_client/parser/properties/model_property.py
@@ -28,7 +28,7 @@ class ModelProperty(Property):
json_is_dict: ClassVar[bool] = True
is_multipart_body: bool = False
- def get_base_type_string(self, json: bool = False) -> str:
+ def get_base_type_string(self) -> str:
return self.class_info.name
def get_imports(self, *, prefix: str) -> Set[str]:
@@ -71,10 +71,11 @@ def _enum_subset(first: Property, second: Property) -> Optional[EnumProperty]:
if isinstance(second, EnumProperty):
if _values_are_subset(first, second):
return first
- if _values_are_subset(second, first):
+ if _values_are_subset(second, first): # pylint: disable=arguments-out-of-order
return second
return None
return first if _types_are_subset(first, second) else None
+ # pylint: disable=arguments-out-of-order
if isinstance(second, EnumProperty) and _types_are_subset(second, first):
return second
return None
@@ -110,6 +111,7 @@ class _PropertyData(NamedTuple):
schemas: Schemas
+# pylint: disable=too-many-locals,too-many-branches
def _process_properties(
*, data: oai.Schema, schemas: Schemas, class_name: str, config: Config
) -> Union[_PropertyData, PropertyError]:
diff --git a/openapi_python_client/parser/properties/property.py b/openapi_python_client/parser/properties/property.py
index 41e6a2b75..af1135bf6 100644
--- a/openapi_python_client/parser/properties/property.py
+++ b/openapi_python_client/parser/properties/property.py
@@ -35,12 +35,20 @@ class Property:
json_is_dict: ClassVar[bool] = False
def set_python_name(self, new_name: str, config: Config) -> None:
+ """Mutates this Property to set a new python_name.
+
+ Required to mutate due to how Properties are stored and the difficulty of updating them in-dict.
+ `new_name` will be validated before it is set, so `python_name` is not guaranteed to equal `new_name` after
+ calling this.
+ """
object.__setattr__(self, "python_name", PythonIdentifier(value=new_name, prefix=config.field_prefix))
def get_base_type_string(self) -> str:
+ """Get the string describing the Python type of this property."""
return self._type_string
def get_base_json_type_string(self) -> str:
+ """Get the string describing the JSON type of this property."""
return self._json_type_string
def get_type_string(self, no_optional: bool = False, json: bool = False) -> str:
@@ -58,12 +66,12 @@ def get_type_string(self, no_optional: bool = False, json: bool = False) -> str:
if no_optional or (self.required and not self.nullable):
return type_string
- elif self.required and self.nullable:
+ if self.required and self.nullable:
return f"Optional[{type_string}]"
- elif not self.required and self.nullable:
+ if not self.required and self.nullable:
return f"Union[Unset, None, {type_string}]"
- else:
- return f"Union[Unset, {type_string}]"
+
+ return f"Union[Unset, {type_string}]"
def get_instance_type_string(self) -> str:
"""Get a string representation of runtime type that should be used for `isinstance` checks"""
@@ -98,5 +106,4 @@ def to_string(self) -> str:
if default is not None:
return f"{self.python_name}: {self.get_type_string()} = {default}"
- else:
- return f"{self.python_name}: {self.get_type_string()}"
+ return f"{self.python_name}: {self.get_type_string()}"
diff --git a/openapi_python_client/parser/properties/schemas.py b/openapi_python_client/parser/properties/schemas.py
index 71ecf3843..d1cfd63ba 100644
--- a/openapi_python_client/parser/properties/schemas.py
+++ b/openapi_python_client/parser/properties/schemas.py
@@ -13,7 +13,7 @@
if TYPE_CHECKING: # pragma: no cover
from .property import Property
else:
- Property = "Property"
+ Property = "Property" # pylint: disable=invalid-name
_ReferencePath = NewType("_ReferencePath", str)
@@ -21,6 +21,13 @@
def parse_reference_path(ref_path_raw: str) -> Union[_ReferencePath, ParseError]:
+ """
+ Takes a raw string provided in a `$ref` and turns it into a validated `_ReferencePath` or a `ParseError` if
+ validation fails.
+
+ See Also:
+ - https://swagger.io/docs/specification/using-ref/
+ """
parsed = urlparse(ref_path_raw)
if parsed.scheme or parsed.path:
return ParseError(detail=f"Remote references such as {ref_path_raw} are not supported yet.")
@@ -64,6 +71,21 @@ class Schemas:
def update_schemas_with_data(
*, ref_path: _ReferencePath, data: oai.Schema, schemas: Schemas, config: Config
) -> Union[Schemas, PropertyError]:
+ """
+ Update a `Schemas` using some new reference.
+
+ Args:
+ ref_path: The output of `parse_reference_path` (validated $ref).
+ data: The schema of the thing to add to Schemas.
+ schemas: `Schemas` up until now.
+ config: User-provided config for overriding default behavior.
+
+ Returns:
+ Either the updated `schemas` input or a `PropertyError` if something went wrong.
+
+ See Also:
+ - https://swagger.io/docs/specification/using-ref/
+ """
from . import property_from_data
prop: Union[PropertyError, Property]
diff --git a/openapi_python_client/schema/__init__.py b/openapi_python_client/schema/__init__.py
index aaf78eb39..b27693d77 100644
--- a/openapi_python_client/schema/__init__.py
+++ b/openapi_python_client/schema/__init__.py
@@ -13,40 +13,16 @@
]
-import re
-from typing import Callable, Iterator
-
-from .openapi_schema_pydantic import MediaType
-from .openapi_schema_pydantic import OpenAPI as _OpenAPI
-from .openapi_schema_pydantic import Operation, Parameter, PathItem, Reference, RequestBody, Response, Responses, Schema
+from .openapi_schema_pydantic import (
+ MediaType,
+ OpenAPI,
+ Operation,
+ Parameter,
+ PathItem,
+ Reference,
+ RequestBody,
+ Response,
+ Responses,
+ Schema,
+)
from .parameter_location import ParameterLocation
-
-regex = re.compile(r"(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)")
-
-
-class SemVer:
- def __init__(self, str_value: str) -> None:
- self.str_value = str_value
- if not isinstance(str_value, str):
- raise TypeError("string required")
- m = regex.fullmatch(str_value)
- if not m:
- raise ValueError("invalid semantic versioning format")
- self.major = int(m.group(1))
- self.minor = int(m.group(2))
- self.patch = int(m.group(3))
-
- @classmethod
- def __get_validators__(cls) -> Iterator[Callable[[str], "SemVer"]]:
- yield cls.validate
-
- @classmethod
- def validate(cls, v: str) -> "SemVer":
- return cls(v)
-
- def __str__(self) -> str:
- return self.str_value
-
-
-class OpenAPI(_OpenAPI):
- openapi: SemVer
diff --git a/openapi_python_client/schema/openapi_schema_pydantic/components.py b/openapi_python_client/schema/openapi_schema_pydantic/components.py
index 8ad888906..3798a5c13 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/components.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/components.py
@@ -18,33 +18,22 @@ class Components(BaseModel):
Holds a set of reusable objects for different aspects of the OAS.
All objects defined within the components object will have no effect on the API
unless they are explicitly referenced from properties outside the components object.
+
+ References:
+ - https://swagger.io/docs/specification/components/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#componentsObject
"""
schemas: Optional[Dict[str, Union[Reference, Schema]]] = None
- """An object to hold reusable [Schema Objects](#schemaObject)."""
-
responses: Optional[Dict[str, Union[Response, Reference]]] = None
- """An object to hold reusable [Response Objects](#responseObject)."""
-
parameters: Optional[Dict[str, Union[Parameter, Reference]]] = None
- """An object to hold reusable [Parameter Objects](#parameterObject)."""
-
examples: Optional[Dict[str, Union[Example, Reference]]] = None
- """An object to hold reusable [Example Objects](#exampleObject)."""
-
requestBodies: Optional[Dict[str, Union[RequestBody, Reference]]] = None
- """An object to hold reusable [Request Body Objects](#requestBodyObject)."""
-
headers: Optional[Dict[str, Union[Header, Reference]]] = None
- """An object to hold reusable [Header Objects](#headerObject)."""
-
securitySchemes: Optional[Dict[str, Union[SecurityScheme, Reference]]] = None
- """An object to hold reusable [Security Scheme Objects](#securitySchemeObject)."""
-
links: Optional[Dict[str, Union[Link, Reference]]] = None
- """An object to hold reusable [Link Objects](#linkObject)."""
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..236548ea9 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/contact.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/contact.py
@@ -6,26 +6,16 @@
class Contact(BaseModel):
"""
Contact information for the exposed API.
- """
- name: Optional[str] = None
- """
- The identifying name of the contact person/organization.
+ See Also:
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#contactObject
"""
+ name: Optional[str] = None
url: Optional[AnyUrl] = None
- """
- The URL pointing to the contact information.
- MUST be in the format of a URL.
- """
-
email: Optional[str] = None
- """
- The email address of the contact person/organization.
- MUST be in the format of an email address.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..1c84833c9 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/discriminator.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/discriminator.py
@@ -12,19 +12,16 @@ class Discriminator(BaseModel):
of an alternative schema based on the value associated with it.
When using the discriminator, _inline_ schemas will not be considered.
- """
- propertyName: str
- """
- **REQUIRED**. The name of the property in the payload that will hold the discriminator value.
+ References:
+ - https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#discriminatorObject
"""
+ propertyName: str
mapping: Optional[Dict[str, str]] = None
- """
- An object to hold mappings between payload values and schema names or references.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..89bec3f00 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/encoding.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/encoding.py
@@ -6,60 +6,20 @@
class Encoding(BaseModel):
- """A single encoding definition applied to a single schema property."""
+ """A single encoding definition applied to a single schema property.
- contentType: Optional[str] = None
- """
- The Content-Type for encoding a specific property.
- Default value depends on the property type:
-
- - for `string` with `format` being `binary` – `application/octet-stream`;
- - for other primitive types – `text/plain`;
- - for `object` - `application/json`;
- - for `array` – the default is defined based on the inner type.
-
- The value can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`),
- or a comma-separated list of the two types.
+ References:
+ - https://swagger.io/docs/specification/describing-request-body/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#encodingObject
"""
+ contentType: Optional[str] = None
headers: Optional[Dict[str, Reference]] = None
- """
- A map allowing additional information to be provided as headers, for example `Content-Disposition`.
-
- `Content-Type` is described separately and SHALL be ignored in this section.
- This property SHALL be ignored if the request body media type is not a `multipart`.
- """
-
style: Optional[str] = None
- """
- Describes how a specific property value will be serialized depending on its type.
-
- See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property.
- The behavior follows the same values as `query` parameters, including default values.
- This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`.
- """
-
explode: bool = False
- """
- When this is true, property values of type `array` or `object` generate separate parameters
- for each value of the array, or key-value-pair of the map.
-
- For other types of properties this property has no effect.
- When [`style`](#encodingStyle) is `form`, the default value is `true`.
- For all other styles, the default value is `false`.
- This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`.
- """
-
allowReserved: bool = False
- """
- Determines whether the parameter value SHOULD allow reserved characters,
- as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2)
- `:/?#[]@!$&'()*+,;=` to be included without percent-encoding.
- The default value is `false`.
- This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..b95df2b62 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/example.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/example.py
@@ -4,35 +4,19 @@
class Example(BaseModel):
+ """Examples added to parameters / components to help clarify usage.
- summary: Optional[str] = None
- """
- Short description for the example.
+ References:
+ - https://swagger.io/docs/specification/adding-examples/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#exampleObject
"""
+ summary: Optional[str] = None
description: Optional[str] = None
- """
- Long description for the example.
- [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
- """
-
value: Optional[Any] = None
- """
- Embedded literal example.
- The `value` field and `externalValue` field are mutually exclusive.
- To represent examples of media types that cannot naturally represented in JSON or YAML,
- use a string value to contain the example, escaping where necessary.
- """
-
externalValue: Optional[str] = None
- """
- A URL that points to the literal example.
- This provides the capability to reference examples that cannot easily be included in JSON or YAML documents.
-
- The `value` field and `externalValue` field are mutually exclusive.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..624a662a9 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py
@@ -4,19 +4,14 @@
class ExternalDocumentation(BaseModel):
- """Allows referencing an external resource for extended documentation."""
+ """Allows referencing an external resource for extended documentation.
- description: Optional[str] = None
- """
- A short description of the target documentation.
- [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
+ References:
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#externalDocumentationObject
"""
+ description: Optional[str] = None
url: AnyUrl
- """
- **REQUIRED**. The URL for the target documentation.
- Value MUST be in the format of a URL.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..69200a7fa 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/header.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/header.py
@@ -12,12 +12,16 @@ class Header(Parameter):
2. `in` MUST NOT be specified, it is implicitly in `header`.
3. All traits that are affected by the location MUST be applicable to a location of `header`
(for example, [`style`](#parameterStyle)).
+
+ References:
+ - https://swagger.io/docs/specification/describing-parameters/#header-parameters
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#headerObject
"""
name = Field(default="", const=True)
param_in = Field(default=ParameterLocation.HEADER, const=True, alias="in")
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..ea5337f50 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/info.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/info.py
@@ -11,42 +11,20 @@ class Info(BaseModel):
The object provides metadata about the API.
The metadata MAY be used by the clients if needed,
and MAY be presented in editing or documentation generation tools for convenience.
- """
- title: str
- """
- **REQUIRED**. The title of the API.
+ References:
+ - https://swagger.io/docs/specification/api-general-info/
+ -https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#infoObject
"""
+ title: str
description: Optional[str] = None
- """
- A short description of the API.
- [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
- """
-
termsOfService: Optional[AnyUrl] = None
- """
- A URL to the Terms of Service for the API.
- MUST be in the format of a URL.
- """
-
contact: Optional[Contact] = None
- """
- The contact information for the exposed API.
- """
-
license: Optional[License] = None
- """
- The license information for the exposed API.
- """
-
version: str
- """
- **REQUIRED**. The version of the OpenAPI document
- (which is distinct from the [OpenAPI Specification version](#oasVersion) or the API implementation version).
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..ca40f1ac5 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/license.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/license.py
@@ -6,18 +6,13 @@
class License(BaseModel):
"""
License information for the exposed API.
- """
- name: str
- """
- **REQUIRED**. The license name used for the API.
+ References:
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#licenseObject
"""
+ name: str
url: Optional[AnyUrl] = None
- """
- A URL to the license used for the API.
- MUST be in the format of a URL.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..965508123 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/link.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/link.py
@@ -17,52 +17,20 @@ class Link(BaseModel):
For computing links, and providing instructions to execute them,
a [runtime expression](#runtimeExpression) is used for accessing values in an operation
and using them as parameters while invoking the linked operation.
- """
- operationRef: Optional[str] = None
- """
- A relative or absolute URI reference to an OAS operation.
- This field is mutually exclusive of the `operationId` field,
- and MUST point to an [Operation Object](#operationObject).
- Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject)
- in the OpenAPI definition.
+ References:
+ - https://swagger.io/docs/specification/links/
+ - https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#linkObject
"""
+ operationRef: Optional[str] = None
operationId: Optional[str] = None
- """
- The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`.
-
- This field is mutually exclusive of the `operationRef` field.
- """
-
parameters: Optional[Dict[str, Any]] = None
- """
- A map representing parameters to pass to an operation
- as specified with `operationId` or identified via `operationRef`.
- The key is the parameter name to be used,
- whereas the value can be a constant or an expression to be evaluated and passed to the linked operation.
-
- The parameter name can be qualified using the [parameter location](#parameterIn) `[{in}.]{name}`
- for operations that use the same parameter name in different locations (e.g. path.id).
- """
-
requestBody: Optional[Any] = None
- """
- A literal value or [{expression}](#runtimeExpression) to use as a request body when calling the target operation.
- """
-
description: Optional[str] = None
- """
- A description of the link.
- [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
- """
-
server: Optional[Server] = None
- """
- A server object to be used by the target operation.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..e4eb4542a 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/media_type.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/media_type.py
@@ -9,46 +9,19 @@
class MediaType(BaseModel):
- """Each Media Type Object provides schema and examples for the media type identified by its key."""
+ """Each Media Type Object provides schema and examples for the media type identified by its key.
- media_type_schema: Optional[Union[Reference, Schema]] = Field(default=None, alias="schema")
- """
- The schema defining the content of the request, response, or parameter.
+ References:
+ - https://swagger.io/docs/specification/media-types/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#mediaTypeObject
"""
+ media_type_schema: Optional[Union[Reference, Schema]] = Field(default=None, alias="schema")
example: Optional[Any] = None
- """
- Example of the media type.
-
- The example object SHOULD be in the correct format as specified by the media type.
-
- The `example` field is mutually exclusive of the `examples` field.
-
- Furthermore, if referencing a `schema` which contains an example,
- the `example` value SHALL _override_ the example provided by the schema.
- """
-
examples: Optional[Dict[str, Union[Example, Reference]]] = None
- """
- Examples of the media type.
-
- Each example object SHOULD match the media type and specified schema if present.
-
- The `examples` field is mutually exclusive of the `example` field.
-
- Furthermore, if referencing a `schema` which contains an example,
- the `examples` value SHALL _override_ the example provided by the schema.
- """
-
encoding: Optional[Dict[str, Encoding]] = None
- """
- A map between a property name and its encoding information.
- The key, being the property name, MUST exist in the schema as a property.
- The encoding object SHALL only apply to `requestBody` objects
- when the media type is `multipart` or `application/x-www-form-urlencoded`.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..09a170acb 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/oauth_flow.py
@@ -6,35 +6,18 @@
class OAuthFlow(BaseModel):
"""
Configuration details for a supported OAuth Flow
- """
- authorizationUrl: Optional[AnyUrl] = None
- """
- **REQUIRED** for `oauth2 ("implicit", "authorizationCode")`.
- The authorization URL to be used for this flow.
- This MUST be in the form of a URL.
+ References:
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauthFlowObject
+ - https://swagger.io/docs/specification/authentication/oauth2/
"""
+ authorizationUrl: Optional[AnyUrl] = None
tokenUrl: Optional[str] = None
- """
- **REQUIRED** for `oauth2 ("password", "clientCredentials", "authorizationCode")`.
- The token URL to be used for this flow.
- This MUST be in the form of a URL.
- """
-
refreshUrl: Optional[AnyUrl] = None
- """
- The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.
- """
-
scopes: Dict[str, str]
- """
- **REQUIRED**. The available scopes for the OAuth2 security scheme.
- A map between the scope name and a short description for it.
- The map MAY be empty.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..2e363aac6 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/oauth_flows.py
@@ -8,28 +8,13 @@
class OAuthFlows(BaseModel):
"""
Allows configuration of the supported OAuth Flows.
- """
- implicit: Optional[OAuthFlow] = None
- """
- Configuration for the OAuth Implicit flow
+ References:
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauthFlowsObject
+ - https://swagger.io/docs/specification/authentication/oauth2/
"""
+ implicit: Optional[OAuthFlow] = None
password: Optional[OAuthFlow] = None
- """
- Configuration for the OAuth Resource Owner Password flow
- """
-
clientCredentials: Optional[OAuthFlow] = None
- """
- Configuration for the OAuth Client Credentials flow.
-
- Previously called `application` in OpenAPI 2.0.
- """
-
authorizationCode: Optional[OAuthFlow] = None
- """
- Configuration for the OAuth Authorization Code flow.
-
- Previously called `accessCode` in OpenAPI 2.0.
- """
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..9c1dfcbf4 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/open_api.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/open_api.py
@@ -1,4 +1,6 @@
-from typing import List, Optional
+# pylint: disable=W0611
+import sys
+from typing import List, Optional, Union
from pydantic import BaseModel
@@ -10,51 +12,25 @@
from .server import Server
from .tag import Tag
+if sys.version_info.minor < 8:
+ from typing_extensions import Literal
+else:
+ from typing import Literal # type: ignore
+
class OpenAPI(BaseModel):
- """This is the root document object of the OpenAPI document."""
+ """This is the root document object of the OpenAPI document.
- info: Info
- """
- **REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required.
+ References:
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oasObject
+ - https://swagger.io/docs/specification/basic-structure/
"""
+ info: Info
servers: List[Server] = [Server(url="/")]
- """
- An array of Server Objects, which provide connectivity information to a target server.
- If the `servers` property is not provided, or is an empty array,
- the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`.
- """
-
paths: Paths
- """
- **REQUIRED**. The available paths and operations for the API.
- """
-
components: Optional[Components] = None
- """
- An element to hold various schemas for the specification.
- """
-
security: Optional[List[SecurityRequirement]] = None
- """
- A declaration of which security mechanisms can be used across the API.
- The list of values includes alternative security requirement objects that can be used.
- Only one of the security requirement objects need to be satisfied to authorize a request.
- Individual operations can override this definition.
- To make security optional, an empty security requirement (`{}`) can be included in the array.
- """
-
tags: Optional[List[Tag]] = None
- """
- A list of tags used by the specification with additional metadata.
- The order of the tags can be used to reflect on their order by the parsing tools.
- Not all tags that are used by the [Operation Object](#operationObject) must be declared.
- The tags that are not declared MAY be organized randomly or based on the tools' logic.
- Each tag name in the list MUST be unique.
- """
-
externalDocs: Optional[ExternalDocumentation] = None
- """
- Additional external documentation.
- """
+ openapi: 'Union[Literal["3.0.0"], Literal["3.0.1"], Literal["3.0.2"], Literal["3.0.3"]]'
diff --git a/openapi_python_client/schema/openapi_schema_pydantic/operation.py b/openapi_python_client/schema/openapi_schema_pydantic/operation.py
index 860c3c24a..06fea6936 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/operation.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/operation.py
@@ -12,89 +12,26 @@
class Operation(BaseModel):
- """Describes a single API operation on a path."""
+ """Describes a single API operation on a path.
- tags: Optional[List[str]] = None
- """
- A list of tags for API documentation control.
- Tags can be used for logical grouping of operations by resources or any other qualifier.
+ References:
+ - https://swagger.io/docs/specification/paths-and-operations/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject
"""
+ tags: Optional[List[str]] = None
summary: Optional[str] = None
- """
- A short summary of what the operation does.
- """
-
description: Optional[str] = None
- """
- A verbose explanation of the operation behavior.
- [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
- """
-
externalDocs: Optional[ExternalDocumentation] = None
- """
- Additional external documentation for this operation.
- """
-
operationId: Optional[str] = None
- """
- Unique string used to identify the operation.
- The id MUST be unique among all operations described in the API.
- The operationId value is **case-sensitive**.
- Tools and libraries MAY use the operationId to uniquely identify an operation,
- therefore, it is RECOMMENDED to follow common programming naming conventions.
- """
-
parameters: Optional[List[Union[Parameter, Reference]]] = None
- """
- A list of parameters that are applicable for this operation.
- If a parameter is already defined at the [Path Item](#pathItemParameters),
- the new definition will override it but can never remove it.
- The list MUST NOT include duplicated parameters.
- A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn).
- The list can use the [Reference Object](#referenceObject) to link to parameters
- that are defined at the [OpenAPI Object's components/parameters](#componentsParameters).
- """
-
requestBody: Optional[Union[RequestBody, Reference]] = None
- """
- The request body applicable for this operation.
-
- The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification
- [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies.
- In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers.
- """
-
responses: Responses
- """
- **REQUIRED**. The list of possible responses as they are returned from executing this operation.
- """
-
deprecated: bool = False
- """
- Declares this operation to be deprecated.
- Consumers SHOULD refrain from usage of the declared operation.
- Default value is `false`.
- """
-
security: Optional[List[SecurityRequirement]] = None
- """
- A declaration of which security mechanisms can be used for this operation.
- The list of values includes alternative security requirement objects that can be used.
- Only one of the security requirement objects need to be satisfied to authorize a request.
- To make security optional, an empty security requirement (`{}`) can be included in the array.
- This definition overrides any declared top-level [`security`](#oasSecurity).
- To remove a top-level security declaration, an empty array can be used.
- """
-
servers: Optional[List[Server]] = None
- """
- An alternative `server` array to service this operation.
- If an alternative `server` object is specified at the Path Item Object or Root level,
- it will be overridden by this value.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..4bf99185d 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/parameter.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/parameter.py
@@ -14,134 +14,28 @@ class Parameter(BaseModel):
Describes a single operation parameter.
A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn).
- """
-
- """Fixed Fields"""
-
- name: str
- """
- **REQUIRED**. The name of the parameter.
- Parameter names are *case sensitive*.
- - 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"`.
- the parameter definition SHALL be ignored.
- - For all other cases, the `name` corresponds to the parameter name used by the [`in`](#parameterIn) property.
+ References:
+ - https://swagger.io/docs/specification/describing-parameters/
+ - https://swagger.io/docs/specification/serialization/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterObject
"""
+ name: str
param_in: ParameterLocation = Field(alias="in")
- """
- **REQUIRED**. The location of the parameter. Possible values are `"query"`, `"header"`, `"path"` or `"cookie"`.
- """
-
description: Optional[str] = None
- """
- A brief description of the parameter.
- This could contain examples of use.
- [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
- """
-
required: bool = False
- """
- Determines whether this parameter is mandatory.
- If the [parameter location](#parameterIn) is `"path"`, this property is **REQUIRED** and its value MUST be `true`.
- Otherwise, the property MAY be included and its default value is `false`.
- """
-
deprecated: bool = False
- """
- Specifies that a parameter is deprecated and SHOULD be transitioned out of usage.
- Default value is `false`.
- """
-
allowEmptyValue: bool = False
- """
- Sets the ability to pass empty-valued parameters.
- This is valid only for `query` parameters and allows sending a parameter with an empty value.
- Default value is `false`.
- If [`style`](#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized),
- the value of `allowEmptyValue` SHALL be ignored.
- Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.
- """
-
- """
- The rules for serialization of the parameter are specified in one of two ways.
- For simpler scenarios, a [`schema`](#parameterSchema) and [`style`](#parameterStyle)
- can describe the structure and syntax of the parameter.
- """
-
style: Optional[str] = None
- """
- Describes how the parameter value will be serialized depending on the type of the parameter value.
- Default values (based on value of `in`):
-
- - for `query` - `form`;
- - for `path` - `simple`;
- - for `header` - `simple`;
- - for `cookie` - `form`.
- """
-
explode: bool = False
- """
- When this is true, parameter values of type `array` or `object` generate separate parameters
- for each value of the array or key-value pair of the map.
- For other types of parameters this property has no effect.
- When [`style`](#parameterStyle) is `form`, the default value is `true`.
- For all other styles, the default value is `false`.
- """
-
allowReserved: bool = False
- """
- Determines whether the parameter value SHOULD allow reserved characters,
- as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2)
- `:/?#[]@!$&'()*+,;=` to be included without percent-encoding.
- This property only applies to parameters with an `in` value of `query`.
- The default value is `false`.
- """
-
param_schema: Optional[Union[Reference, Schema]] = Field(default=None, alias="schema")
- """
- The schema defining the type used for the parameter.
- """
-
example: Optional[Any] = None
- """
- Example of the parameter's potential value.
- The example SHOULD match the specified schema and encoding properties if present.
- The `example` field is mutually exclusive of the `examples` field.
- Furthermore, if referencing a `schema` that contains an example,
- the `example` value SHALL _override_ the example provided by the schema.
- To represent examples of media types that cannot naturally be represented in JSON or YAML,
- a string value can contain the example with escaping where necessary.
- """
-
examples: Optional[Dict[str, Union[Example, Reference]]] = None
- """
- Examples of the parameter's potential value.
- Each example SHOULD contain a value in the correct format as specified in the parameter encoding.
- The `examples` field is mutually exclusive of the `example` field.
- Furthermore, if referencing a `schema` that contains an example,
- the `examples` value SHALL _override_ the example provided by the schema.
- """
-
- """
- For more complex scenarios, the [`content`](#parameterContent) property
- can define the media type and schema of the parameter.
- A parameter MUST contain either a `schema` property, or a `content` property, but not both.
- When `example` or `examples` are provided in conjunction with the `schema` object,
- the example MUST follow the prescribed serialization strategy for the parameter.
- """
-
content: Optional[Dict[str, MediaType]] = None
- """
- A map containing the representations for the parameter.
- The key is the media type and the value describes it.
- The map MUST only contain one entry.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..d0b3598dd 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/path_item.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/path_item.py
@@ -14,84 +14,27 @@ class PathItem(BaseModel):
A Path Item MAY be empty, due to [ACL constraints](#securityFiltering).
The path itself is still exposed to the documentation viewer
but they will not know which operations and parameters are available.
- """
- ref: Optional[str] = Field(default=None, alias="$ref")
- """
- Allows for an external definition of this path item.
- The referenced structure MUST be in the format of a [Path Item Object](#pathItemObject).
-
- In case a Path Item Object field appears both in the defined object and the referenced object,
- the behavior is undefined.
+ References:
+ - https://swagger.io/docs/specification/paths-and-operations/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathItemObject
"""
+ ref: Optional[str] = Field(default=None, alias="$ref")
summary: Optional[str] = None
- """
- An optional, string summary, intended to apply to all operations in this path.
- """
-
description: Optional[str] = None
- """
- An optional, string description, intended to apply to all operations in this path.
- [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
- """
-
get: Optional[Operation] = None
- """
- A definition of a GET operation on this path.
- """
-
put: Optional[Operation] = None
- """
- A definition of a PUT operation on this path.
- """
-
post: Optional[Operation] = None
- """
- A definition of a POST operation on this path.
- """
-
delete: Optional[Operation] = None
- """
- A definition of a DELETE operation on this path.
- """
-
options: Optional[Operation] = None
- """
- A definition of a OPTIONS operation on this path.
- """
-
head: Optional[Operation] = None
- """
- A definition of a HEAD operation on this path.
- """
-
patch: Optional[Operation] = None
- """
- A definition of a PATCH operation on this path.
- """
-
trace: Optional[Operation] = None
- """
- A definition of a TRACE operation on this path.
- """
-
servers: Optional[List[Server]] = None
- """
- An alternative `server` array to service all operations in this path.
- """
-
parameters: Optional[List[Union[Parameter, Reference]]] = None
- """
- A list of parameters that are applicable for all the operations described under this path.
- These parameters can be overridden at the operation level, but cannot be removed there.
- The list MUST NOT include duplicated parameters.
- A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn).
- The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the
- [OpenAPI Object's components/parameters](#componentsParameters).
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
allow_population_by_field_name = True
schema_extra = {
"examples": [
diff --git a/openapi_python_client/schema/openapi_schema_pydantic/paths.py b/openapi_python_client/schema/openapi_schema_pydantic/paths.py
index 5f31b6e29..d61ea7b18 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/paths.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/paths.py
@@ -8,18 +8,8 @@
The path is appended to the URL from the [`Server Object`](#serverObject) in order to construct the full URL.
The Paths MAY be empty, due to [ACL constraints](#securityFiltering).
-"""
-
-"""Patterned Fields"""
-# "/{path}" : PathItem
-"""
-A relative path to an individual endpoint.
-The field name MUST begin with a forward slash (`/`).
-The path is **appended** (no relative URL resolution) to the expanded URL
-from the [`Server Object`](#serverObject)'s `url` field in order to construct the full URL.
-[Path templating](#pathTemplating) is allowed.
-When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts.
-Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical.
-In case of ambiguous matching, it's up to the tooling to decide which one to use.
+References:
+ - https://swagger.io/docs/specification/paths-and-operations/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathsObject
"""
diff --git a/openapi_python_client/schema/openapi_schema_pydantic/reference.py b/openapi_python_client/schema/openapi_schema_pydantic/reference.py
index 7803b3a54..ad21a2fe0 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/reference.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/reference.py
@@ -10,12 +10,15 @@ class Reference(BaseModel):
For this specification, reference resolution is accomplished as defined by the JSON Reference specification
and not by the JSON Schema specification.
+
+ References:
+ - https://swagger.io/docs/specification/using-ref/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject
"""
ref: str = Field(alias="$ref")
- """**REQUIRED**. The reference string."""
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..1b0df2ea3 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/request_body.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/request_body.py
@@ -6,31 +6,18 @@
class RequestBody(BaseModel):
- """Describes a single request body."""
+ """Describes a single request body.
- description: Optional[str] = None
- """
- A brief description of the request body.
- This could contain examples of use.
-
- [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
+ References:
+ - https://swagger.io/docs/specification/describing-request-body/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#requestBodyObject
"""
+ description: Optional[str] = None
content: Dict[str, MediaType]
- """
- **REQUIRED**. The content of the request body.
- The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D)
- and the value describes it.
-
- For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
- """
-
required: bool = False
- """
- Determines if the request body is required in the request. Defaults to `false`.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..a8723b124 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/response.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/response.py
@@ -12,38 +12,18 @@ class Response(BaseModel):
"""
Describes a single response from an API Operation, including design-time,
static `links` to operations based on the response.
- """
- description: str
- """
- **REQUIRED**. A short description of the response.
- [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
+ References:
+ - https://swagger.io/docs/specification/describing-responses/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#responseObject
"""
+ description: str
headers: Optional[Dict[str, Union[Header, Reference]]] = None
- """
- Maps a header name to its definition.
- [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive.
- If a response header is defined with the name `"Content-Type"`, it SHALL be ignored.
- """
-
content: Optional[Dict[str, MediaType]] = None
- """
- A map containing descriptions of potential response payloads.
- The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D)
- and the value describes it.
-
- For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
- """
-
links: Optional[Dict[str, Union[Link, Reference]]] = None
- """
- A map of operations links that can be followed from the response.
- The key of the map is a short name for the link,
- following the naming constraints of the names for [Component Objects](#componentsObject).
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
schema_extra = {
"examples": [
{
diff --git a/openapi_python_client/schema/openapi_schema_pydantic/responses.py b/openapi_python_client/schema/openapi_schema_pydantic/responses.py
index 6f3d9f8ce..53306ae1c 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/responses.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/responses.py
@@ -17,30 +17,7 @@
The `Responses Object` MUST contain at least one response code, and it
SHOULD be the response for a successful operation call.
-"""
-
-"""Fixed Fields"""
-
-# default: Optional[Union[Response, Reference]]
-"""
-The documentation of responses other than the ones declared for specific HTTP response codes.
-Use this field to cover undeclared responses.
-A [Reference Object](#referenceObject) can link to a response
-that the [OpenAPI Object's components/responses](#componentsResponses) section defines.
-"""
-
-"""Patterned Fields"""
-# {httpStatusCode]: Optional[Union[Response, Reference]]
-"""
-Any [HTTP status code](#httpCodes) can be used as the property name,
-but only one property per code, to describe the expected response for that HTTP status code.
-A [Reference Object](#referenceObject) can link to a response
-that is defined in the [OpenAPI Object's components/responses](#componentsResponses) section.
-This field MUST be enclosed in quotation marks (for example, "200") for compatibility between JSON and YAML.
-To define a range of response codes, this field MAY contain the uppercase wildcard character `X`.
-For example, `2XX` represents all response codes between `[200-299]`.
-Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`.
-If a response is defined using an explicit code,
-the explicit code definition takes precedence over the range definition for that code.
+References:
+ - https://swagger.io/docs/specification/describing-responses/
"""
diff --git a/openapi_python_client/schema/openapi_schema_pydantic/schema.py b/openapi_python_client/schema/openapi_schema_pydantic/schema.py
index 5941d79f5..bdac3cdf0 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/schema.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/schema.py
@@ -14,464 +14,48 @@ class Schema(BaseModel):
These types can be objects, but also primitives and arrays.
This object is an extended subset of the [JSON Schema Specification Wright Draft 00](https://json-schema.org/).
- For more information about the properties,
- see [JSON Schema Core](https://tools.ietf.org/html/draft-wright-json-schema-00)
- and [JSON Schema Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00).
- Unless stated otherwise, the property definitions follow the JSON Schema.
- """
-
- """
- The following properties are taken directly from the JSON Schema definition and follow the same specifications:
+ References:
+ - https://swagger.io/docs/specification/data-models/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schemaObject
"""
title: Optional[str] = None
- """
- The value of "title" MUST be a string.
-
- The title can be used to decorate a user interface with
- information about the data produced by this user interface.
- The title will preferrably be short.
- """
-
multipleOf: Optional[float] = Field(default=None, gt=0.0)
- """
- The value of "multipleOf" MUST be a number, strictly greater than 0.
-
- A numeric instance is only valid if division by this keyword's value
- results in an integer.
- """
-
maximum: Optional[float] = None
- """
- The value of "maximum" MUST be a number, representing an upper limit
- for a numeric instance.
-
- If the instance is a number, then this keyword validates if
- "exclusiveMaximum" is true and instance is less than the provided
- value, or else if the instance is less than or exactly equal to the
- provided value.
- """
-
exclusiveMaximum: Optional[bool] = None
- """
- The value of "exclusiveMaximum" MUST be a boolean, representing
- whether the limit in "maximum" is exclusive or not. An undefined
- value is the same as false.
-
- If "exclusiveMaximum" is true, then a numeric instance SHOULD NOT be
- equal to the value specified in "maximum". If "exclusiveMaximum" is
- false (or not specified), then a numeric instance MAY be equal to the
- value of "maximum".
- """
-
minimum: Optional[float] = None
- """
- The value of "minimum" MUST be a number, representing a lower limit
- for a numeric instance.
-
- If the instance is a number, then this keyword validates if
- "exclusiveMinimum" is true and instance is greater than the provided
- value, or else if the instance is greater than or exactly equal to
- the provided value.
- """
-
exclusiveMinimum: Optional[bool] = None
- """
- The value of "exclusiveMinimum" MUST be a boolean, representing
- whether the limit in "minimum" is exclusive or not. An undefined
- value is the same as false.
-
- If "exclusiveMinimum" is true, then a numeric instance SHOULD NOT be
- equal to the value specified in "minimum". If "exclusiveMinimum" is
- false (or not specified), then a numeric instance MAY be equal to the
- value of "minimum".
- """
-
maxLength: Optional[int] = Field(default=None, ge=0)
- """
- The value of this keyword MUST be a non-negative integer.
-
- The value of this keyword MUST be an integer. This integer MUST be
- greater than, or equal to, 0.
-
- A string instance is valid against this keyword if its length is less
- than, or equal to, the value of this keyword.
-
- The length of a string instance is defined as the number of its
- characters as defined by RFC 7159 [RFC7159].
- """
-
minLength: Optional[int] = Field(default=None, ge=0)
- """
- A string instance is valid against this keyword if its length is
- greater than, or equal to, the value of this keyword.
-
- The length of a string instance is defined as the number of its
- characters as defined by RFC 7159 [RFC7159].
-
- The value of this keyword MUST be an integer. This integer MUST be
- greater than, or equal to, 0.
-
- "minLength", if absent, may be considered as being present with
- integer value 0.
- """
-
pattern: Optional[str] = None
- """
- The value of this keyword MUST be a string. This string SHOULD be a
- valid regular expression, according to the ECMA 262 regular
- expression dialect.
-
- A string instance is considered valid if the regular expression
- matches the instance successfully. Recall: regular expressions are
- not implicitly anchored.
- """
-
maxItems: Optional[int] = Field(default=None, ge=0)
- """
- The value of this keyword MUST be an integer. This integer MUST be
- greater than, or equal to, 0.
-
- An array instance is valid against "maxItems" if its size is less
- than, or equal to, the value of this keyword.
- """
-
minItems: Optional[int] = Field(default=None, ge=0)
- """
- The value of this keyword MUST be an integer. This integer MUST be
- greater than, or equal to, 0.
-
- An array instance is valid against "minItems" if its size is greater
- than, or equal to, the value of this keyword.
-
- If this keyword is not present, it may be considered present with a
- value of 0.
- """
-
uniqueItems: Optional[bool] = None
- """
- The value of this keyword MUST be a boolean.
-
- If this keyword has boolean value false, the instance validates
- successfully. If it has boolean value true, the instance validates
- successfully if all of its elements are unique.
-
- If not present, this keyword may be considered present with boolean
- value false.
- """
-
maxProperties: Optional[int] = Field(default=None, ge=0)
- """
- The value of this keyword MUST be an integer. This integer MUST be
- greater than, or equal to, 0.
-
- An object instance is valid against "maxProperties" if its number of
- properties is less than, or equal to, the value of this keyword.
- """
-
minProperties: Optional[int] = Field(default=None, ge=0)
- """
- The value of this keyword MUST be an integer. This integer MUST be
- greater than, or equal to, 0.
-
- An object instance is valid against "minProperties" if its number of
- properties is greater than, or equal to, the value of this keyword.
-
- If this keyword is not present, it may be considered present with a
- value of 0.
- """
-
required: Optional[List[str]] = Field(default=None, min_items=1)
- """
- The value of this keyword MUST be an array. This array MUST have at
- least one element. Elements of this array MUST be strings, and MUST
- be unique.
-
- An object instance is valid against this keyword if its property set
- contains all elements in this keyword's array value.
- """
-
enum: Optional[List[Any]] = Field(default=None, min_items=1)
- """
- The value of this keyword MUST be an array. This array SHOULD have
- at least one element. Elements in the array SHOULD be unique.
-
- Elements in the array MAY be of any type, including null.
-
- An instance validates successfully against this keyword if its value
- is equal to one of the elements in this keyword's array value.
- """
-
- """
- The following properties are taken from the JSON Schema definition
- but their definitions were adjusted to the OpenAPI Specification.
- """
-
type: Optional[str] = None
- """
- **From OpenAPI spec:
- Value MUST be a string. Multiple types via an array are not supported.**
-
- From JSON Schema:
- The value of this keyword MUST be either a string or an array. If it
- is an array, elements of the array MUST be strings and MUST be
- unique.
-
- String values MUST be one of the seven primitive types defined by the
- core specification.
-
- An instance matches successfully if its primitive type is one of the
- types defined by keyword. Recall: "number" includes "integer".
- """
-
allOf: Optional[List[Union[Reference, "Schema"]]] = None
- """
- **From OpenAPI spec:
- Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.**
-
- From JSON Schema:
- This keyword's value MUST be an array. This array MUST have at least
- one element.
-
- Elements of the array MUST be objects. Each object MUST be a valid
- JSON Schema.
-
- An instance validates successfully against this keyword if it
- validates successfully against all schemas defined by this keyword's
- value.
- """
-
oneOf: List[Union[Reference, "Schema"]] = []
- """
- **From OpenAPI spec:
- Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.**
-
- From JSON Schema:
- This keyword's value MUST be an array. This array MUST have at least
- one element.
-
- Elements of the array MUST be objects. Each object MUST be a valid
- JSON Schema.
-
- An instance validates successfully against this keyword if it
- validates successfully against exactly one schema defined by this
- keyword's value.
- """
-
anyOf: List[Union[Reference, "Schema"]] = []
- """
- **From OpenAPI spec:
- Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.**
-
- From JSON Schema:
- This keyword's value MUST be an array. This array MUST have at least
- one element.
-
- Elements of the array MUST be objects. Each object MUST be a valid
- JSON Schema.
-
- An instance validates successfully against this keyword if it
- validates successfully against at least one schema defined by this
- keyword's value.
- """
-
schema_not: Optional[Union[Reference, "Schema"]] = Field(default=None, alias="not")
- """
- **From OpenAPI spec:
- Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.**
-
- From JSON Schema:
- This keyword's value MUST be an object. This object MUST be a valid
- JSON Schema.
-
- An instance is valid against this keyword if it fails to validate
- successfully against the schema defined by this keyword.
- """
-
items: Optional[Union[Reference, "Schema"]] = None
- """
- **From OpenAPI spec:
- Value MUST be an object and not an array.
- Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.
- `items` MUST be present if the `type` is `array`.**
-
- From JSON Schema:
- The value of "items" MUST be either a schema or array of schemas.
-
- Successful validation of an array instance with regards to these two
- keywords is determined as follows:
-
- - if "items" is not present, or its value is an object, validation
- of the instance always succeeds, regardless of the value of
- "additionalItems";
- - if the value of "additionalItems" is boolean value true or an
- object, validation of the instance always succeeds;
- - if the value of "additionalItems" is boolean value false and the
- value of "items" is an array, the instance is valid if its size is
- less than, or equal to, the size of "items".
- """
-
properties: Optional[Dict[str, Union[Reference, "Schema"]]] = None
- """
- **From OpenAPI spec:
- Property definitions MUST be a [Schema Object](#schemaObject)
- and not a standard JSON Schema (inline or referenced).**
-
- From JSON Schema:
- The value of "properties" MUST be an object. Each value of this
- object MUST be an object, and each object MUST be a valid JSON
- Schema.
-
- If absent, it can be considered the same as an empty object.
- """
-
additionalProperties: Optional[Union[bool, Reference, "Schema"]] = None
- """
- **From OpenAPI spec:
- Value can be boolean or object.
- Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.
- Consistent with JSON Schema, `additionalProperties` defaults to `true`.**
-
- From JSON Schema:
- The value of "additionalProperties" MUST be a boolean or a schema.
-
- If "additionalProperties" is absent, it may be considered present
- with an empty schema as a value.
-
- If "additionalProperties" is true, validation always succeeds.
-
- If "additionalProperties" is false, validation succeeds only if the
- instance is an object and all properties on the instance were covered
- by "properties" and/or "patternProperties".
-
- If "additionalProperties" is an object, validate the value as a
- schema to all of the properties that weren't validated by
- "properties" nor "patternProperties".
- """
-
description: Optional[str] = None
- """
- **From OpenAPI spec:
- [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.**
-
- From JSON Schema:
- The value "description" MUST be a string.
-
- The description can be used to decorate a user interface with
- information about the data produced by this user interface.
- The description will provide explanation about the purpose of
- the instance described by this schema.
- """
-
schema_format: Optional[str] = Field(default=None, alias="format")
- """
- **From OpenAPI spec:
- [Data Type Formats](#dataTypeFormat) for further details.
- While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats.**
-
- From JSON Schema:
- Structural validation alone may be insufficient to validate that an
- instance meets all the requirements of an application. The "format"
- keyword is defined to allow interoperable semantic validation for a
- fixed subset of values which are accurately described by
- authoritative resources, be they RFCs or other external
- specifications.
-
- The value of this keyword is called a format attribute. It MUST be a
- string. A format attribute can generally only validate a given set
- of instance types. If the type of the instance to validate is not in
- this set, validation for this format attribute and instance SHOULD
- succeed.
- """
-
default: Optional[Any] = None
- """
- **From OpenAPI spec:
- The default value represents what would be assumed by the consumer of the input
- as the value of the schema if one is not provided.
- Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level.
- For example, if `type` is `string`, then `default` can be `"foo"` but cannot be `1`.**
-
- From JSON Schema:
- There are no restrictions placed on the value of this keyword.
-
- This keyword can be used to supply a default JSON value associated
- with a particular schema. It is RECOMMENDED that a default value be
- valid against the associated schema.
-
- This keyword MAY be used in root schemas, and in any subschemas.
- """
-
- """
- Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:
- """
-
nullable: bool = False
- """
- A `true` value adds `"null"` to the allowed type specified by the `type` keyword,
- only if `type` is explicitly defined within the same Schema Object.
- Other Schema Object constraints retain their defined behavior,
- and therefore may disallow the use of `null` as a value.
- A `false` value leaves the specified or default `type` unmodified.
- The default value is `false`.
- """
-
discriminator: Optional[Discriminator] = None
- """
- Adds support for polymorphism.
- The discriminator is an object name that is used to differentiate between other schemas
- which may satisfy the payload description.
- See [Composition and Inheritance](#schemaComposition) for more details.
- """
-
readOnly: Optional[bool] = None
- """
- Relevant only for Schema `"properties"` definitions.
- Declares the property as "read only".
- This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request.
- If the property is marked as `readOnly` being `true` and is in the `required` list,
- the `required` will take effect on the response only.
- A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`.
- Default value is `false`.
- """
-
writeOnly: Optional[bool] = None
- """
- Relevant only for Schema `"properties"` definitions.
- Declares the property as "write only".
- Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response.
- If the property is marked as `writeOnly` being `true` and is in the `required` list,
- the `required` will take effect on the request only.
- A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`.
- Default value is `false`.
- """
-
xml: Optional[XML] = None
- """
- This MAY be used only on properties schemas.
- It has no effect on root schemas.
- Adds additional metadata to describe the XML representation of this property.
- """
-
externalDocs: Optional[ExternalDocumentation] = None
- """
- Additional external documentation for this schema.
- """
-
example: Optional[Any] = None
- """
- A free-form property to include an example of an instance for this schema.
- To represent examples that cannot be naturally represented in JSON or YAML,
- a string value can be used to contain the example with escaping where necessary.
- """
-
deprecated: Optional[bool] = None
- """
- Specifies that a schema is deprecated and SHOULD be transitioned out of usage.
- Default value is `false`.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
allow_population_by_field_name = True
schema_extra = {
"examples": [
diff --git a/openapi_python_client/schema/openapi_schema_pydantic/security_requirement.py b/openapi_python_client/schema/openapi_schema_pydantic/security_requirement.py
index b5165f4f9..b3cca3b08 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/security_requirement.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/security_requirement.py
@@ -14,16 +14,7 @@
When a list of Security Requirement Objects is defined on the
[OpenAPI Object](#oasObject) or [Operation Object](#operationObject),
only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request.
-"""
-
-"""Patterned Fields"""
-# {name}: List[str]
-"""
-Each name MUST correspond to a security scheme which is declared
-in the [Security Schemes](#componentsSecuritySchemes) under the [Components Object](#componentsObject).
-If the security scheme is of type `"oauth2"` or `"openIdConnect"`,
-then the value is a list of scope names required for the execution,
-and the list MAY be empty if authorization does not require a specified scope.
-For other security scheme types, the array MUST be empty.
+References:
+ - https://swagger.io/docs/specification/authentication/
"""
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..25ee2df8f 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py
@@ -13,59 +13,22 @@ class SecurityScheme(BaseModel):
OAuth2's common flows (implicit, password, client credentials and authorization code)
as defined in [RFC6749](https://tools.ietf.org/html/rfc6749),
and [OpenID Connect Discovery](https://tools.ietf.org/html/draft-ietf-oauth-discovery-06).
- """
- type: str
- """
- **REQUIRED**. The type of the security scheme.
- Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`.
+ References:
+ - https://swagger.io/docs/specification/authentication/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#componentsObject
"""
+ type: str
description: Optional[str] = None
- """
- A short description for security scheme.
- [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
- """
-
name: Optional[str] = None
- """
- **REQUIRED** for `apiKey`. The name of the header, query or cookie parameter to be used.
- """
-
security_scheme_in: Optional[str] = Field(alias="in")
- """
- **REQUIRED** for `apiKey`. The location of the API key. Valid values are `"query"`, `"header"` or `"cookie"`.
- """
-
scheme: Optional[str] = None
- """
- **REQUIRED** for `http`. The name of the HTTP Authorization scheme to be used in the
- [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-5.1).
-
- The values used SHOULD be registered in the
- [IANA Authentication Scheme registry](https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml).
- """
-
bearerFormat: Optional[str] = None
- """
- A hint to the client to identify how the bearer token is formatted.
-
- Bearer tokens are usually generated by an authorization server,
- so this information is primarily for documentation purposes.
- """
-
flows: Optional[OAuthFlows] = None
- """
- **REQUIRED** for `oauth2`. An object containing configuration information for the flow types supported.
- """
-
openIdConnectUrl: Optional[AnyUrl] = None
- """
- **REQUIRED** for `openIdConnect`. OpenId Connect URL to discover OAuth2 configuration values.
- This MUST be in the form of a URL.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..9a37b566a 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/server.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/server.py
@@ -6,31 +6,18 @@
class Server(BaseModel):
- """An object representing a Server."""
+ """An object representing a Server.
- url: str
- """
- **REQUIRED**. A URL to the target host.
-
- This URL supports Server Variables and MAY be relative,
- to indicate that the host location is relative to the location where the OpenAPI document is being served.
- Variable substitutions will be made when a variable is named in `{`brackets`}`.
+ References:
+ - https://swagger.io/docs/specification/api-host-and-base-path/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject
"""
+ url: str
description: Optional[str] = None
- """
- An optional string describing the host designated by the URL.
- [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
- """
-
variables: Optional[Dict[str, ServerVariable]] = None
- """
- A map between a variable name and its value.
-
- The value is used for substitution in the server's URL template.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..f6286f883 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/server_variable.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/server_variable.py
@@ -4,25 +4,13 @@
class ServerVariable(BaseModel):
- """An object representing a Server Variable for server URL template substitution."""
+ """An object representing a Server Variable for server URL template substitution.
- enum: Optional[List[str]] = None
- """
- An enumeration of string values to be used if the substitution options are from a limited set.
- The array SHOULD NOT be empty.
+ References:
+ - https://swagger.io/docs/specification/api-host-and-base-path/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverVariableObject
"""
+ enum: Optional[List[str]] = None
default: str
- """
- **REQUIRED**. The default value to use for substitution,
- which SHALL be sent if an alternate value is _not_ supplied.
- Note this behavior is different than the [Schema Object's](#schemaObject) treatment of default values,
- because in those cases parameter values are optional.
- If the [`enum`](#serverVariableEnum) is defined, the value SHOULD exist in the enum's values.
- """
-
description: Optional[str] = None
- """
- An optional description for the server variable.
- [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
- """
diff --git a/openapi_python_client/schema/openapi_schema_pydantic/tag.py b/openapi_python_client/schema/openapi_schema_pydantic/tag.py
index 531de02b4..cf112fc47 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/tag.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/tag.py
@@ -9,23 +9,15 @@ class Tag(BaseModel):
"""
Adds metadata to a single tag that is used by the [Operation Object](#operationObject).
It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.
- """
- name: str
- """
- **REQUIRED**. The name of the tag.
+ References:
+ - https://swagger.io/docs/specification/paths-and-operations/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#tagObject
"""
+ name: str
description: Optional[str] = None
- """
- A short description for the tag.
- [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
- """
-
externalDocs: Optional[ExternalDocumentation] = None
- """
- Additional external documentation for this tag.
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
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..ddb0e7205 100644
--- a/openapi_python_client/schema/openapi_schema_pydantic/xml.py
+++ b/openapi_python_client/schema/openapi_schema_pydantic/xml.py
@@ -10,44 +10,19 @@ class XML(BaseModel):
When using arrays, XML element names are *not* inferred (for singular/plural forms)
and the `name` property SHOULD be used to add that information.
See examples for expected behavior.
- """
- name: Optional[str] = None
- """
- Replaces the name of the element/attribute used for the described schema property.
- When defined within `items`, it will affect the name of the individual XML elements within the list.
- When defined alongside `type` being `array` (outside the `items`),
- it will affect the wrapping element and only if `wrapped` is `true`.
- If `wrapped` is `false`, it will be ignored.
+ References:
+ - https://swagger.io/docs/specification/data-models/representing-xml/
+ - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#xmlObject
"""
+ name: Optional[str] = None
namespace: Optional[str] = None
- """
- The URI of the namespace definition.
- Value MUST be in the form of an absolute URI.
- """
-
prefix: Optional[str] = None
- """
- The prefix to be used for the [name](#xmlName).
- """
-
attribute: bool = False
- """
- Declares whether the property definition translates to an attribute instead of an element.
- Default value is `false`.
- """
-
wrapped: bool = False
- """
- MAY be used only for an array definition.
- Signifies whether the array is wrapped (for example, ``)
- or unwrapped (``).
- Default value is `false`.
- The definition takes effect only when defined alongside `type` being `array` (outside the `items`).
- """
- class Config:
+ class Config: # pylint: disable=missing-class-docstring
schema_extra = {
"examples": [
{"namespace": "http://example.com/schema/sample", "prefix": "sample"},
diff --git a/openapi_python_client/utils.py b/openapi_python_client/utils.py
index a8e80d027..c74598b70 100644
--- a/openapi_python_client/utils.py
+++ b/openapi_python_client/utils.py
@@ -3,14 +3,14 @@
from keyword import iskeyword
from typing import Any, List
-delimiters = " _-"
+DELIMITERS = " _-"
class PythonIdentifier(str):
"""A string which has been validated / transformed into a valid identifier for Python"""
def __new__(cls, value: str, prefix: str) -> "PythonIdentifier":
- new_value = fix_reserved_words(fix_keywords(snake_case(sanitize(value))))
+ new_value = fix_reserved_words(snake_case(sanitize(value)))
if not new_value.isidentifier():
new_value = f"{prefix}{new_value}"
@@ -22,7 +22,7 @@ def __deepcopy__(self, _: Any) -> "PythonIdentifier":
def sanitize(value: str) -> str:
"""Removes every character that isn't 0-9, A-Z, a-z, or a known delimiter"""
- return re.sub(rf"[^\w{delimiters}]+", "", value)
+ return re.sub(rf"[^\w{DELIMITERS}]+", "", value)
def split_words(value: str) -> List[str]:
@@ -30,42 +30,52 @@ def split_words(value: str) -> List[str]:
# We can't guess words if there is no capital letter
if any(c.isupper() for c in value):
value = " ".join(re.split("([A-Z]?[a-z]+)", value))
- return re.findall(rf"[^{delimiters}]+", value)
-
-
-def fix_keywords(value: str) -> str:
- if iskeyword(value):
- return f"{value}_"
- return value
+ return re.findall(rf"[^{DELIMITERS}]+", value)
RESERVED_WORDS = (set(dir(builtins)) | {"self"}) - {"type", "id"}
def fix_reserved_words(value: str) -> str:
- if value in RESERVED_WORDS:
+ """
+ Using reserved Python words as identifiers in generated code causes problems, so this function renames them.
+
+ Args:
+ value: The identifier to-be that should be renamed if it's a reserved word.
+
+ Returns:
+ `value` suffixed with `_` if it was a reserved word.
+ """
+ if value in RESERVED_WORDS or iskeyword(value):
return f"{value}_"
return value
def snake_case(value: str) -> str:
+ """Converts to snake_case"""
words = split_words(sanitize(value))
- value = "_".join(words).lower()
- return fix_keywords(value)
+ return "_".join(words).lower()
def pascal_case(value: str) -> str:
+ """Converts to PascalCase"""
words = split_words(sanitize(value))
capitalized_words = (word.capitalize() if not word.isupper() else word for word in words)
- value = "".join(capitalized_words)
- return fix_keywords(value)
+ return "".join(capitalized_words)
def kebab_case(value: str) -> str:
+ """Converts to kebab-case"""
words = split_words(sanitize(value))
- value = "-".join(words).lower()
- return fix_keywords(value)
+ return "-".join(words).lower()
def remove_string_escapes(value: str) -> str:
+ """Used when parsing string-literal defaults to prevent escaping the string to write arbitrary Python
+
+ **REMOVING OR CHANGING THE USAGE OF THIS FUNCTION HAS SECURITY IMPLICATIONS**
+
+ See Also:
+ - https://github.com/openapi-generators/openapi-python-client/security/advisories/GHSA-9x4c-63pf-525f
+ """
return value.replace('"', r"\"")
diff --git a/poetry.lock b/poetry.lock
index b3da78953..d157532b3 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1,13 +1,12 @@
[[package]]
name = "anyio"
-version = "3.2.1"
+version = "3.3.0"
description = "High level compatibility layer for multiple asynchronous event loop implementations"
category = "main"
optional = false
python-versions = ">=3.6.2"
[package.dependencies]
-async-generator = {version = "*", markers = "python_version < \"3.7\""}
dataclasses = {version = "*", markers = "python_version < \"3.7\""}
idna = ">=2.8"
sniffio = ">=1.1"
@@ -26,6 +25,20 @@ category = "main"
optional = false
python-versions = "*"
+[[package]]
+name = "astroid"
+version = "2.6.6"
+description = "An abstract syntax tree for Python with inference support."
+category = "dev"
+optional = false
+python-versions = "~=3.6"
+
+[package.dependencies]
+lazy-object-proxy = ">=1.4.0"
+typed-ast = {version = ">=1.4.0,<1.5", markers = "implementation_name == \"cpython\" and python_version < \"3.8\""}
+typing-extensions = {version = ">=3.7.4", markers = "python_version < \"3.8\""}
+wrapt = ">=1.11,<1.13"
+
[[package]]
name = "async-generator"
version = "1.10"
@@ -69,7 +82,7 @@ pyflakes = ">=1.1.0"
[[package]]
name = "black"
-version = "21.6b0"
+version = "21.7b0"
description = "The uncompromising code formatter."
category = "main"
optional = false
@@ -82,7 +95,7 @@ dataclasses = {version = ">=0.6", markers = "python_version < \"3.7\""}
mypy-extensions = ">=0.4.3"
pathspec = ">=0.8.1,<1"
regex = ">=2020.1.8"
-toml = ">=0.10.1"
+tomli = ">=0.2.6,<2.0.0"
typed-ast = {version = ">=1.4.2", markers = "python_version < \"3.8\""}
typing-extensions = {version = ">=3.7.4", markers = "python_version < \"3.8\""}
@@ -101,12 +114,15 @@ optional = false
python-versions = "*"
[[package]]
-name = "chardet"
-version = "4.0.0"
-description = "Universal encoding detector for Python 2 and 3"
+name = "charset-normalizer"
+version = "2.0.4"
+description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
category = "dev"
optional = false
-python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+python-versions = ">=3.5.0"
+
+[package.extras]
+unicode_backport = ["unicodedata2"]
[[package]]
name = "click"
@@ -229,22 +245,25 @@ http2 = ["h2 (>=3.0.0,<4.0.0)"]
[[package]]
name = "idna"
-version = "2.10"
+version = "3.2"
description = "Internationalized Domain Names in Applications (IDNA)"
category = "main"
optional = false
-python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+python-versions = ">=3.5"
[[package]]
name = "immutables"
-version = "0.15"
+version = "0.16"
description = "Immutable Collections"
category = "main"
optional = false
-python-versions = ">=3.5"
+python-versions = ">=3.6"
+
+[package.dependencies]
+typing-extensions = {version = ">=3.7.4.3", markers = "python_version < \"3.8\""}
[package.extras]
-test = ["flake8 (>=3.8.4,<3.9.0)", "pycodestyle (>=2.6.0,<2.7.0)"]
+test = ["flake8 (>=3.8.4,<3.9.0)", "pycodestyle (>=2.6.0,<2.7.0)", "mypy (>=0.910)", "pytest (>=6.2.4,<6.3.0)"]
[[package]]
name = "importlib-metadata"
@@ -271,7 +290,7 @@ python-versions = "*"
[[package]]
name = "isort"
-version = "5.9.1"
+version = "5.9.3"
description = "A Python utility / library to sort Python imports."
category = "main"
optional = false
@@ -297,6 +316,14 @@ MarkupSafe = ">=2.0"
[package.extras]
i18n = ["Babel (>=2.7)"]
+[[package]]
+name = "lazy-object-proxy"
+version = "1.6.0"
+description = "A fast and thorough lazy object proxy."
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
+
[[package]]
name = "markupsafe"
version = "2.0.1"
@@ -360,11 +387,11 @@ pyparsing = ">=2.0.2"
[[package]]
name = "pathspec"
-version = "0.8.1"
+version = "0.9.0"
description = "Utility library for gitignore style pattern matching of file paths."
category = "main"
optional = false
-python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"
[[package]]
name = "pluggy"
@@ -431,6 +458,21 @@ category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+[[package]]
+name = "pylint"
+version = "2.9.6"
+description = "python code static checker"
+category = "dev"
+optional = false
+python-versions = "~=3.6"
+
+[package.dependencies]
+astroid = ">=2.6.5,<2.7"
+colorama = {version = "*", markers = "sys_platform == \"win32\""}
+isort = ">=4.2.5,<6"
+mccabe = ">=0.6,<0.7"
+toml = ">=0.7.1"
+
[[package]]
name = "pyparsing"
version = "2.4.7"
@@ -493,7 +535,7 @@ dev = ["pre-commit", "tox", "pytest-asyncio"]
[[package]]
name = "python-dateutil"
-version = "2.8.1"
+version = "2.8.2"
description = "Extensions to the standard Python datetime module"
category = "main"
optional = false
@@ -523,7 +565,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
[[package]]
name = "regex"
-version = "2021.7.1"
+version = "2021.8.3"
description = "Alternative regular expression module, to replace re."
category = "main"
optional = false
@@ -531,21 +573,21 @@ python-versions = "*"
[[package]]
name = "requests"
-version = "2.25.1"
+version = "2.26.0"
description = "Python HTTP for Humans."
category = "dev"
optional = false
-python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
[package.dependencies]
certifi = ">=2017.4.17"
-chardet = ">=3.0.2,<5"
-idna = ">=2.5,<3"
+charset-normalizer = {version = ">=2.0.0,<2.1.0", markers = "python_version >= \"3\""}
+idna = {version = ">=2.5,<4", markers = "python_version >= \"3\""}
urllib3 = ">=1.21.1,<1.27"
[package.extras]
-security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"]
socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
+use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"]
[[package]]
name = "rfc3986"
@@ -620,10 +662,18 @@ toml = ">=0.10.0,<0.11.0"
name = "toml"
version = "0.10.2"
description = "Python Library for Tom's Obvious, Minimal Language"
-category = "main"
+category = "dev"
optional = false
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
+[[package]]
+name = "tomli"
+version = "1.2.1"
+description = "A lil' TOML parser"
+category = "main"
+optional = false
+python-versions = ">=3.6"
+
[[package]]
name = "typed-ast"
version = "1.4.3"
@@ -672,7 +722,7 @@ python-versions = "*"
[[package]]
name = "types-dataclasses"
-version = "0.1.5"
+version = "0.1.7"
description = "Typing stubs for dataclasses"
category = "dev"
optional = false
@@ -680,7 +730,7 @@ python-versions = "*"
[[package]]
name = "types-python-dateutil"
-version = "0.1.4"
+version = "0.1.6"
description = "Typing stubs for python-dateutil"
category = "dev"
optional = false
@@ -688,7 +738,7 @@ python-versions = "*"
[[package]]
name = "types-pyyaml"
-version = "5.4.3"
+version = "5.4.6"
description = "Typing stubs for PyYAML"
category = "dev"
optional = false
@@ -715,6 +765,14 @@ brotli = ["brotlipy (>=0.6.0)"]
secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"]
socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
+[[package]]
+name = "wrapt"
+version = "1.12.1"
+description = "Module for decorators, wrappers and monkey patching."
+category = "dev"
+optional = false
+python-versions = "*"
+
[[package]]
name = "zipp"
version = "3.5.0"
@@ -730,17 +788,21 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes
[metadata]
lock-version = "1.1"
python-versions = "^3.6.2"
-content-hash = "8290c09aa4a11f17c91f6fe5cedc5c6d9da7fc0edfc137a2b874d3de30430b03"
+content-hash = "96a49df35a38a423c42fcc4a529c24c187f794afd8d1eda514c10bf776af8673"
[metadata.files]
anyio = [
- {file = "anyio-3.2.1-py3-none-any.whl", hash = "sha256:442678a3c7e1cdcdbc37dcfe4527aa851b1b0c9162653b516e9f509821691d50"},
- {file = "anyio-3.2.1.tar.gz", hash = "sha256:07968db9fa7c1ca5435a133dc62f988d84ef78e1d9b22814a59d1c62618afbc5"},
+ {file = "anyio-3.3.0-py3-none-any.whl", hash = "sha256:929a6852074397afe1d989002aa96d457e3e1e5441357c60d03e7eea0e65e1b0"},
+ {file = "anyio-3.3.0.tar.gz", hash = "sha256:ae57a67583e5ff8b4af47666ff5651c3732d45fd26c929253748e796af860374"},
]
appdirs = [
{file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"},
{file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"},
]
+astroid = [
+ {file = "astroid-2.6.6-py3-none-any.whl", hash = "sha256:ab7f36e8a78b8e54a62028ba6beef7561db4cdb6f2a5009ecc44a6f42b5697ef"},
+ {file = "astroid-2.6.6.tar.gz", hash = "sha256:3975a0bd5373bdce166e60c851cfcbaf21ee96de80ec518c1f4cb3e94c3fb334"},
+]
async-generator = [
{file = "async_generator-1.10-py3-none-any.whl", hash = "sha256:01c7bf666359b4967d2cda0000cc2e4af16a0ae098cbffcb8472fb9e8ad6585b"},
{file = "async_generator-1.10.tar.gz", hash = "sha256:6ebb3d106c12920aaae42ccb6f787ef5eefdcdd166ea3d628fa8476abe712144"},
@@ -757,16 +819,16 @@ autoflake = [
{file = "autoflake-1.4.tar.gz", hash = "sha256:61a353012cff6ab94ca062823d1fb2f692c4acda51c76ff83a8d77915fba51ea"},
]
black = [
- {file = "black-21.6b0-py3-none-any.whl", hash = "sha256:dfb8c5a069012b2ab1e972e7b908f5fb42b6bbabcba0a788b86dc05067c7d9c7"},
- {file = "black-21.6b0.tar.gz", hash = "sha256:dc132348a88d103016726fe360cb9ede02cecf99b76e3660ce6c596be132ce04"},
+ {file = "black-21.7b0-py3-none-any.whl", hash = "sha256:1c7aa6ada8ee864db745b22790a32f94b2795c253a75d6d9b5e439ff10d23116"},
+ {file = "black-21.7b0.tar.gz", hash = "sha256:c8373c6491de9362e39271630b65b964607bc5c79c83783547d76c839b3aa219"},
]
certifi = [
{file = "certifi-2021.5.30-py2.py3-none-any.whl", hash = "sha256:50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8"},
{file = "certifi-2021.5.30.tar.gz", hash = "sha256:2bbf76fd432960138b3ef6dda3dde0544f27cbf8546c458e60baf371917ba9ee"},
]
-chardet = [
- {file = "chardet-4.0.0-py2.py3-none-any.whl", hash = "sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5"},
- {file = "chardet-4.0.0.tar.gz", hash = "sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"},
+charset-normalizer = [
+ {file = "charset-normalizer-2.0.4.tar.gz", hash = "sha256:f23667ebe1084be45f6ae0538e4a5a865206544097e4e8bbcacf42cd02a348f3"},
+ {file = "charset_normalizer-2.0.4-py3-none-any.whl", hash = "sha256:0c8911edd15d19223366a194a513099a302055a962bca2cec0f54b8b63175d8b"},
]
click = [
{file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"},
@@ -858,25 +920,37 @@ httpx = [
{file = "httpx-0.18.2.tar.gz", hash = "sha256:9f99c15d33642d38bce8405df088c1c4cfd940284b4290cacbfb02e64f4877c6"},
]
idna = [
- {file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"},
- {file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"},
+ {file = "idna-3.2-py3-none-any.whl", hash = "sha256:14475042e284991034cb48e06f6851428fb14c4dc953acd9be9a5e95c7b6dd7a"},
+ {file = "idna-3.2.tar.gz", hash = "sha256:467fbad99067910785144ce333826c71fb0e63a425657295239737f7ecd125f3"},
]
immutables = [
- {file = "immutables-0.15-cp35-cp35m-macosx_10_14_x86_64.whl", hash = "sha256:6728f4392e3e8e64b593a5a0cd910a1278f07f879795517e09f308daed138631"},
- {file = "immutables-0.15-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:f0836cd3bdc37c8a77b192bbe5f41dbcc3ce654db048ebbba89bdfe6db7a1c7a"},
- {file = "immutables-0.15-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:8703d8abfd8687932f2a05f38e7de270c3a6ca3bd1c1efb3c938656b3f2f985a"},
- {file = "immutables-0.15-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:b8ad986f9b532c026f19585289384b0769188fcb68b37c7f0bd0df9092a6ca54"},
- {file = "immutables-0.15-cp36-cp36m-win_amd64.whl", hash = "sha256:6f117d9206165b9dab8fd81c5129db757d1a044953f438654236ed9a7a4224ae"},
- {file = "immutables-0.15-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:b75ade826920c4e490b1bb14cf967ac14e61eb7c5562161c5d7337d61962c226"},
- {file = "immutables-0.15-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:b7e13c061785e34f73c4f659861f1b3e4a5fd918e4395c84b21c4e3d449ebe27"},
- {file = "immutables-0.15-cp37-cp37m-win_amd64.whl", hash = "sha256:3035849accee4f4e510ed7c94366a40e0f5fef9069fbe04a35f4787b13610a4a"},
- {file = "immutables-0.15-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:b04fa69174e0c8f815f9c55f2a43fc9e5a68452fab459a08e904a74e8471639f"},
- {file = "immutables-0.15-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:141c2e9ea515a3a815007a429f0b47a578ebeb42c831edaec882a245a35fffca"},
- {file = "immutables-0.15-cp38-cp38-win_amd64.whl", hash = "sha256:cbe8c64640637faa5535d539421b293327f119c31507c33ca880bd4f16035eb6"},
- {file = "immutables-0.15-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:a0a4e4417d5ef4812d7f99470cd39347b58cb927365dd2b8da9161040d260db0"},
- {file = "immutables-0.15-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:3b15c08c71c59e5b7c2470ef949d49ff9f4263bb77f488422eaa157da84d6999"},
- {file = "immutables-0.15-cp39-cp39-win_amd64.whl", hash = "sha256:2283a93c151566e6830aee0e5bee55fc273455503b43aa004356b50f9182092b"},
- {file = "immutables-0.15.tar.gz", hash = "sha256:3713ab1ebbb6946b7ce1387bb9d1d7f5e09c45add58c2a2ee65f963c171e746b"},
+ {file = "immutables-0.16-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:acbfa79d44228d96296279068441f980dc63dbed52522d9227ff9f4d96c6627e"},
+ {file = "immutables-0.16-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:29c9ed003eacb92e630ef200e31f47236c2139b39476894f7963b32bd39bafa3"},
+ {file = "immutables-0.16-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:0a396314b9024fa55bf83a27813fd76cf9f27dce51f53b0f19b51de035146251"},
+ {file = "immutables-0.16-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:4a2a71678348fb95b13ca108d447f559a754c41b47bd1e7e4fb23974e735682d"},
+ {file = "immutables-0.16-cp36-cp36m-win32.whl", hash = "sha256:064001638ab5d36f6aa05b6101446f4a5793fb71e522bc81b8fc65a1894266ff"},
+ {file = "immutables-0.16-cp36-cp36m-win_amd64.whl", hash = "sha256:1de393f1b188740ca7b38f946f2bbc7edf3910d2048f03bbb8d01f17a038d67c"},
+ {file = "immutables-0.16-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:fcf678a3074613119385a02a07c469ec5130559f5ea843c85a0840c80b5b71c6"},
+ {file = "immutables-0.16-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a307eb0984eb43e815dcacea3ac50c11d00a936ecf694c46991cd5a23bcb0ec0"},
+ {file = "immutables-0.16-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:7a58825ff2254e2612c5a932174398a4ea8fbddd8a64a02c880cc32ee28b8820"},
+ {file = "immutables-0.16-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:798b095381eb42cf40db6876339e7bed84093e5868018a9e73d8e1f7ab4bb21e"},
+ {file = "immutables-0.16-cp37-cp37m-win32.whl", hash = "sha256:19bdede174847c2ef1292df0f23868ab3918b560febb09fcac6eec621bd4812b"},
+ {file = "immutables-0.16-cp37-cp37m-win_amd64.whl", hash = "sha256:9ccf4c0e3e2e3237012b516c74c49de8872ccdf9129739f7a0b9d7444a8c4862"},
+ {file = "immutables-0.16-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:d59beef203a3765db72b1d0943547425c8318ecf7d64c451fd1e130b653c2fbb"},
+ {file = "immutables-0.16-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0020aaa4010b136056c20a46ce53204e1407a9e4464246cb2cf95b90808d9161"},
+ {file = "immutables-0.16-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:edd9f67671555af1eb99ad3c7550238487dd7ac0ac5205b40204ed61c9a922ac"},
+ {file = "immutables-0.16-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:298a301f85f307b4c056a0825eb30f060e64d73605e783289f3df37dd762bab8"},
+ {file = "immutables-0.16-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:b779617f5b94486bfd0f22162cd72eb5f2beb0214a14b75fdafb7b2c908ed0cb"},
+ {file = "immutables-0.16-cp38-cp38-win32.whl", hash = "sha256:511c93d8b1bbbf103ff3f1f120c5a68a9866ce03dea6ac406537f93ca9b19139"},
+ {file = "immutables-0.16-cp38-cp38-win_amd64.whl", hash = "sha256:b651b61c1af6cda2ee201450f2ffe048a5959bc88e43e6c312f4c93e69c9e929"},
+ {file = "immutables-0.16-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:aa7bf572ae1e006104c584be70dc634849cf0dc62f42f4ee194774f97e7fd17d"},
+ {file = "immutables-0.16-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:50793a44ba0d228ed8cad4d0925e00dfd62ea32f44ddee8854f8066447272d05"},
+ {file = "immutables-0.16-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:799621dcdcdcbb2516546a40123b87bf88de75fe7459f7bd8144f079ace6ec3e"},
+ {file = "immutables-0.16-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:7bcf52aeb983bd803b7c6106eae1b2d9a0c7ab1241bc6b45e2174ba2b7283031"},
+ {file = "immutables-0.16-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:734c269e82e5f307fb6e17945953b67659d1731e65309787b8f7ba267d1468f2"},
+ {file = "immutables-0.16-cp39-cp39-win32.whl", hash = "sha256:a454d5d3fee4b7cc627345791eb2ca4b27fa3bbb062ccf362ecaaa51679a07ed"},
+ {file = "immutables-0.16-cp39-cp39-win_amd64.whl", hash = "sha256:2505d93395d3f8ae4223e21465994c3bc6952015a38dc4f03cb3e07a2b8d8325"},
+ {file = "immutables-0.16.tar.gz", hash = "sha256:d67e86859598eed0d926562da33325dac7767b7b1eff84e232c22abea19f4360"},
]
importlib-metadata = [
{file = "importlib_metadata-2.1.1-py2.py3-none-any.whl", hash = "sha256:c2d6341ff566f609e89a2acb2db190e5e1d23d5409d6cc8d2fe34d72443876d4"},
@@ -887,13 +961,37 @@ iniconfig = [
{file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"},
]
isort = [
- {file = "isort-5.9.1-py3-none-any.whl", hash = "sha256:8e2c107091cfec7286bc0f68a547d0ba4c094d460b732075b6fba674f1035c0c"},
- {file = "isort-5.9.1.tar.gz", hash = "sha256:83510593e07e433b77bd5bff0f6f607dbafa06d1a89022616f02d8b699cfcd56"},
+ {file = "isort-5.9.3-py3-none-any.whl", hash = "sha256:e17d6e2b81095c9db0a03a8025a957f334d6ea30b26f9ec70805411e5c7c81f2"},
+ {file = "isort-5.9.3.tar.gz", hash = "sha256:9c2ea1e62d871267b78307fe511c0838ba0da28698c5732d54e2790bf3ba9899"},
]
jinja2 = [
{file = "Jinja2-3.0.1-py3-none-any.whl", hash = "sha256:1f06f2da51e7b56b8f238affdd6b4e2c61e39598a378cc49345bc1bd42a978a4"},
{file = "Jinja2-3.0.1.tar.gz", hash = "sha256:703f484b47a6af502e743c9122595cc812b0271f661722403114f71a79d0f5a4"},
]
+lazy-object-proxy = [
+ {file = "lazy-object-proxy-1.6.0.tar.gz", hash = "sha256:489000d368377571c6f982fba6497f2aa13c6d1facc40660963da62f5c379726"},
+ {file = "lazy_object_proxy-1.6.0-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:c6938967f8528b3668622a9ed3b31d145fab161a32f5891ea7b84f6b790be05b"},
+ {file = "lazy_object_proxy-1.6.0-cp27-cp27m-win32.whl", hash = "sha256:ebfd274dcd5133e0afae738e6d9da4323c3eb021b3e13052d8cbd0e457b1256e"},
+ {file = "lazy_object_proxy-1.6.0-cp27-cp27m-win_amd64.whl", hash = "sha256:ed361bb83436f117f9917d282a456f9e5009ea12fd6de8742d1a4752c3017e93"},
+ {file = "lazy_object_proxy-1.6.0-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:d900d949b707778696fdf01036f58c9876a0d8bfe116e8d220cfd4b15f14e741"},
+ {file = "lazy_object_proxy-1.6.0-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:5743a5ab42ae40caa8421b320ebf3a998f89c85cdc8376d6b2e00bd12bd1b587"},
+ {file = "lazy_object_proxy-1.6.0-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:bf34e368e8dd976423396555078def5cfc3039ebc6fc06d1ae2c5a65eebbcde4"},
+ {file = "lazy_object_proxy-1.6.0-cp36-cp36m-win32.whl", hash = "sha256:b579f8acbf2bdd9ea200b1d5dea36abd93cabf56cf626ab9c744a432e15c815f"},
+ {file = "lazy_object_proxy-1.6.0-cp36-cp36m-win_amd64.whl", hash = "sha256:4f60460e9f1eb632584c9685bccea152f4ac2130e299784dbaf9fae9f49891b3"},
+ {file = "lazy_object_proxy-1.6.0-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:d7124f52f3bd259f510651450e18e0fd081ed82f3c08541dffc7b94b883aa981"},
+ {file = "lazy_object_proxy-1.6.0-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:22ddd618cefe54305df49e4c069fa65715be4ad0e78e8d252a33debf00f6ede2"},
+ {file = "lazy_object_proxy-1.6.0-cp37-cp37m-win32.whl", hash = "sha256:9d397bf41caad3f489e10774667310d73cb9c4258e9aed94b9ec734b34b495fd"},
+ {file = "lazy_object_proxy-1.6.0-cp37-cp37m-win_amd64.whl", hash = "sha256:24a5045889cc2729033b3e604d496c2b6f588c754f7a62027ad4437a7ecc4837"},
+ {file = "lazy_object_proxy-1.6.0-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:17e0967ba374fc24141738c69736da90e94419338fd4c7c7bef01ee26b339653"},
+ {file = "lazy_object_proxy-1.6.0-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:410283732af311b51b837894fa2f24f2c0039aa7f220135192b38fcc42bd43d3"},
+ {file = "lazy_object_proxy-1.6.0-cp38-cp38-win32.whl", hash = "sha256:85fb7608121fd5621cc4377a8961d0b32ccf84a7285b4f1d21988b2eae2868e8"},
+ {file = "lazy_object_proxy-1.6.0-cp38-cp38-win_amd64.whl", hash = "sha256:d1c2676e3d840852a2de7c7d5d76407c772927addff8d742b9808fe0afccebdf"},
+ {file = "lazy_object_proxy-1.6.0-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:b865b01a2e7f96db0c5d12cfea590f98d8c5ba64ad222300d93ce6ff9138bcad"},
+ {file = "lazy_object_proxy-1.6.0-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:4732c765372bd78a2d6b2150a6e99d00a78ec963375f236979c0626b97ed8e43"},
+ {file = "lazy_object_proxy-1.6.0-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:9698110e36e2df951c7c36b6729e96429c9c32b3331989ef19976592c5f3c77a"},
+ {file = "lazy_object_proxy-1.6.0-cp39-cp39-win32.whl", hash = "sha256:1fee665d2638491f4d6e55bd483e15ef21f6c8c2095f235fef72601021e64f61"},
+ {file = "lazy_object_proxy-1.6.0-cp39-cp39-win_amd64.whl", hash = "sha256:f5144c75445ae3ca2057faac03fda5a902eff196702b0a24daf1d6ce0650514b"},
+]
markupsafe = [
{file = "MarkupSafe-2.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51"},
{file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff"},
@@ -972,8 +1070,8 @@ packaging = [
{file = "packaging-21.0.tar.gz", hash = "sha256:7dc96269f53a4ccec5c0670940a4281106dd0bb343f47b7471f779df49c2fbe7"},
]
pathspec = [
- {file = "pathspec-0.8.1-py2.py3-none-any.whl", hash = "sha256:aa0cb481c4041bf52ffa7b0d8fa6cd3e88a2ca4879c533c9153882ee2556790d"},
- {file = "pathspec-0.8.1.tar.gz", hash = "sha256:86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd"},
+ {file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"},
+ {file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"},
]
pluggy = [
{file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"},
@@ -1045,6 +1143,10 @@ pyflakes = [
{file = "pyflakes-2.3.1-py2.py3-none-any.whl", hash = "sha256:7893783d01b8a89811dd72d7dfd4d84ff098e5eed95cfa8905b22bbffe52efc3"},
{file = "pyflakes-2.3.1.tar.gz", hash = "sha256:f5bc8ecabc05bb9d291eb5203d6810b49040f6ff446a756326104746cc00c1db"},
]
+pylint = [
+ {file = "pylint-2.9.6-py3-none-any.whl", hash = "sha256:2e1a0eb2e8ab41d6b5dbada87f066492bb1557b12b76c47c2ee8aa8a11186594"},
+ {file = "pylint-2.9.6.tar.gz", hash = "sha256:8b838c8983ee1904b2de66cce9d0b96649a91901350e956d78f289c3bc87b48e"},
+]
pyparsing = [
{file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"},
{file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"},
@@ -1062,8 +1164,8 @@ pytest-mock = [
{file = "pytest_mock-3.6.1-py3-none-any.whl", hash = "sha256:30c2f2cc9759e76eee674b81ea28c9f0b94f8f0445a1b87762cadf774f0df7e3"},
]
python-dateutil = [
- {file = "python-dateutil-2.8.1.tar.gz", hash = "sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c"},
- {file = "python_dateutil-2.8.1-py2.py3-none-any.whl", hash = "sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a"},
+ {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"},
+ {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"},
]
python-multipart = [
{file = "python-multipart-0.0.5.tar.gz", hash = "sha256:f7bb5f611fc600d15fa47b3974c8aa16e93724513b49b5f95c81e6624c83fa43"},
@@ -1100,47 +1202,43 @@ pyyaml = [
{file = "PyYAML-5.4.1.tar.gz", hash = "sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e"},
]
regex = [
- {file = "regex-2021.7.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:494d0172774dc0beeea984b94c95389143db029575f7ca908edd74469321ea99"},
- {file = "regex-2021.7.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:8cf6728f89b071bd3ab37cb8a0e306f4de897553a0ed07442015ee65fbf53d62"},
- {file = "regex-2021.7.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:1806370b2bef4d4193eebe8ee59a9fd7547836a34917b7badbe6561a8594d9cb"},
- {file = "regex-2021.7.1-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:d0cf2651a8804f6325747c7e55e3be0f90ee2848e25d6b817aa2728d263f9abb"},
- {file = "regex-2021.7.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:268fe9dd1deb4a30c8593cabd63f7a241dfdc5bd9dd0233906c718db22cdd49a"},
- {file = "regex-2021.7.1-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:7743798dfb573d006f1143d745bf17efad39775a5190b347da5d83079646be56"},
- {file = "regex-2021.7.1-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:0e46c1191b2eb293a6912269ed08b4512e7e241bbf591f97e527492e04c77e93"},
- {file = "regex-2021.7.1-cp36-cp36m-win32.whl", hash = "sha256:b1dbeef938281f240347d50f28ae53c4b046a23389cd1fc4acec5ea0eae646a1"},
- {file = "regex-2021.7.1-cp36-cp36m-win_amd64.whl", hash = "sha256:6c72ebb72e64e9bd195cb35a9b9bbfb955fd953b295255b8ae3e4ad4a146b615"},
- {file = "regex-2021.7.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:bf819c5b77ff44accc9a24e31f1f7ceaaf6c960816913ed3ef8443b9d20d81b6"},
- {file = "regex-2021.7.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:e80d2851109e56420b71f9702ad1646e2f0364528adbf6af85527bc61e49f394"},
- {file = "regex-2021.7.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:a1b6a3f600d6aff97e3f28c34192c9ed93fee293bd96ef327b64adb51a74b2f6"},
- {file = "regex-2021.7.1-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:ed77b97896312bc2deafe137ca2626e8b63808f5bedb944f73665c68093688a7"},
- {file = "regex-2021.7.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:a548bb51c4476332ce4139df8e637386730f79a92652a907d12c696b6252b64d"},
- {file = "regex-2021.7.1-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:210c359e6ee5b83f7d8c529ba3c75ba405481d50f35a420609b0db827e2e3bb5"},
- {file = "regex-2021.7.1-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:1d386402ae7f3c9b107ae5863f7ecccb0167762c82a687ae6526b040feaa5ac6"},
- {file = "regex-2021.7.1-cp37-cp37m-win32.whl", hash = "sha256:5049d00dbb78f9d166d1c704e93934d42cce0570842bb1a61695123d6b01de09"},
- {file = "regex-2021.7.1-cp37-cp37m-win_amd64.whl", hash = "sha256:361be4d311ac995a8c7ad577025a3ae3a538531b1f2cf32efd8b7e5d33a13e5a"},
- {file = "regex-2021.7.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f32f47fb22c988c0b35756024b61d156e5c4011cb8004aa53d93b03323c45657"},
- {file = "regex-2021.7.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:b024ee43ee6b310fad5acaee23e6485b21468718cb792a9d1693eecacc3f0b7e"},
- {file = "regex-2021.7.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:b092754c06852e8a8b022004aff56c24b06310189186805800d09313c37ce1f8"},
- {file = "regex-2021.7.1-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:a8a5826d8a1b64e2ff9af488cc179e1a4d0f144d11ce486a9f34ea38ccedf4ef"},
- {file = "regex-2021.7.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:444723ebaeb7fa8125f29c01a31101a3854ac3de293e317944022ae5effa53a4"},
- {file = "regex-2021.7.1-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:fdad3122b69cdabdb3da4c2a4107875913ac78dab0117fc73f988ad589c66b66"},
- {file = "regex-2021.7.1-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:4b1999ef60c45357598935c12508abf56edbbb9c380df6f336de38a6c3a294ae"},
- {file = "regex-2021.7.1-cp38-cp38-win32.whl", hash = "sha256:e07e92935040c67f49571779d115ecb3e727016d42fb36ee0d8757db4ca12ee0"},
- {file = "regex-2021.7.1-cp38-cp38-win_amd64.whl", hash = "sha256:6b8b629f93246e507287ee07e26744beaffb4c56ed520576deac8b615bd76012"},
- {file = "regex-2021.7.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:56bef6b414949e2c9acf96cb5d78de8b529c7b99752619494e78dc76f99fd005"},
- {file = "regex-2021.7.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:78a2a885345a2d60b5e68099e877757d5ed12e46ba1e87507175f14f80892af3"},
- {file = "regex-2021.7.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:3f7a92e60930f8fca2623d9e326c173b7cf2c8b7e4fdcf984b75a1d2fb08114d"},
- {file = "regex-2021.7.1-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:4fc86b729ab88fe8ac3ec92287df253c64aa71560d76da5acd8a2e245839c629"},
- {file = "regex-2021.7.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:59845101de68fd5d3a1145df9ea022e85ecd1b49300ea68307ad4302320f6f61"},
- {file = "regex-2021.7.1-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:ce269e903b00d1ab4746793e9c50a57eec5d5388681abef074d7b9a65748fca5"},
- {file = "regex-2021.7.1-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:c11f2fca544b5e30a0e813023196a63b1cb9869106ef9a26e9dae28bce3e4e26"},
- {file = "regex-2021.7.1-cp39-cp39-win32.whl", hash = "sha256:1ccbd41dbee3a31e18938096510b7d4ee53aa9fce2ee3dcc8ec82ae264f6acfd"},
- {file = "regex-2021.7.1-cp39-cp39-win_amd64.whl", hash = "sha256:18040755606b0c21281493ec309214bd61e41a170509e5014f41d6a5a586e161"},
- {file = "regex-2021.7.1.tar.gz", hash = "sha256:849802379a660206277675aa5a5c327f5c910c690649535863ddf329b0ba8c87"},
+ {file = "regex-2021.8.3-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:8764a78c5464ac6bde91a8c87dd718c27c1cabb7ed2b4beaf36d3e8e390567f9"},
+ {file = "regex-2021.8.3-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4551728b767f35f86b8e5ec19a363df87450c7376d7419c3cac5b9ceb4bce576"},
+ {file = "regex-2021.8.3-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:577737ec3d4c195c4aef01b757905779a9e9aee608fa1cf0aec16b5576c893d3"},
+ {file = "regex-2021.8.3-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:c856ec9b42e5af4fe2d8e75970fcc3a2c15925cbcc6e7a9bcb44583b10b95e80"},
+ {file = "regex-2021.8.3-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3835de96524a7b6869a6c710b26c90e94558c31006e96ca3cf6af6751b27dca1"},
+ {file = "regex-2021.8.3-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:cea56288eeda8b7511d507bbe7790d89ae7049daa5f51ae31a35ae3c05408531"},
+ {file = "regex-2021.8.3-cp36-cp36m-win32.whl", hash = "sha256:a4eddbe2a715b2dd3849afbdeacf1cc283160b24e09baf64fa5675f51940419d"},
+ {file = "regex-2021.8.3-cp36-cp36m-win_amd64.whl", hash = "sha256:57fece29f7cc55d882fe282d9de52f2f522bb85290555b49394102f3621751ee"},
+ {file = "regex-2021.8.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a5c6dbe09aff091adfa8c7cfc1a0e83fdb8021ddb2c183512775a14f1435fe16"},
+ {file = "regex-2021.8.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ff4a8ad9638b7ca52313d8732f37ecd5fd3c8e3aff10a8ccb93176fd5b3812f6"},
+ {file = "regex-2021.8.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b63e3571b24a7959017573b6455e05b675050bbbea69408f35f3cb984ec54363"},
+ {file = "regex-2021.8.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:fbc20975eee093efa2071de80df7f972b7b35e560b213aafabcec7c0bd00bd8c"},
+ {file = "regex-2021.8.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:14caacd1853e40103f59571f169704367e79fb78fac3d6d09ac84d9197cadd16"},
+ {file = "regex-2021.8.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:bb350eb1060591d8e89d6bac4713d41006cd4d479f5e11db334a48ff8999512f"},
+ {file = "regex-2021.8.3-cp37-cp37m-win32.whl", hash = "sha256:18fdc51458abc0a974822333bd3a932d4e06ba2a3243e9a1da305668bd62ec6d"},
+ {file = "regex-2021.8.3-cp37-cp37m-win_amd64.whl", hash = "sha256:026beb631097a4a3def7299aa5825e05e057de3c6d72b139c37813bfa351274b"},
+ {file = "regex-2021.8.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:16d9eaa8c7e91537516c20da37db975f09ac2e7772a0694b245076c6d68f85da"},
+ {file = "regex-2021.8.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3905c86cc4ab6d71635d6419a6f8d972cab7c634539bba6053c47354fd04452c"},
+ {file = "regex-2021.8.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:937b20955806381e08e54bd9d71f83276d1f883264808521b70b33d98e4dec5d"},
+ {file = "regex-2021.8.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:28e8af338240b6f39713a34e337c3813047896ace09d51593d6907c66c0708ba"},
+ {file = "regex-2021.8.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3c09d88a07483231119f5017904db8f60ad67906efac3f1baa31b9b7f7cca281"},
+ {file = "regex-2021.8.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:85f568892422a0e96235eb8ea6c5a41c8ccbf55576a2260c0160800dbd7c4f20"},
+ {file = "regex-2021.8.3-cp38-cp38-win32.whl", hash = "sha256:bf6d987edd4a44dd2fa2723fca2790f9442ae4de2c8438e53fcb1befdf5d823a"},
+ {file = "regex-2021.8.3-cp38-cp38-win_amd64.whl", hash = "sha256:8fe58d9f6e3d1abf690174fd75800fda9bdc23d2a287e77758dc0e8567e38ce6"},
+ {file = "regex-2021.8.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7976d410e42be9ae7458c1816a416218364e06e162b82e42f7060737e711d9ce"},
+ {file = "regex-2021.8.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9569da9e78f0947b249370cb8fadf1015a193c359e7e442ac9ecc585d937f08d"},
+ {file = "regex-2021.8.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:459bbe342c5b2dec5c5223e7c363f291558bc27982ef39ffd6569e8c082bdc83"},
+ {file = "regex-2021.8.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:4f421e3cdd3a273bace013751c345f4ebeef08f05e8c10757533ada360b51a39"},
+ {file = "regex-2021.8.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ea212df6e5d3f60341aef46401d32fcfded85593af1d82b8b4a7a68cd67fdd6b"},
+ {file = "regex-2021.8.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:a3b73390511edd2db2d34ff09aa0b2c08be974c71b4c0505b4a048d5dc128c2b"},
+ {file = "regex-2021.8.3-cp39-cp39-win32.whl", hash = "sha256:f35567470ee6dbfb946f069ed5f5615b40edcbb5f1e6e1d3d2b114468d505fc6"},
+ {file = "regex-2021.8.3-cp39-cp39-win_amd64.whl", hash = "sha256:bfa6a679410b394600eafd16336b2ce8de43e9b13f7fb9247d84ef5ad2b45e91"},
+ {file = "regex-2021.8.3.tar.gz", hash = "sha256:8935937dad2c9b369c3d932b0edbc52a62647c2afb2fafc0c280f14a8bf56a6a"},
]
requests = [
- {file = "requests-2.25.1-py2.py3-none-any.whl", hash = "sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e"},
- {file = "requests-2.25.1.tar.gz", hash = "sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804"},
+ {file = "requests-2.26.0-py2.py3-none-any.whl", hash = "sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24"},
+ {file = "requests-2.26.0.tar.gz", hash = "sha256:b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7"},
]
rfc3986 = [
{file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"},
@@ -1170,6 +1268,10 @@ toml = [
{file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"},
{file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"},
]
+tomli = [
+ {file = "tomli-1.2.1-py3-none-any.whl", hash = "sha256:8dd0e9524d6f386271a36b41dbf6c57d8e32fd96fd22b6584679dc569d20899f"},
+ {file = "tomli-1.2.1.tar.gz", hash = "sha256:a5b75cb6f3968abb47af1b40c1819dc519ea82bcc065776a866e8d74c5ca9442"},
+]
typed-ast = [
{file = "typed_ast-1.4.3-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:2068531575a125b87a41802130fa7e29f26c09a2833fea68d9a40cf33902eba6"},
{file = "typed_ast-1.4.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:c907f561b1e83e93fad565bac5ba9c22d96a54e7ea0267c708bffe863cbe4075"},
@@ -1215,16 +1317,16 @@ types-certifi = [
{file = "types_certifi-0.1.4-py2.py3-none-any.whl", hash = "sha256:afe4d94726491d843f10e5746797689ea5dcbd78454a653be47d72a8c8ce3bed"},
]
types-dataclasses = [
- {file = "types-dataclasses-0.1.5.tar.gz", hash = "sha256:7b5f4099fb21c209f2df3a83c2b64308c29955769d610a457244dc0eebe1cafc"},
- {file = "types_dataclasses-0.1.5-py2.py3-none-any.whl", hash = "sha256:c19491cfb981bff9cafd9c113c291a7a54adccc6298ded8ca3de0d7abe211984"},
+ {file = "types-dataclasses-0.1.7.tar.gz", hash = "sha256:248075d093d8f7c1541ce515594df7ae40233d1340afde11ce7125368c5209b8"},
+ {file = "types_dataclasses-0.1.7-py3-none-any.whl", hash = "sha256:fc372bb68b878ac7a68fd04230d923d4a6303a137ecb0b9700b90630bdfcbfc9"},
]
types-python-dateutil = [
- {file = "types-python-dateutil-0.1.4.tar.gz", hash = "sha256:e6486ca27b6dde73e0ec079a9e1b03e208766e6bc7f1e08964a7e9104a5c7d7a"},
- {file = "types_python_dateutil-0.1.4-py2.py3-none-any.whl", hash = "sha256:39bfe0bde61fc673b8fa28167bd78622d976210f791971b9f3e10877cbf119a4"},
+ {file = "types-python-dateutil-0.1.6.tar.gz", hash = "sha256:b02de39a54ce6e3fadfdc7dba77d8519fbfb6ca049920e190b5f89c74d5f9de6"},
+ {file = "types_python_dateutil-0.1.6-py3-none-any.whl", hash = "sha256:5b6241ea9fca2d8878cc152017d9524da62a7a856b98e31006e68b02aab47442"},
]
types-pyyaml = [
- {file = "types-PyYAML-5.4.3.tar.gz", hash = "sha256:2e7b81b2b7af751634425107b986086c6ba7cb61270a43a5c290c58be8cdbc3a"},
- {file = "types_PyYAML-5.4.3-py2.py3-none-any.whl", hash = "sha256:bca83cbfc0be48600a8abf1e3d87fb762a91e6d35d724029a3321dd2dce2ceb1"},
+ {file = "types-PyYAML-5.4.6.tar.gz", hash = "sha256:745dcb4b1522423026bcc83abb9925fba747f1e8602d902f71a4058f9e7fb662"},
+ {file = "types_PyYAML-5.4.6-py3-none-any.whl", hash = "sha256:96f8d3d96aa1a18a465e8f6a220e02cff2f52632314845a364ecbacb0aea6e30"},
]
typing-extensions = [
{file = "typing_extensions-3.10.0.0-py2-none-any.whl", hash = "sha256:0ac0f89795dd19de6b97debb0c6af1c70987fd80a2d62d1958f7e56fcc31b497"},
@@ -1235,6 +1337,9 @@ urllib3 = [
{file = "urllib3-1.26.6-py2.py3-none-any.whl", hash = "sha256:39fb8672126159acb139a7718dd10806104dec1e2f0f6c88aab05d17df10c8d4"},
{file = "urllib3-1.26.6.tar.gz", hash = "sha256:f57b4c16c62fa2760b7e3d97c35b255512fb6b59a259730f36ba32ce9f8e342f"},
]
+wrapt = [
+ {file = "wrapt-1.12.1.tar.gz", hash = "sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7"},
+]
zipp = [
{file = "zipp-3.5.0-py3-none-any.whl", hash = "sha256:957cfda87797e389580cb8b9e3870841ca991e2125350677b2ca83a0e99390a3"},
{file = "zipp-3.5.0.tar.gz", hash = "sha256:f5812b1e007e48cff63449a5e9f4e7ebea716b4111f9c4f9a645f91d579bf0c4"},
diff --git a/pyproject.toml b/pyproject.toml
index 793a378ed..6fe380b3f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -33,6 +33,7 @@ attrs = "^21.0.0"
python-dateutil = "^2.8.1"
httpx = ">=0.15.4,<0.19.0"
autoflake = "^1.4"
+typing-extensions = { version = "*", python = "<3.8" }
[tool.poetry.scripts]
openapi-python-client = "openapi_python_client.cli:app"
@@ -51,6 +52,7 @@ types-PyYAML = "^5.4.3"
types-certifi = "^0.1.4"
types-python-dateutil = "^0.1.4"
types-dataclasses = { version = "^0.1.5", python = "<3.7" }
+pylint = "^2.9.6"
[tool.taskipy.tasks]
check = """
@@ -59,6 +61,7 @@ isort .\
&& flake8 openapi_python_client\
&& poetry export -f requirements.txt | poetry run safety check --bare --stdin\
&& mypy openapi_python_client\
+ && pylint openapi_python_client\
&& pytest --cov openapi_python_client tests --cov-report=term-missing\
"""
regen = "python -m end_to_end_tests.regen_golden_record"
@@ -94,6 +97,27 @@ skip = [".venv", "tests/test_templates"]
[tool.coverage.run]
omit = ["openapi_python_client/templates/*"]
+[tool.pylint.format]
+max-line-length = 120
+
+[tool.pylint.messages_control]
+disable = [
+ # DRY < MOIST
+ "duplicate-code",
+ # Sometimes necessary to prevent cycles
+ "import-outside-toplevel",
+ # Modules are mostly used for organization here, there is no lib API
+ "missing-module-docstring",
+ # Organization is important, even when just separating classes
+ "too-few-public-methods",
+ # Disable any type-checking, that's what mypy is for
+ "no-member",
+ "no-name-in-module",
+ "import-error",
+ # False positives
+ "cyclic-import",
+]
+
[build-system]
requires = ["poetry>=1.0"]
build-backend = "poetry.masonry.api"
diff --git a/tests/test___init__.py b/tests/test___init__.py
index 3e1efbd5c..5ac49d58b 100644
--- a/tests/test___init__.py
+++ b/tests/test___init__.py
@@ -519,6 +519,7 @@ def test__reformat(mocker):
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
+ check=True,
),
mocker.call(
"isort .",
@@ -526,8 +527,16 @@ def test__reformat(mocker):
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
+ check=True,
+ ),
+ mocker.call(
+ "black .",
+ cwd=project.project_dir,
+ shell=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ check=True,
),
- mocker.call("black .", cwd=project.project_dir, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE),
]
)
diff --git a/tests/test_parser/test_openapi.py b/tests/test_parser/test_openapi.py
index 49eb09705..fc5824201 100644
--- a/tests/test_parser/test_openapi.py
+++ b/tests/test_parser/test_openapi.py
@@ -107,25 +107,6 @@ def test_swagger_document_invalid_schema(self, mocker):
Schemas.build.assert_not_called()
Schemas.assert_not_called()
- def test_from_dict_invalid_version(self, mocker):
- Schemas = mocker.patch(f"{MODULE_NAME}.Schemas")
- OpenAPI = mocker.patch(f"{MODULE_NAME}.oai.OpenAPI")
- openapi = OpenAPI.parse_obj.return_value
- openapi.openapi = oai.SemVer("2.1.3")
- in_dict = mocker.MagicMock()
- config = mocker.MagicMock()
-
- from openapi_python_client.parser.openapi import GeneratorData
-
- generator_data = GeneratorData.from_dict(in_dict, config=config)
-
- assert generator_data == GeneratorError(
- header="openapi-python-client only supports OpenAPI 3.x",
- detail="The version of the provided document was 2.1.3",
- )
- Schemas.build.assert_not_called()
- Schemas.assert_not_called()
-
class TestEndpoint:
def make_endpoint(self):
diff --git a/tests/test_utils.py b/tests/test_utils.py
index ec74accc2..c50c8d0cc 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -74,10 +74,6 @@ def test_no_string_escapes():
assert utils.remove_string_escapes('an "evil" string') == 'an \\"evil\\" string'
-def test__fix_keywords():
- assert utils.fix_keywords("None") == "None_"
-
-
@pytest.mark.parametrize(
"reserved_word, expected",
[
@@ -87,6 +83,7 @@ def test__fix_keywords():
("not_reserved", "not_reserved"),
("type", "type"),
("id", "id"),
+ ("None", "None_"),
],
)
def test__fix_reserved_words(reserved_word: str, expected: str):