首页 文章

Swagger codegen静态文档的小胡子模板 - responseMessages

提问于
浏览
0

我正在尝试使用swagger-codegen生成静态文档 .

文档是基于项目中包含的Mustache模板生成的 .

当我使用Wordnik Swagger api-docs中的示例JSON运行它时,它会完美地生成所有内容(每个api都有自己的.file,如Pet.html,User.html),但是当我尝试使用类似的JSON运行它时,它只生成一个包含我的REST api的所有方法的操作文件 .

Wordnik JSON响应可以在worndik JSON api找到

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

1 回答

  • 0

    您应该能够使用以下内容(至少它适用于我),基于Codegen.scala的当前版本

    {{#errorList}}
        {{code}} {{reason}} {{responseModel}}
        {{/errorList}}
    

相关问题