🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] > [参考](https://goswagger.io/use/spec/meta.html) ## meta 常见元数据 ``` // Package classification Petstore API. // // the purpose of this application is to provide an application // that is using plain go code to define an API // // This should demonstrate all the possible comment annotations // that are available to turn go code into a fully compliant swagger 2.0 spec // // Terms Of Service: // // there are no TOS at this moment, use at your own risk we take no responsibility // // Schemes: http, https // Host: localhost // BasePath: /v2 // Version: 0.0.1 // License: MIT http://opensource.org/licenses/MIT // Contact: John Doe<john.doe@example.com> http://john.doe.com // // Consumes: // - application/json // - application/xml // // Produces: // - application/json // - application/xml // // Security: // - api_key: // // SecurityDefinitions: // api_key: // type: apiKey // name: KEY // in: header // oauth2: // type: oauth2 // authorizationUrl: /oauth2/auth // tokenUrl: /oauth2/token // in: header // scopes: // bar: foo // flow: accessCode // // Extensions: // x-meta-value: value // x-meta-array: // - value1 // - value2 // x-meta-array-obj: // - name: obj // value: field // // swagger:meta package classification ``` **title** 从第一行开始到**第一个空换行**为止 **description** 从第一个空行开始,知道下一次**空白换行** 生成的结果 ``` --- swagger: '2.0' consumes: - application/json - application/xml produces: - application/json - application/xml schemes: - http - https info: description: "the purpose of this application is to provide an application\nthat is using plain go code to define an API\n\nThis should demonstrate all the possible comment annotations\nthat are available to turn go code into a fully compliant swagger 2.0 spec" title: 'Petstore API.' termsOfService: 'there are no TOS at this moment, use at your own risk we take no responsibility' contact: {name: 'John Doe', url: 'http://john.doe.com', email: john.doe@example.com} license: {name: MIT, url: 'http://opensource.org/licenses/MIT'} version: 0.0.1 host: localhost basePath: /v2 x-meta-value: value x-meta-array: - value1 - value2 x-meta-array-obj: - name: obj value: field ```