Fastapi: Wrong example code in tutorial doc

Created on 15 Oct 2020  路  2Comments  路  Source: tiangolo/fastapi

First check

  • [x] I added a very descriptive title to this issue.
  • [x] I used the GitHub search to find a similar issue and didn't find it.
  • [x] I searched the FastAPI documentation, with the integrated search.
  • [x] I already searched in Google "How to X in FastAPI" and didn't find any information.
  • [x] I already read and followed all the tutorial in the docs and didn't find an answer.
  • [x] I already checked if it is not related to FastAPI but to Pydantic.
  • [x] I already checked if it is not related to FastAPI but to Swagger UI.
  • [x] I already checked if it is not related to FastAPI but to ReDoc.
  • [x] After submitting this, I commit to one of:

    • Read open issues with questions until I find 2 issues where I can help someone and add a comment to help there.

    • I already hit the "watch" button in this repository to receive notifications and I commit to help at least 2 people that ask questions in the future.

    • Implement a Pull Request for a confirmed bug.

Description

The example code in Using lists instead of sets section of Response Model page seems to be the same as previous section response_model_include and response_model_exclude.
It doesn't demostrate the section's description about convert list to set.

Environment

Irrelevant

question

All 2 comments

The point is very clear actually.

If you forget to use a set and use a list or tuple instead, FastAPI will still convert it to a set and it will work correctly

So in the Using lists instead of sets section, @tiangolo uses Lists instead of sets to demonstrate it does not make any difference. But in the first example, we have a set.

@ycd Oh, I totally missed that! Thanks!

Was this page helpful?
0 / 5 - 0 ratings