FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update docs for response-model by junhl · Pull Request #1313 · fastapi/sqlmodel · GitHub

Repository navigation

Update docs for response-model - #1313

Closed
junhl wants to merge 1 commit into
fastapi:mainfrom
junhl:fix-response-model-docs
Closed

junhl wants to merge 1 commit into
fastapi:mainfrom
junhl:fix-response-model-docs

Conversation

junhl commented Feb 27, 2025 •
edited
Loading

Copy link
Copy Markdown

As of Python 3.9, you no longer have to use List from typing for type hinting.

The code example is updated but there is a sentence that was not updated accordingly in docs.

github-actions Bot added the docs Improvements or additions to documentation label Feb 27, 2025
We can also use other type annotations, the same way we can use with Pydantic fields.

First, we import `List` from `typing` and then we declare the `response_model` with `List[Hero]`:
For example, we can pass a list of `Hero`s to `response_model`.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Moved For example, ... to new line like L33 for consistency.

Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Member

Hi @junhl, thanks for contributing to sqlmodel! You're right, and there's already an open PR to address this: #1147

As the existing PR also includes additional cases that can be updated, we can continue the discussion there and I'll close this one. But thanks again! 🙏

svlandeg closed this Feb 28, 2025
junhl deleted the fix-response-model-docs branch March 3, 2025 20:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL