-
Notifications
You must be signed in to change notification settings - Fork 88
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
from_pydantic with id support #243
Comments
If you think this issue describes a valid point, I'll be glad to submit a pull request. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What do I want to achive
I want kor to generate a Typescript description like the following:
What did I try
Define the following pydantic schema:
Bookings(bookings=...).json()
generates the desired output{"bookings": [{"project": "...", "date": "...", ' '"amount": {"value": "...", "unit": "..."}}]}
, so I think the schema definition is correct.The output of the current
from_pydantic
implementation is the following:Call:
Output:
To overcome this, I tried:
Call:
Output:
The output is better, but I need the string "bookings" (with an "s"), and couldn't find a way to accomplish this.
How I think it may be solved
Add parameter
id
tofrom_pydantic
method.Currently the
from_pydantic
method allows for the definition of adescription
,examples
and themany
flag.In my opinion the id parameter is missing. Since it is possible to define it in a kor-Object, it should also be possible to provide it to this method. This way it will be possible to set the name of the root object, in my case to "bookings".
The text was updated successfully, but these errors were encountered: