Skip to content

Why do I have to specify the type of a path parameter in the path? #2683

Answered by JacobCoffee
simon-lund asked this question in Q&A
Discussion options

You must be logged in to vote

My thoughts are that the function signature is for typing (mypy, pyright, etc) validation and user documentation and the route handler is for routing validation to be consumed by msgspec to validate the incoming data.

But Peter had a better answer 😅:

the path parameter doesn't have to be injected into the handler, so there may be cases where the type isn't available by inspecting the function signature - Peter
https://discord.com/channels/919193495116337154/919193495690936353/1162856495256436890

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@simon-lund
Comment options

@peterschutt
Comment options

@simon-lund
Comment options

Answer selected by Alc-Alc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants