Imports #
"github.com/swaggo/swag"
"github.com/swaggo/swag"
SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = *ast.UnaryExpr
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {
"name": "None"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/solvers": {
"get": {
"security": [
{
"OAuth2AccessCode ": [
"read"
]
}
],
"description": "Lists days which the solver can solve",
"tags": [
"solverList"
],
"summary": "Solve List",
"parameters": [
{
"type": "string",
"description": "Bearer format, prefix with Bearer",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "Result",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/RegistryItem"
}
}
},
"401": {
"description": "Unathorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"429": {
"description": "Request was Rate limited",
"schema": {
"$ref": "#/definitions/Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/solvers/{day}/{part}": {
"post": {
"security": [
{
"OAuth2AccessCode ": [
"read"
]
}
],
"description": "Provides solution for the day and part based on input",
"tags": [
"solver"
],
"summary": "Solver",
"parameters": [
{
"type": "string",
"example": "d1",
"description": "Day, format d[0-9]*",
"name": "day",
"in": "path",
"required": true
},
{
"type": "integer",
"example": 1,
"description": "Problem part",
"name": "part",
"in": "path",
"required": true
},
{
"description": "Solve Base64 encoded input",
"name": "input",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Request"
}
},
{
"type": "string",
"description": "Bearer format, prefix with Bearer",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "Result",
"schema": {
"$ref": "#/definitions/Response"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/Error"
}
},
"401": {
"description": "Unathorized",
"schema": {
"$ref": "#/definitions/Error"
}
},
"404": {
"description": "Solver for the day not found",
"schema": {
"$ref": "#/definitions/Error"
}
},
"429": {
"description": "Request was Rate limited",
"schema": {
"$ref": "#/definitions/Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/Error"
}
},
"504": {
"description": "Request took too long to compute",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
}
},
"definitions": {
"Error": {
"type": "object",
"properties": {
"errorcode": {
"type": "integer"
},
"errormessage": {
"type": "string"
}
}
},
"RegistryItem": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"next": {
"type": "boolean"
}
}
},
"Request": {
"type": "object",
"properties": {
"input": {
"type": "string",
"format": "base64",
"example": "MyAgIDQKNCAgIDMKMiAgIDUKMSAgIDMKMyAgIDkKMyAgIDMK"
}
}
},
"Response": {
"type": "object",
"properties": {
"output": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"OAuth2AccessCode": {
"description": "GitHub OAuth",
"type": "oauth2",
"flow": "accessCode",
"authorizationUrl": "https://github.com/login/oauth/authorize",
"tokenUrl": "http://localhost:8080/oauth/github/token",
"scopes": {
"read": "Grants read access"
}
}
},
"externalDocs": {
"description": "OpenAPI",
"url": "https://swagger.io/resources/open-api/"
}
}`
func init()