Open aleung opened 3 years ago
This makes sense. We can implement such an option. PR would be appreciated.
I dug into the code today and found that the sample is generated by another module openapi-sampler.
Looks like I can do in this way:
autoGenerateSamples
to control whether generate value for fields which have no example defined in schema. Default to true
to keep previous behavior.OpenAPISampler
. The option name could be shorten to autoGenerate
.@RomanHotsiy I hope to hear your opinion before I raise PR to these two projects.
When the scheme doesn't come with
example
, Redoc will automatically generate a sample by properties default value. This default sample isn't useful in most case and it's confusing to reader.I'd like to write examples which represent real use cases in the OpenAPI definition and leave unimportant responses/responses without sample. But I didn't find a way to disable the sample. It is possible to add global option in the tool, or add OpenAPI extension to disable default sample?