forked from swaggo/gin-swagger
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: preserve compatibility with swagger (swaggo#194)
- Loading branch information
Showing
8 changed files
with
314 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "This is a sample server Petstore server.", | ||
"title": "Swagger Example API", | ||
"termsOfService": "http://swagger.io/terms/", | ||
"contact": { | ||
"name": "API Support", | ||
"url": "http://www.swagger.io/support", | ||
"email": "[email protected]" | ||
}, | ||
"license": { | ||
"name": "Apache 2.0", | ||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html" | ||
}, | ||
"version": "1.0" | ||
}, | ||
"host": "petstore.swagger.io:8080", | ||
"basePath": "/v2", | ||
"paths": { | ||
"/testapi/get-string-by-int/{some_id}": { | ||
"get": { | ||
"description": "get string by ID", | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"summary": "Add a new pet to the store", | ||
"parameters": [ | ||
{ | ||
"type": "integer", | ||
"description": "Some ID", | ||
"name": "some_id", | ||
"in": "path", | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "ok", | ||
"schema": { | ||
"type": "string" | ||
} | ||
}, | ||
"400": { | ||
"description": "We need ID!!", | ||
"schema": { | ||
"$ref": "#/definitions/web.APIError" | ||
} | ||
}, | ||
"404": { | ||
"description": "Can not find ID", | ||
"schema": { | ||
"$ref": "#/definitions/web.APIError" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/testapi/get-struct-array-by-string/{some_id}": { | ||
"get": { | ||
"description": "get struct array by ID", | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"parameters": [ | ||
{ | ||
"type": "string", | ||
"description": "Some ID", | ||
"name": "some_id", | ||
"in": "path", | ||
"required": true | ||
}, | ||
{ | ||
"type": "integer", | ||
"description": "Offset", | ||
"name": "offset", | ||
"in": "query", | ||
"required": true | ||
}, | ||
{ | ||
"type": "integer", | ||
"description": "Offset", | ||
"name": "limit", | ||
"in": "query", | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "ok", | ||
"schema": { | ||
"type": "string" | ||
} | ||
}, | ||
"400": { | ||
"description": "We need ID!!", | ||
"schema": { | ||
"$ref": "#/definitions/web.APIError" | ||
} | ||
}, | ||
"404": { | ||
"description": "Can not find ID", | ||
"schema": { | ||
"$ref": "#/definitions/web.APIError" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"web.APIError": { | ||
"type": "object", | ||
"properties": { | ||
"errorCode": { | ||
"type": "integer" | ||
}, | ||
"errorMessage": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
basePath: /v2 | ||
definitions: | ||
web.APIError: | ||
properties: | ||
errorCode: | ||
type: integer | ||
errorMessage: | ||
type: string | ||
type: object | ||
host: petstore.swagger.io:8080 | ||
info: | ||
contact: | ||
email: [email protected] | ||
name: API Support | ||
url: http://www.swagger.io/support | ||
description: This is a sample server Petstore server. | ||
license: | ||
name: Apache 2.0 | ||
url: http://www.apache.org/licenses/LICENSE-2.0.html | ||
termsOfService: http://swagger.io/terms/ | ||
title: Swagger Example API | ||
version: "1.0" | ||
paths: | ||
/testapi/get-string-by-int/{some_id}: | ||
get: | ||
consumes: | ||
- application/json | ||
description: get string by ID | ||
parameters: | ||
- description: Some ID | ||
in: path | ||
name: some_id | ||
required: true | ||
type: integer | ||
produces: | ||
- application/json | ||
responses: | ||
"200": | ||
description: ok | ||
schema: | ||
type: string | ||
"400": | ||
description: We need ID!! | ||
schema: | ||
$ref: '#/definitions/web.APIError' | ||
"404": | ||
description: Can not find ID | ||
schema: | ||
$ref: '#/definitions/web.APIError' | ||
summary: Add a new pet to the store | ||
/testapi/get-struct-array-by-string/{some_id}: | ||
get: | ||
consumes: | ||
- application/json | ||
description: get struct array by ID | ||
parameters: | ||
- description: Some ID | ||
in: path | ||
name: some_id | ||
required: true | ||
type: string | ||
- description: Offset | ||
in: query | ||
name: offset | ||
required: true | ||
type: integer | ||
- description: Offset | ||
in: query | ||
name: limit | ||
required: true | ||
type: integer | ||
produces: | ||
- application/json | ||
responses: | ||
"200": | ||
description: ok | ||
schema: | ||
type: string | ||
"400": | ||
description: We need ID!! | ||
schema: | ||
$ref: '#/definitions/web.APIError' | ||
"404": | ||
description: Can not find ID | ||
schema: | ||
$ref: '#/definitions/web.APIError' | ||
swagger: "2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT | ||
// This file was generated by swaggo/swag | ||
package docs | ||
|
||
import "github.com/swaggo/swag" | ||
|
||
const docTemplate_swagger = `{ | ||
"schemes": {{ marshal .Schemes }}, | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "{{escape .Description}}", | ||
"title": "{{.Title}}", | ||
"termsOfService": "http://swagger.io/terms/", | ||
"contact": { | ||
"name": "API Support", | ||
"url": "http://www.swagger.io/support", | ||
"email": "[email protected]" | ||
}, | ||
"license": { | ||
"name": "Apache 2.0", | ||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html" | ||
}, | ||
"version": "{{.Version}}" | ||
}, | ||
"host": "{{.Host}}", | ||
"basePath": "{{.BasePath}}", | ||
"paths": {} | ||
}` | ||
|
||
// SwaggerInfo_swagger holds exported Swagger Info so clients can modify it | ||
var SwaggerInfo_swagger = &swag.Spec{ | ||
Version: "1.0", | ||
Host: "petstore.swagger.io", | ||
BasePath: "/v2", | ||
Schemes: []string{}, | ||
Title: "Swagger Example API", | ||
Description: "This is a sample server Petstore server.", | ||
InfoInstanceName: "swagger", | ||
SwaggerTemplate: docTemplate_swagger, | ||
} | ||
|
||
func init() { | ||
swag.Register(SwaggerInfo_swagger.InstanceName(), SwaggerInfo_swagger) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "This is a sample server Petstore server.", | ||
"title": "Swagger Example API", | ||
"termsOfService": "http://swagger.io/terms/", | ||
"contact": { | ||
"name": "API Support", | ||
"url": "http://www.swagger.io/support", | ||
"email": "[email protected]" | ||
}, | ||
"license": { | ||
"name": "Apache 2.0", | ||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html" | ||
}, | ||
"version": "1.0" | ||
}, | ||
"host": "petstore.swagger.io", | ||
"basePath": "/v2", | ||
"paths": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
basePath: /v2 | ||
host: petstore.swagger.io | ||
info: | ||
contact: | ||
email: [email protected] | ||
name: API Support | ||
url: http://www.swagger.io/support | ||
description: This is a sample server Petstore server. | ||
license: | ||
name: Apache 2.0 | ||
url: http://www.apache.org/licenses/LICENSE-2.0.html | ||
termsOfService: http://swagger.io/terms/ | ||
title: Swagger Example API | ||
version: "1.0" | ||
paths: {} | ||
swagger: "2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.