Closed wspeirs closed 1 week ago
Hi @wspeirs I'm working on it in #116 , can you please validate it via pkg-pr-new release?
It nows generates correct code for JavaScript/PHP/Python, and allows to customize lang list and the generator
function, as mentioned in: https://vitepress-openapi-git-feature-cod-7dde87-enzo-notarios-projects.vercel.app/customizations/code-samples.html
Any feedback/suggestions are welcome!
For a few (Bruno & cURL at least), it seems to be duplicating the param
Ups, I forgot to remove a duplicated process from other component. It's now centralized and working fine so far:
Can you please re-validate from pkg-pr-new release?
Thanks for this!
It's now released in v0.0.3-alpha.48.
Thanks for reporting, any feedback is welcome!
What would you like?
The current version generates "static" code for each language, based only on the url and method. Unfortunately, the url is simply:
const url = props.baseUrl + props.path
. This has the issue that any path parameters are left as-is in the code.It would be great if the sample code could be updated to include the variables in the "try it" box. This way the code sample would be "complete". I think this would be done in much the same was as the
OACodeBlock
currently computes the URL for curlWhy is this needed?
If you copy-and-paste the code sample as-is, you will end up with an invalid URL if there are path parameters.
Also, it would be nice to mix-and-match such that you can remove the try it portion of the playground, but keep the sample code. This way people can "build" a request in their language of choice based on the variables form.
How could it be implemented?
I think you would need to extract (or just duplicate?) the code used to compute the curl information:
Then pass this as a parameter to
generateCodeSamples
so that it can generate each code sample appropriately.Other information
It would also be awesome to select which languages you want to support, and possibly even some way to provide the template for each language. I realize this is above-and-beyond, but something to think about if you're changing this.