-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Is your feature request related to a problem?
This feature request might also be related to issue #43 in the repository.
starlight-openapi like Swagger UI or Redocly automatically generate and display example JSON based on the schema definition when no explicit example is provided. I would like this tool to support a similar feature, so users can easily understand request and response structures even without manually defined examples.
Describe the solution you'd like
I would like the tool to automatically generate a JSON example from the schema when no explicit example is provided. If an example is explicitly defined, that should take precedence. Additionally, it would be helpful to have a configuration flag to enable or disable this auto-generation behavior.
Describe alternatives you've considered
I have considered manually writing examples for each schema. However, this can be time-consuming and error-prone, especially when dealing with large APIs. In the case of simple APIs, detailed examples may not always be necessary, but having at least a basic example in JSON format greatly improves usability for consumers. Auto-generating these examples based on the schema can help reduce manual work while still offering helpful guidance to developers.
Additional Context
Swagger
Redocly
The values in these examples will vary depending on the schema definition, and the default values differ between Swagger and Redocly. However, as long as the values fall within the valid range defined by the schema, I believe that’s acceptable.