Skip to content

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Aug 24, 2022

Bumps fastapi from 0.61.1 to 0.80.0.

Release notes

Sourced from fastapi's releases.

0.80.0

Breaking Changes - Fixes

If you are using response_model with some type that doesn't include None but the function is returning None, it will now raise an internal server error, because you are returning invalid data that violates the contract in response_model. Before this release it would allow breaking that contract returning None.

For example, if you have an app like this:

from fastapi import FastAPI
from pydantic import BaseModel
class Item(BaseModel):
name: str
price: Optional[float] = None
owner_ids: Optional[List[int]] = None
app = FastAPI()
@​app.get("/items/invalidnone", response_model=Item)
def get_invalid_none():
return None

...calling the path /items/invalidnone will raise an error, because None is not a valid type for the response_model declared with Item.

You could also be implicitly returning None without realizing, for example:

from fastapi import FastAPI
from pydantic import BaseModel
class Item(BaseModel):
name: str
price: Optional[float] = None
owner_ids: Optional[List[int]] = None
app = FastAPI()
@​app.get("/items/invalidnone", response_model=Item)
def get_invalid_none():
if flag:
return {"name": "foo"}
# if flag is False, at this point the function will implicitly return None

If you have path operations using response_model that need to be allowed to return None, make it explicit in response_model using Union[Something, None]:

</tr></table> 

... (truncated)

Commits
  • 7d6e707 🔖 Release version 0.80.0
  • 18819f9 📝 Update release notes
  • ad65e72 📝 Update release notes
  • ec072d7 ⬆ Upgrade Swagger UI copy of oauth2-redirect.html to include fixes for flav...
  • 09acce4 📝 Update release notes
  • f6808e7 ♻ Strip empty whitespace from description extracted from docstrings (#2821)
  • f8f5281 📝 Update release notes
  • b993b4a 🐛 Fix cached dependencies when using a dependency in Security() and other p...
  • 982911f 📝 Update release notes
  • 634cf22 🐛 Fix response_model not invalidating None (#2725)
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.61.1 to 0.80.0.
- [Release notes](https://github.com/tiangolo/fastapi/releases)
- [Commits](fastapi/fastapi@0.61.1...0.80.0)

---
updated-dependencies:
- dependency-name: fastapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Aug 24, 2022
@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Aug 29, 2022

Superseded by #91.

@dependabot dependabot bot closed this Aug 29, 2022
@dependabot dependabot bot deleted the dependabot/pip/fastapi-0.80.0 branch August 29, 2022 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant