I am using datamodel-code-generator
to generate models to go along with Uplink
to create REST clients. My REST API documentation is in OpenAPI yaml format and includes examples for field values. These example values are useful for the API client users to understand the field value and formats.
VSCode and other IDE with intellisense pick up the doc string to display help on a function and its arguments.
The values of Example field in the OpenAPI documents are translated as Field(example='your example here')
which benefits if the model is dumped as JSON schema but fails in the goal of guiding the user during development.
The ideal solution would incorporate the example
field as part of docstring and thereby show up in intellisense.
If adopted, this feature adds an argument example_as_docstring
to datamodel_code_generator.generate()
and an option --use-field-description-example
to CLI
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too