Is there any option to generate a json payload for all the fields defined in pydantic schema? #92
Unanswered
veereshamagi
asked this question in
Q&A
Replies: 1 comment
-
Hey, the only way to do this would be to inherit from JSF and override the __is_field_billable or raise a PR to add an option to the initialization to set a dropout rate of 0-1 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
We have a requirement that we need to populate data for all the fields in the JSON payload, we are using Pydantic to create a JSON schema and using it to generate JSON payload with random values. The issue we are facing is that empty values are being populated for some of the fields of the data type List. Is there any option available to generate values consistently? Also, if some fields are marked as optional in the Pydantic model, those keys are randomly dropped. Is there a way to consistently include or exclude those keys? We referred documentation and couldn't find any such options available. Kindly help us with these queries
output:
{'guid': 'de2ad9c9-670c-45a4-887e-74c18fdd5717', 'msg': 'illum', 'my_enum': 'enum1', 'detail': []}
In this instance
detail
is returning an empty list, if I re-run the codedetail
will contain some random value.Beta Was this translation helpful? Give feedback.
All reactions