-
-
Notifications
You must be signed in to change notification settings - Fork 824
✨ Support json (dict) as parameter type
#985
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
base: master
Are you sure you want to change the base?
✨ Support json (dict) as parameter type
#985
Conversation
Signed-off-by: Muhammed Hussein Karimi <info@karimi.dev>
Signed-off-by: Muhammed Hussein Karimi <info@karimi.dev>
Signed-off-by: Muhammed Hussein Karimi <info@karimi.dev>
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: Muhammed Hussein Karimi <info@karimi.dev>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: Muhammed Hussein Karimi <info@karimi.dev>
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: Muhammed Hussein Karimi <info@karimi.dev>
This comment was marked as outdated.
This comment was marked as outdated.
|
@svlandeg it's ok to ignore coverage on newly created class? |
|
No, in general we really need all the code in the main modules to be fully tested 🙏 |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
I have added tests for newly created class coverage is 100% again :) |
|
If changes are Ok so far I can work on Pydantic support, Or move Pydantic support in another PR? |
|
HI @mhkarimi1383! We haven't yet been able to review this PR in detail. When we do, we'll update here. No need to ping individual maintainers in the meantime 😉 In terms of adding more functionality, it's always best to open separate PRs for distinct functionality. It makes the review process much easier if one PR deals with one "atomic" change. Do have a look at existing PRs - if I recall correctly there's already a few PRs open with proposals for Pydantic support. |
|
Thanks again for this PR @mhkarimi1383! I'm going to start reviewing it in detail and will push some changes directly to your branch as I'm working on this. I'll put this PR in draft while I do so. |
|
Yeah, but I think in the repr we can call it JSON, So CLi users that they want to use our application should know that the input has to be JSON |
|
8 months after, would be nice to have this merged and released! I would use it! |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
json (dict) as parameter type
📝 Docs previewLast commit 739ebd0 at: https://3a1c369d.typertiangolo.pages.dev Modified Pages |
|
I have updated the description to not include bytes support |
tests/test_tutorial/test_parameter_types/test_dict/test_tutorial001.py
Outdated
Show resolved
Hide resolved
tests/test_tutorial/test_parameter_types/test_dict/test_tutorial001_an.py
Outdated
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
|
This pull request has a merge conflict that needs to be resolved. |
|
@svlandeg if this will not get merged I will close it... |
Hi
Sometimes there is a need of decoding entire value as an json object (useful when some params are too dynamic or getting that option in a prompt). I wanted to also add pydantic support (for both single option as json and all of the options in a single model) there and also use orjson (by checking if that's installed as an optional dependency), If that's Ok.