Include client SDK usage sample in SwaggerUI

天大地大妈咪最大 提交于 2019-12-12 22:21:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!