HiDeoo / starlight-openapi

Starlight plugin to generate documentation from OpenAPI/Swagger specifications
https://starlight-openapi.vercel.app
MIT License
106 stars 12 forks source link

Generate example request body as well as schema #43

Open clarkm5 opened 1 month ago

clarkm5 commented 1 month ago

Is your feature request related to a problem?

The first thing I tend to look for when using a new API is an example of a request. I will then look at the schema for more information as necessary.

Unless I've missed it, we can't currently generate an example json request body from the OpenAPI doc.

Describe the solution you'd like

Tabs to select an example payload or schema view of request and response

Describe alternatives you've considered

I could embed the json manually in a description field but this is obviously less ideal than schema based generation

Additional Context

No response

HiDeoo commented 1 month ago

Thanks for your feedback :raised_hands:

By quickly taking a look at the Swagger Editor, the current view is close to their Schema view:

image

I'm assuming you're referring to the Example Value they also provide?

image

If yes, I could imagine that being a possible enhancement, may need to think about how it could work and how to best integrate it with the current design but it's definitely something we could consider.