Compare commits

...

6 Commits

Author SHA1 Message Date
Sebastián Ramírez
9958d93120 🔖 Release 0.49.1 2020-02-28 22:48:03 +01:00
Sebastián Ramírez
b63512cd92 📝 Update release notes 2020-02-28 22:46:55 +01:00
merowinger92
74c4d1c1db 🐛 Fix declaring a single parameter per name (#994) 2020-02-28 22:36:30 +01:00
Sebastián Ramírez
7ccd81f706 🚀 Update Netlify deploy action (#1047) 2020-02-28 17:27:43 +01:00
Taneli Hukkinen
1da8d3f1e6 🔧 Move all mypy configurations to configuration file (#987) 2020-02-27 21:03:03 +01:00
Camila Gutierrez
92016da962 💚 Do not deploy preview to Netlify on external PRs while GitHub actions are solved (#1046) 2020-02-27 20:59:26 +01:00
7 changed files with 107 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ jobs:
- name: Build MkDocs
run: python3.7 -m mkdocs build
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.0
uses: nwtgck/actions-netlify@v1.0.3
with:
publish-dir: './site'
production-branch: master

View File

@@ -1,5 +1,12 @@
## Latest changes
## 0.49.1
* Fix path operation duplicated parameters when used in dependencies and the path operation function. PR [#994](https://github.com/tiangolo/fastapi/pull/994) by [@merowinger92](https://github.com/merowinger92).
* Update Netlify previews deployment GitHub action as the fix is already merged and there's a new release. PR [#1047](https://github.com/tiangolo/fastapi/pull/1047).
* Move mypy configurations to config file. PR [#987](https://github.com/tiangolo/fastapi/pull/987) by [@hukkinj1](https://github.com/hukkinj1).
* Temporary fix to Netlify previews not deployable from PRs from forks. PR [#1046](https://github.com/tiangolo/fastapi/pull/1046) by [@mariacamilagl](https://github.com/mariacamilagl).
## 0.49.0
* Fix encoding of `pathlib` paths in `jsonable_encoder`. PR [#978](https://github.com/tiangolo/fastapi/pull/978) by [@patrickmckenna](https://github.com/patrickmckenna).

View File

@@ -1,6 +1,6 @@
"""FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
__version__ = "0.49.0"
__version__ = "0.49.1"
from starlette.background import BackgroundTasks

View File

@@ -180,7 +180,9 @@ def get_openapi_path(
operation_parameters = get_openapi_operation_parameters(all_route_params)
parameters.extend(operation_parameters)
if parameters:
operation["parameters"] = parameters
operation["parameters"] = list(
{param["name"]: param for param in parameters}.values()
)
if method in METHODS_WITH_BODY:
request_body_oai = get_openapi_operation_request_body(
body_field=route.body_field, model_name_map=model_name_map

View File

@@ -1,2 +1,3 @@
[mypy]
disallow_untyped_defs = True
ignore_missing_imports = True

View File

@@ -3,6 +3,6 @@
set -e
set -x
mypy fastapi --disallow-untyped-defs
mypy fastapi
black fastapi tests --check
isort --multi-line=3 --trailing-comma --force-grid-wrap=0 --combine-as --line-width 88 --recursive --check-only --thirdparty fastapi fastapi tests

View File

@@ -0,0 +1,93 @@
from fastapi import Depends, FastAPI
from starlette.testclient import TestClient
app = FastAPI()
async def user_exists(user_id: int):
return True
@app.get("/users/{user_id}", dependencies=[Depends(user_exists)])
async def read_users(user_id: int):
pass
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
"paths": {
"/users/{user_id}": {
"get": {
"summary": "Read Users",
"operationId": "read_users_users__user_id__get",
"parameters": [
{
"required": True,
"schema": {"title": "User Id", "type": "integer"},
"name": "user_id",
"in": "path",
},
],
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
}
}
},
"components": {
"schemas": {
"HTTPValidationError": {
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": {"$ref": "#/components/schemas/ValidationError"},
}
},
},
"ValidationError": {
"title": "ValidationError",
"required": ["loc", "msg", "type"],
"type": "object",
"properties": {
"loc": {
"title": "Location",
"type": "array",
"items": {"type": "string"},
},
"msg": {"title": "Message", "type": "string"},
"type": {"title": "Error Type", "type": "string"},
},
},
}
},
}
def test_reused_param():
response = client.get("/openapi.json")
data = response.json()
assert data == openapi_schema
def test_read_users():
response = client.get("/users/42")
assert response.status_code == 200