HiDeoo / starlight-openapi

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

Is there a way to make requests from the docs? #35

Closed tristan-valar closed 3 months ago

tristan-valar commented 3 months ago

Is your feature request related to a problem?

I need to build a docs site. I am deciding which framework to use. I love astro so I wanted to use starlight. But I need to be able to make requests on the docs site. I can't seem to find how to do it with this plugin though.

Is that something that can be done?

Describe the solution you'd like

Some way to be able to make requests from the docs page of a specific api endpoint.

Describe alternatives you've considered

I'm also considering docusaurus. The open api plugin looks very good. Do you think we could work towards adding some of the functionality they have? I'm happy to do some work in that direction if you agree with it.

This is a link to an example page -> https://docusaurus-openapi.tryingpan.dev/petstore/add-pet

Additional Context

No response

HiDeoo commented 3 months ago

Thanks for the feedback 🙌

I've commented on such feature in this message:

This kind of feature was part of the initial set of potential features for the plugin, but ended up not being implemented for various reasons:

  • This is not something that I initially needed for my own use case
  • I want to keep the client part of the plugin to be as simple and lightweight as possible
  • I did not have the time to implement this feature

Today, these reasons are still valid and most likely will not change in the near future. However, I will be opened to discuss how such a feature could be implemented, how it would work or look in the plugin, if someone is willing to contribute to the project but that's a fairly large task. Altho, if this ends up being a feature, the default behavior will still be the same as it is today, and the user will have to opt-in to use this feature.

I am definitely open to discuss how such a large feature could be contributed/maintained while still taking into consideration that I want to preserve the current behavior as the default one and any client-side addition should be opt-in. Another option could also to have 2 separate plugins.

tristan-valar commented 3 months ago

Thanks! For your thoughts! I will look into it and see if the best path forward would be to make a PR here or a new plugin and if I have the time to develop it.