From 7e67af3ec0977dec742030fc875f93b15938ddc7 Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Wed, 22 Feb 2023 11:03:10 +0800 Subject: [PATCH 1/2] Fix typos Found via `codespell -L nam` --- README.rst | 2 +- openapi3/openapi.py | 2 +- openapi3/schemas.py | 4 ++-- tests/fastapi_test.py | 2 +- tests/fixtures/example_array.yaml | 2 +- tests/fixtures/petstore-expanded.yaml | 4 ++-- tests/fixtures/with-broken-links.yaml | 4 ++-- tests/fixtures/with-links.yaml | 2 +- tests/parsing_test.py | 4 ++-- tests/ref_test.py | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.rst b/README.rst index 434d1a2..53e8b32 100644 --- a/README.rst +++ b/README.rst @@ -42,7 +42,7 @@ specs. For example, using `Linode's OpenAPI 3 Specification`_ for reference:: # call an operation that requires authentication linodes = api.call_getLinodeInstances() - # call an opertaion with parameters + # call an operation with parameters linode = api.call_getLinodeInstance(parameters={"linodeId": 123}) # the models returns are all of the same (generated) type diff --git a/openapi3/openapi.py b/openapi3/openapi.py index 53e3e3a..0b9e610 100644 --- a/openapi3/openapi.py +++ b/openapi3/openapi.py @@ -47,7 +47,7 @@ def __init__( :param ssl_verify: Decide if to use ssl verification to the requests or not, in case an str is passed, will be used as the CA. :type ssl_verify: bool, str, None - :param use_session: Should we use a consistant session between API calls + :param use_session: Should we use a consistent session between API calls :type use_session: bool """ # do this first so super().__init__ can see it diff --git a/openapi3/schemas.py b/openapi3/schemas.py index d196471..0796552 100644 --- a/openapi3/schemas.py +++ b/openapi3/schemas.py @@ -74,7 +74,7 @@ def _parse_data(self): self.minLength = self._get("minLength", int) self.pattern = self._get("pattern", str) self.maxItems = self._get("maxItems", int) - self.minItems = self._get("minItmes", int) + self.minItems = self._get("minItems", int) self.required = self._get("required", list) self.enum = self._get("enum", list) self.type = self._get("type", str) @@ -128,7 +128,7 @@ def get_type(self): # this is defined in ObjectBase.__init__ as all slots are if self._model_type is None: # pylint: disable=access-member-before-definition type_name = self.title or self.path[-1] - # if there are no defined properites for this model, use an empty dict + # if there are no defined properties for this model, use an empty dict # to allow the model to be set up correctly model_properties = self.properties or {} diff --git a/tests/fastapi_test.py b/tests/fastapi_test.py index b442189..b95174f 100644 --- a/tests/fastapi_test.py +++ b/tests/fastapi_test.py @@ -96,7 +96,7 @@ async def test_deletePet(event_loop, server, client): async def test_getPetUnexpectedResponse(event_loop, server, client): """ Tests that undeclared response codes raise the correct UnexpectedResponseError - with the relevant inforamtion included. + with the relevant information included. """ with pytest.raises( openapi3.UnexpectedResponseError, diff --git a/tests/fixtures/example_array.yaml b/tests/fixtures/example_array.yaml index e47cf16..cf3ef10 100644 --- a/tests/fixtures/example_array.yaml +++ b/tests/fixtures/example_array.yaml @@ -1,5 +1,5 @@ # this is a valid spec that contains a schema with an array as the value of an -# exmaple object +# example object openapi: "3.1.0" info: version: 1.0.0 diff --git a/tests/fixtures/petstore-expanded.yaml b/tests/fixtures/petstore-expanded.yaml index acd46d9..c7dbe90 100644 --- a/tests/fixtures/petstore-expanded.yaml +++ b/tests/fixtures/petstore-expanded.yaml @@ -18,9 +18,9 @@ paths: get: description: | Returns all pets from the system that the user has access to - Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt various justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. - Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a various odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. operationId: findPets parameters: - name: tags diff --git a/tests/fixtures/with-broken-links.yaml b/tests/fixtures/with-broken-links.yaml index e393969..7ee3338 100644 --- a/tests/fixtures/with-broken-links.yaml +++ b/tests/fixtures/with-broken-links.yaml @@ -10,7 +10,7 @@ paths: '200': description: This has links content: - applicaton/json: + application/json: schema: type: object properties: @@ -31,7 +31,7 @@ paths: '200': description: This has links too content: - applicaton/json: + application/json: schema: type: object properties: diff --git a/tests/fixtures/with-links.yaml b/tests/fixtures/with-links.yaml index 14a3246..7c09357 100644 --- a/tests/fixtures/with-links.yaml +++ b/tests/fixtures/with-links.yaml @@ -10,7 +10,7 @@ paths: '200': description: This has links content: - applicaton/json: + application/json: schema: type: object properties: diff --git a/tests/parsing_test.py b/tests/parsing_test.py index d20d6a1..8ad8704 100644 --- a/tests/parsing_test.py +++ b/tests/parsing_test.py @@ -23,7 +23,7 @@ def test_parsing_fails(broken): spec = OpenAPI(broken) -def test_parsing_broken_refernece(broken_reference): +def test_parsing_broken_reference(broken_reference): """ Tests that parsing fails correctly when a reference is broken """ @@ -136,7 +136,7 @@ def test_securityparameters(with_securityparameters): def test_example_type_array(with_array_example): """ - Tests that examples, definied as "any" type, accept arrays + Tests that examples, defined as "any" type, accept arrays """ spec = OpenAPI(with_array_example, validate=True) assert len(spec.errors()) == 0, spec.errors() diff --git a/tests/ref_test.py b/tests/ref_test.py index 3a15f5f..497a3ef 100644 --- a/tests/ref_test.py +++ b/tests/ref_test.py @@ -88,7 +88,7 @@ def test_ref_allof_handling(with_ref_allof): # paths['/allof-example']get.responses['200'].content['application/json'].schema # should not modify the component assert len(referenced_schema.properties) == 1, \ - "Unexpectedly found {} properties on componenets.schemas['Example']: {}".format( + "Unexpectedly found {} properties on components.schemas['Example']: {}".format( len(referenced_schema.properties), ", ".join(referenced_schema.properties.keys()), ) From f2d2c8ba2eb72f234c71cc3b86e00e128fd7bf92 Mon Sep 17 00:00:00 2001 From: dorthu Date: Thu, 2 Mar 2023 23:53:30 -0500 Subject: [PATCH 2/2] Don't fix placeholder text in example yaml This file comes from [the specification repo](https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.0/petstore-expanded.yaml) and shouldn't be modified. --- tests/fixtures/petstore-expanded.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fixtures/petstore-expanded.yaml b/tests/fixtures/petstore-expanded.yaml index c7dbe90..acd46d9 100644 --- a/tests/fixtures/petstore-expanded.yaml +++ b/tests/fixtures/petstore-expanded.yaml @@ -18,9 +18,9 @@ paths: get: description: | Returns all pets from the system that the user has access to - Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt various justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. + Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. - Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a various odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. operationId: findPets parameters: - name: tags