Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use name: Annotated[type, Query(**options)] replace name: type = Query(**options) #53

Closed
2 tasks done
abersheeran opened this issue Sep 24, 2021 · 0 comments
Closed
2 tasks done

Comments

@abersheeran
Copy link
Owner

abersheeran commented Sep 24, 2021

Checklist

  • There are no similar issues or pull requests for this yet.
  • I discussed this idea on the community chat and feedback is positive.

Is your feature related to a problem? Please describe.

使用默认值为类型增加描述是妥协的做法。

Describe the solution you would like.

async def function(name: name: Annotated[type, Query(**options)]) -> Annotated[Any, PlainTextResponse[200]]:
     return name

Describe alternatives you considered

Query[type, options]

使用这种方式,编辑器支持不会很好。因为不能传关键词,所以 options 要么是一个充满 None 的序列,要么是一个字典。写起来都不会太舒服。

@abersheeran abersheeran changed the title Use name: Query(type, **options) replace name: type = Query(**options) Use name: Annotated[type, Query(**options)] replace name: type = Query(**options) Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant