go implementation of petstore exampleの仕様ファイルを作成しようとしています。私はdoc.go
を持っていたディレクトリにgo generate
を試しましたが、何もしませんでした。さらに読書では、私はdoc.go
でGoswaggerが適切なjson仕様ファイルを作成しない
//go:generate swagger generate spec -o swagger.json
がなければならないことに気づきました。私はそれが仕様ファイルを作成することを追加しましたが、それは仕様全体を含んでいません。これは、specファイルに記載された一切のルート/パラメータ/モデルはありませんgo generate
{
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"schemes": [
"http",
"https"
],
"swagger": "2.0",
"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\ngo:generate swagger generate spec -o swagger.json",
"contact": {
"name": "John Doe",
"url": "http://john.doe.com",
"email": "[email protected]"
},
"license": {
"name": "MIT",
"url": "http://opensource.org/licenses/MIT"
},
"version": "0.0.1"
},
"host": "localhost",
"basePath": "/v2",
"paths": {}
}
に作成され.jsonファイルです。これはこれがどうなるのでしょうか?これはgoswagger repoの正式な例なので、コードが間違っているとは思わない。私はそれを動作させるために何を変えるべきですか?