docs: add swagger auto generator

* to generate docs, run `make docs`
* endpoint /swagger/
This commit is contained in:
2023-04-13 11:55:07 +00:00
parent 0e5db7f06f
commit d51e74883d
11 changed files with 224 additions and 9 deletions

66
docs/docs.go Normal file
View File

@@ -0,0 +1,66 @@
// Code generated by swaggo/swag. DO NOT EDIT.
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"termsOfService": "https://grassecon.org/pages/terms-and-conditions.html",
"contact": {
"name": "API Support",
"url": "https://grassecon.org/pages/contact-us",
"email": "devops@grassecon.org"
},
"license": {
"name": "AGPL-3.0",
"url": "https://www.gnu.org/licenses/agpl-3.0.en.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/": {
"post": {
"description": "Create a new custodial account.",
"consumes": [
"*/*"
],
"produces": [
"application/json"
],
"summary": "Create a new custodial account.",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "",
BasePath: "/api",
Schemes: []string{},
Title: "CIC Custodial API",
Description: "Interact with CIC Custodial API",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}

42
docs/swagger.json Normal file
View File

@@ -0,0 +1,42 @@
{
"swagger": "2.0",
"info": {
"description": "Interact with CIC Custodial API",
"title": "CIC Custodial API",
"termsOfService": "https://grassecon.org/pages/terms-and-conditions.html",
"contact": {
"name": "API Support",
"url": "https://grassecon.org/pages/contact-us",
"email": "devops@grassecon.org"
},
"license": {
"name": "AGPL-3.0",
"url": "https://www.gnu.org/licenses/agpl-3.0.en.html"
},
"version": "1.0"
},
"basePath": "/api",
"paths": {
"/": {
"post": {
"description": "Create a new custodial account.",
"consumes": [
"*/*"
],
"produces": [
"application/json"
],
"summary": "Create a new custodial account.",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
}
}
}

29
docs/swagger.yaml Normal file
View File

@@ -0,0 +1,29 @@
basePath: /api
info:
contact:
email: devops@grassecon.org
name: API Support
url: https://grassecon.org/pages/contact-us
description: Interact with CIC Custodial API
license:
name: AGPL-3.0
url: https://www.gnu.org/licenses/agpl-3.0.en.html
termsOfService: https://grassecon.org/pages/terms-and-conditions.html
title: CIC Custodial API
version: "1.0"
paths:
/:
post:
consumes:
- '*/*'
description: Create a new custodial account.
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: Create a new custodial account.
swagger: "2.0"