Thanks to visit codestin.com
Credit goes to github.com

Skip to content

📝 Fix type of username in /docs_src/security to allow None#12494

Closed
vittxr wants to merge 3 commits into
fastapi:masterfrom
vittxr:master
Closed

📝 Fix type of username in /docs_src/security to allow None#12494
vittxr wants to merge 3 commits into
fastapi:masterfrom
vittxr:master

Conversation

@vittxr

@vittxr vittxr commented Oct 19, 2024

Copy link
Copy Markdown

In the docs > security section, there is a type issue

username: str = payload.get("sub")

Since .get() may return None, the username variable should accommodate this possibility by using:

username: str | None = payload.get("sub")

image

I've fixed /docs_src/security snippets

@github-actions github-actions Bot added the docs Documentation about how to use FastAPI label Oct 19, 2024
@github-actions

Copy link
Copy Markdown
Contributor

📝 Docs preview for commit b1f77cc at: https://84971188.fastapitiangolo.pages.dev

@github-actions

Copy link
Copy Markdown
Contributor

📝 Docs preview for commit 460f956 at: https://dde0f9f1.fastapitiangolo.pages.dev

@svlandeg svlandeg self-assigned this Feb 5, 2025
@svlandeg svlandeg changed the title Fix type: Allow None in username for the docs snippets located in /docs_src/security 📝 Fix type of username in /docs_src/security to allow None Feb 5, 2025

@svlandeg svlandeg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for catching this! Yes, makes sense.

@svlandeg

svlandeg commented Feb 5, 2025

Copy link
Copy Markdown
Member

As a quick note, it looks like the test suite is failing due to something outside of this PR. We're looking into it!

@svlandeg svlandeg removed their assignment Feb 5, 2025
@github-actions

github-actions Bot commented Feb 7, 2025

Copy link
Copy Markdown
Contributor

📝 Docs preview for commit 397ed72 at: https://de45a47a.fastapitiangolo.pages.dev

@vittxr

vittxr commented Feb 9, 2025

Copy link
Copy Markdown
Author

All tests passed. I think it's ok now

@alejsdev

Copy link
Copy Markdown
Member

Hi @vittxr, thanks for your interest in contributing. This was covered in #13378, so I'll close this one, but thanks for your effort. 🙇‍♀️

@alejsdev alejsdev closed this Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation about how to use FastAPI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants