问题
I've been searching for a tool which could help me parse my JSON swagger file (or even YAML file) and generate code sample resources in my UI based on this example of API doc.
I've already tried :
- codegen (So I do have the code samples in a github repo, but I don't know how to get it on my UI dynamically)
- slate, but i'm trying to go on with swagger
- Widdershins
Does someone knows about a third-party-tool able to produce such a feature or did I miss something from codegen or swagger-UI ?
Or should I just write all my code samples roughly in my page ?
回答1:
Finally got it. We can't strickly speaking "include" dynamically SDK usage samples into SwaggerUI. Nevertheless, you can generate the ui with multiple languages SDK ! It won't look the same but I'll override css anyway.
Wasn't clear for me until I found this Github issue ! All you have to do is generate html2 client with the editor or codegen...
Everything is implemented in the index.html (which is kinda dirty but still, it works fine !).
来源:https://stackoverflow.com/questions/50604777/include-client-sdk-usage-sample-in-swaggerui