diff --git a/example/multiple/README.md b/example/multiple/README.md index c1c9be4..26b0b56 100644 --- a/example/multiple/README.md +++ b/example/multiple/README.md @@ -1,11 +1,23 @@ -Generate documentation for v2 -`` +# Multiple API feature +Since swag 1.7.9 we are allowing registration of multiple endpoints into the same server. + +Generate documentation for v1 endpoints +```shell swag i -g main.go -dir api/v1 --instanceName v1 ``` -Generate documentation for v2 -``` -swag i -g main.go -dir api/v1 --instanceName v1 + +Generate documentation for v2 endpoints +```shell +swag i -g main.go -dir api/v2 --instanceName v2 ``` +Run example +```shell + go run main.go +``` + +Now you can access the v1 swagger here [http://localhost:8080/swagger/v1/index.html](http://localhost:8080/swagger/v1/index.html) , +and v2 swagger here [http://localhost:8080/swagger/v2/index.html](http://localhost:8080/swagger/v2/index.html) + diff --git a/example/multiple/api/v1/main.go b/example/multiple/api/v1/main.go index 33f1714..4b7b47e 100644 --- a/example/multiple/api/v1/main.go +++ b/example/multiple/api/v1/main.go @@ -16,7 +16,6 @@ import ( // @license.name Apache 2.0 // @license.url http://www.apache.org/licenses/LICENSE-2.0.html -// @Host example.swagger.io // @BasePath /v1 func Register(router *gin.Engine) { diff --git a/example/multiple/api/v2/main.go b/example/multiple/api/v2/main.go index 836b6ad..560935b 100644 --- a/example/multiple/api/v2/main.go +++ b/example/multiple/api/v2/main.go @@ -16,7 +16,6 @@ import ( // @license.name Apache 2.0 // @license.url http://www.apache.org/licenses/LICENSE-2.0.html -// @host example.swagger.io // @BasePath /v2 func Register(router *gin.Engine) { diff --git a/example/multiple/docs/v1_docs.go b/example/multiple/docs/v1_docs.go index 8a811c5..c18adba 100644 --- a/example/multiple/docs/v1_docs.go +++ b/example/multiple/docs/v1_docs.go @@ -73,7 +73,7 @@ const docTemplatev1 = `{ // SwaggerInfov1 holds exported Swagger Info so clients can modify it var SwaggerInfov1 = &swag.Spec{ Version: "1.0", - Host: "example.swagger.io", + Host: "", BasePath: "/v1", Schemes: []string{}, Title: "Swagger Example API", diff --git a/example/multiple/docs/v1_swagger.json b/example/multiple/docs/v1_swagger.json index 2709b06..c68dbbc 100644 --- a/example/multiple/docs/v1_swagger.json +++ b/example/multiple/docs/v1_swagger.json @@ -15,7 +15,6 @@ }, "version": "1.0" }, - "host": "example.swagger.io", "basePath": "/v1", "paths": { "/books": { diff --git a/example/multiple/docs/v1_swagger.yaml b/example/multiple/docs/v1_swagger.yaml index 22baed4..f185009 100644 --- a/example/multiple/docs/v1_swagger.yaml +++ b/example/multiple/docs/v1_swagger.yaml @@ -11,7 +11,6 @@ definitions: year: type: integer type: object -host: example.swagger.io info: contact: email: support@swagger.io diff --git a/example/multiple/docs/v2_docs.go b/example/multiple/docs/v2_docs.go index 5dc2255..2c297cc 100644 --- a/example/multiple/docs/v2_docs.go +++ b/example/multiple/docs/v2_docs.go @@ -73,7 +73,7 @@ const docTemplatev2 = `{ // SwaggerInfov2 holds exported Swagger Info so clients can modify it var SwaggerInfov2 = &swag.Spec{ Version: "2.0", - Host: "example.swagger.io", + Host: "", BasePath: "/v2", Schemes: []string{}, Title: "Swagger Example API", diff --git a/example/multiple/docs/v2_swagger.json b/example/multiple/docs/v2_swagger.json index 59a26ae..495fe0d 100644 --- a/example/multiple/docs/v2_swagger.json +++ b/example/multiple/docs/v2_swagger.json @@ -15,7 +15,6 @@ }, "version": "2.0" }, - "host": "example.swagger.io", "basePath": "/v2", "paths": { "/books": { diff --git a/example/multiple/docs/v2_swagger.yaml b/example/multiple/docs/v2_swagger.yaml index 911d094..2a329e4 100644 --- a/example/multiple/docs/v2_swagger.yaml +++ b/example/multiple/docs/v2_swagger.yaml @@ -11,7 +11,6 @@ definitions: year: type: integer type: object -host: example.swagger.io info: contact: email: support@swagger.io