我正在尝试使用swagger-codegen生成静态文档。
文档是根据项目中包含的Mustache模板生成的。
当我使用来自wordnik Swagger api-docs的示例JSON运行它时,它会完美地生成所有内容(每个api都有自己的.file,如Pet.html,User.html),但当我尝试使用类似的JSON运行它时我的,它只生成一个包含我的REST api的所有方法的操作文件。
找到Wordnik JSON响应Mine API响应如下所示:
{"apiVersion":"1.0","swaggerVersion":"1.2","apis":[{"path":"/default/countries","description":"Operations about countries"},{"path":"/default/gateways","description":"Operations on payment gateways"},{"path":"/default/location","description":"Operations about locations"},{"path":"/default/mccs","description":"Operations about MCCs"},{"path":"/default/merchants","description":"Operations about merchants"},{"path":"/default/partners","description":"Operations about partners"},{"path":"/default/payments","description":"Operations about payments"},{"path":"/default/resources","description":"Operations about resources"},{"path":"/default/terminals","description":"Operations about terminals"},{"path":"/default/terminalsubsetdefaultresourceset","description":"Operations about terminalSubsetDefaultResourceSet"},{"path":"/default/users","description":"Operations about users"}],"info":{"title":"my API","description":"","termsOfServiceUrl":"","contact":"","license":"","licenseUrl":""}}
此外,我想在JSON中的每个操作中提取ReponseMessage代码。我试着添加
{{#ResponseMessages}}
<h3 class="responseMessages">{{message}}</h3>
{{/ResponseMessages}}
到operations.model,但它不起作用(不是myApi,也不是Wordnik)(我有类似这样的JSON:JSON with responseCodes
答案 0 :(得分:0)
根据当前版本的Codegen.scala
,您应该能够使用以下内容(至少它适用于我) {{#errorList}}
{{code}} {{reason}} {{responseModel}}
{{/errorList}}