Adding swagger annotations to core
This commit is contained in:
304
docs/docs.go
Normal file
304
docs/docs.go
Normal file
@@ -0,0 +1,304 @@
|
||||
// Package docs GENERATED BY SWAG; DO NOT EDIT
|
||||
// This file was generated by swaggo/swag
|
||||
package docs
|
||||
|
||||
import "github.com/swaggo/swag"
|
||||
|
||||
const docTemplate = `{
|
||||
"schemes": {{ marshal .Schemes }},
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "{{escape .Description}}",
|
||||
"title": "{{.Title}}",
|
||||
"contact": {},
|
||||
"version": "{{.Version}}"
|
||||
},
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/adm/doot": {
|
||||
"get": {
|
||||
"description": "admin ping and login check",
|
||||
"summary": "ping example",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "JWT Cookie set by /admin",
|
||||
"name": "jwt",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {}
|
||||
}
|
||||
},
|
||||
"/admin": {
|
||||
"post": {
|
||||
"description": "Secured login for any user accounts",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"summary": "User login",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "user email",
|
||||
"name": "userkey",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "user password",
|
||||
"name": "password",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "the 2fa token",
|
||||
"name": "twofactorcode",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"headers": {
|
||||
"jwt": {
|
||||
"type": "string",
|
||||
"description": "The authentication token for this session, valid for 24h"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "userkey, 2fa token or password missing"
|
||||
},
|
||||
"401": {
|
||||
"description": "not found or credentials invalid"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/doot": {
|
||||
"get": {
|
||||
"description": "unauthenticated ping",
|
||||
"summary": "ping example",
|
||||
"responses": {}
|
||||
}
|
||||
},
|
||||
"/forgot": {
|
||||
"post": {
|
||||
"description": "Request a password reset for the provided userkey",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"summary": "Forgot password",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "user email to reset",
|
||||
"name": "userkey",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
},
|
||||
"400": {
|
||||
"description": "userkey not provided"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/login": {
|
||||
"post": {
|
||||
"description": "Secured login for any user accounts",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"summary": "User login",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "user email",
|
||||
"name": "userkey",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "user password",
|
||||
"name": "password",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "the 2fa token for the user, if activated",
|
||||
"name": "twofactorcode",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"headers": {
|
||||
"jwt": {
|
||||
"type": "string",
|
||||
"description": "The authentication token for this session, valid for 24h"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "userkey or password missing"
|
||||
},
|
||||
"401": {
|
||||
"description": "not found or credentials invalid"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/reset": {
|
||||
"post": {
|
||||
"description": "Use a JWT token to validate and reset a password",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"summary": "Password reset",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "the token emailed to the user",
|
||||
"name": "token",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "the new password value",
|
||||
"name": "password",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
},
|
||||
"400": {
|
||||
"description": "token and password not provided"
|
||||
},
|
||||
"401": {
|
||||
"description": "bad token or user not found"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/sec/doot": {
|
||||
"get": {
|
||||
"description": "user ping and login check",
|
||||
"summary": "ping example",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "JWT Cookie set by /login",
|
||||
"name": "jwt",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {}
|
||||
}
|
||||
},
|
||||
"/signup": {
|
||||
"post": {
|
||||
"description": "Sign a user up for a new account",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"summary": "User signup",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "user email",
|
||||
"name": "userkey",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "user password",
|
||||
"name": "password",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
},
|
||||
"400": {
|
||||
"description": "userkey missing, or password missing or not strong enough"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = &swag.Spec{
|
||||
Version: "1",
|
||||
Host: "",
|
||||
BasePath: "/v1",
|
||||
Schemes: []string{},
|
||||
Title: "Go-Gin Prepack",
|
||||
Description: "",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
}
|
||||
|
||||
func init() {
|
||||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||||
}
|
||||
279
docs/swagger.json
Normal file
279
docs/swagger.json
Normal file
@@ -0,0 +1,279 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Go-Gin Prepack",
|
||||
"contact": {},
|
||||
"version": "1"
|
||||
},
|
||||
"basePath": "/v1",
|
||||
"paths": {
|
||||
"/adm/doot": {
|
||||
"get": {
|
||||
"description": "admin ping and login check",
|
||||
"summary": "ping example",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "JWT Cookie set by /admin",
|
||||
"name": "jwt",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {}
|
||||
}
|
||||
},
|
||||
"/admin": {
|
||||
"post": {
|
||||
"description": "Secured login for any user accounts",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"summary": "User login",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "user email",
|
||||
"name": "userkey",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "user password",
|
||||
"name": "password",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "the 2fa token",
|
||||
"name": "twofactorcode",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"headers": {
|
||||
"jwt": {
|
||||
"type": "string",
|
||||
"description": "The authentication token for this session, valid for 24h"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "userkey, 2fa token or password missing"
|
||||
},
|
||||
"401": {
|
||||
"description": "not found or credentials invalid"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/doot": {
|
||||
"get": {
|
||||
"description": "unauthenticated ping",
|
||||
"summary": "ping example",
|
||||
"responses": {}
|
||||
}
|
||||
},
|
||||
"/forgot": {
|
||||
"post": {
|
||||
"description": "Request a password reset for the provided userkey",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"summary": "Forgot password",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "user email to reset",
|
||||
"name": "userkey",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
},
|
||||
"400": {
|
||||
"description": "userkey not provided"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/login": {
|
||||
"post": {
|
||||
"description": "Secured login for any user accounts",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"summary": "User login",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "user email",
|
||||
"name": "userkey",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "user password",
|
||||
"name": "password",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "the 2fa token for the user, if activated",
|
||||
"name": "twofactorcode",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"headers": {
|
||||
"jwt": {
|
||||
"type": "string",
|
||||
"description": "The authentication token for this session, valid for 24h"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "userkey or password missing"
|
||||
},
|
||||
"401": {
|
||||
"description": "not found or credentials invalid"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/reset": {
|
||||
"post": {
|
||||
"description": "Use a JWT token to validate and reset a password",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"summary": "Password reset",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "the token emailed to the user",
|
||||
"name": "token",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "the new password value",
|
||||
"name": "password",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
},
|
||||
"400": {
|
||||
"description": "token and password not provided"
|
||||
},
|
||||
"401": {
|
||||
"description": "bad token or user not found"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/sec/doot": {
|
||||
"get": {
|
||||
"description": "user ping and login check",
|
||||
"summary": "ping example",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "JWT Cookie set by /login",
|
||||
"name": "jwt",
|
||||
"in": "header",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {}
|
||||
}
|
||||
},
|
||||
"/signup": {
|
||||
"post": {
|
||||
"description": "Sign a user up for a new account",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"summary": "User signup",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "user email",
|
||||
"name": "userkey",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "user password",
|
||||
"name": "password",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
},
|
||||
"400": {
|
||||
"description": "userkey missing, or password missing or not strong enough"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
183
docs/swagger.yaml
Normal file
183
docs/swagger.yaml
Normal file
@@ -0,0 +1,183 @@
|
||||
basePath: /v1
|
||||
info:
|
||||
contact: {}
|
||||
title: Go-Gin Prepack
|
||||
version: "1"
|
||||
paths:
|
||||
/adm/doot:
|
||||
get:
|
||||
description: admin ping and login check
|
||||
parameters:
|
||||
- description: JWT Cookie set by /admin
|
||||
in: header
|
||||
name: jwt
|
||||
required: true
|
||||
type: string
|
||||
responses: {}
|
||||
summary: ping example
|
||||
/admin:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Secured login for any user accounts
|
||||
parameters:
|
||||
- description: user email
|
||||
in: body
|
||||
name: userkey
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- description: user password
|
||||
in: body
|
||||
name: password
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- description: the 2fa token
|
||||
in: body
|
||||
name: twofactorcode
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: ""
|
||||
headers:
|
||||
jwt:
|
||||
description: The authentication token for this session, valid for 24h
|
||||
type: string
|
||||
"400":
|
||||
description: userkey, 2fa token or password missing
|
||||
"401":
|
||||
description: not found or credentials invalid
|
||||
summary: User login
|
||||
/doot:
|
||||
get:
|
||||
description: unauthenticated ping
|
||||
responses: {}
|
||||
summary: ping example
|
||||
/forgot:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Request a password reset for the provided userkey
|
||||
parameters:
|
||||
- description: user email to reset
|
||||
in: body
|
||||
name: userkey
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: ""
|
||||
"400":
|
||||
description: userkey not provided
|
||||
summary: Forgot password
|
||||
/login:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Secured login for any user accounts
|
||||
parameters:
|
||||
- description: user email
|
||||
in: body
|
||||
name: userkey
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- description: user password
|
||||
in: body
|
||||
name: password
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- description: the 2fa token for the user, if activated
|
||||
in: body
|
||||
name: twofactorcode
|
||||
schema:
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: ""
|
||||
headers:
|
||||
jwt:
|
||||
description: The authentication token for this session, valid for 24h
|
||||
type: string
|
||||
"400":
|
||||
description: userkey or password missing
|
||||
"401":
|
||||
description: not found or credentials invalid
|
||||
summary: User login
|
||||
/reset:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Use a JWT token to validate and reset a password
|
||||
parameters:
|
||||
- description: the token emailed to the user
|
||||
in: body
|
||||
name: token
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- description: the new password value
|
||||
in: body
|
||||
name: password
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: ""
|
||||
"400":
|
||||
description: token and password not provided
|
||||
"401":
|
||||
description: bad token or user not found
|
||||
summary: Password reset
|
||||
/sec/doot:
|
||||
get:
|
||||
description: user ping and login check
|
||||
parameters:
|
||||
- description: JWT Cookie set by /login
|
||||
in: header
|
||||
name: jwt
|
||||
required: true
|
||||
type: string
|
||||
responses: {}
|
||||
summary: ping example
|
||||
/signup:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Sign a user up for a new account
|
||||
parameters:
|
||||
- description: user email
|
||||
in: body
|
||||
name: userkey
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- description: user password
|
||||
in: body
|
||||
name: password
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: ""
|
||||
"400":
|
||||
description: userkey missing, or password missing or not strong enough
|
||||
summary: User signup
|
||||
swagger: "2.0"
|
||||
Reference in New Issue
Block a user