Skip to content

Commit

Permalink
✨ Upgrade apispec version to 4.0+
Browse files Browse the repository at this point in the history
  • Loading branch information
perdy committed Nov 16, 2020
1 parent 6696970 commit 4aa46e8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion flama/schemas.py
Expand Up @@ -145,7 +145,7 @@ def get_endpoints(

def _add_endpoint_parameters(self, endpoint: EndpointInfo, schema: typing.Dict):
schema["parameters"] = [
self.converter.field2parameter(field.schema, name=field.name, default_in=field.location.name)
self.converter._field2parameter(field.schema, name=field.name, location=field.location.name)
for field in itertools.chain(endpoint.query_fields.values(), endpoint.path_fields.values())
]

Expand Down
16 changes: 8 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Expand Up @@ -27,7 +27,7 @@ python = "^3.6"
starlette = ">=0.14.0,<1.0.0"
marshmallow = "^3.0"
python-forge = {version = "^18.6",optional = true}
apispec = {version = "^3.0",optional = true}
apispec = {version = "^4.0",optional = true}
pyyaml = {version = "^5.0",optional = true}
databases = {version = "^0.4.0",optional = true}

Expand All @@ -41,7 +41,7 @@ ipdb = "^0.11"
isort = "^4.3"
python-multipart = "^0.0.5"
pyyaml = "^5.0"
apispec = "^3.0"
apispec = "^4.0"
flake8 = "^3.7"
pytest-asyncio = "^0.10"
sqlalchemy-utils = "^0.33"
Expand Down
8 changes: 4 additions & 4 deletions tests/test_pagination.py
Expand Up @@ -42,13 +42,13 @@ def test_pagination_schema_parameters(self, app):
"name": "page",
"in": "query",
"required": False,
"schema": {"default": None, "type": "integer", "format": "int32", "nullable": True},
"schema": {"default": None, "type": "integer", "nullable": True},
},
{
"name": "page_size",
"in": "query",
"required": False,
"schema": {"default": None, "type": "integer", "format": "int32", "nullable": True},
"schema": {"default": None, "type": "integer", "nullable": True},
},
{"name": "count", "in": "query", "required": False, "schema": {"type": "boolean", "default": True}},
]
Expand Down Expand Up @@ -157,13 +157,13 @@ def test_pagination_schema_parameters(self, app):
"name": "limit",
"in": "query",
"required": False,
"schema": {"default": None, "type": "integer", "format": "int32", "nullable": True},
"schema": {"default": None, "type": "integer", "nullable": True},
},
{
"name": "offset",
"in": "query",
"required": False,
"schema": {"default": None, "type": "integer", "format": "int32", "nullable": True},
"schema": {"default": None, "type": "integer", "nullable": True},
},
{"name": "count", "in": "query", "required": False, "schema": {"type": "boolean", "default": True}},
]
Expand Down
4 changes: 1 addition & 3 deletions tests/test_schemas.py
Expand Up @@ -140,9 +140,7 @@ def test_schema_path_params(self, app):

assert schema["description"] == "Path param."
assert response == {"description": "Param."}
assert parameters == [
{"name": "param", "in": "path", "required": True, "schema": {"type": "integer", "format": "int32"}}
]
assert parameters == [{"name": "param", "in": "path", "required": True, "schema": {"type": "integer"}}]

def test_schema_body_params(self, app):
schema = app.schema["paths"]["/body-param/"]["post"]
Expand Down

0 comments on commit 4aa46e8

Please sign in to comment.