Optimize swagger

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-01-29 10:19:34 +08:00
parent 3ac1f4165f
commit 220b4d2ea3
17 changed files with 205 additions and 161 deletions

View File

@@ -9,7 +9,16 @@ const docTemplate = `{
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
@@ -1462,12 +1471,12 @@ const docTemplate = `{
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "",
Host: "",
BasePath: "",
Schemes: []string{},
Title: "",
Description: "",
Version: "1.0",
Host: "localhost:8000",
BasePath: "/api/v1",
Schemes: []string{"http", "https"},
Title: "NixCN CMS API",
Description: "API Docs based on Gin framework",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",

View File

@@ -1,8 +1,26 @@
{
"schemes": [
"http",
"https"
],
"swagger": "2.0",
"info": {
"contact": {}
"description": "API Docs based on Gin framework",
"title": "NixCN CMS API",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0"
},
"host": "localhost:8000",
"basePath": "/api/v1",
"paths": {
"/auth/exchange": {
"post": {

View File

@@ -1,3 +1,4 @@
basePath: /api/v1
definitions:
data.User:
properties:
@@ -154,8 +155,19 @@ definitions:
status:
type: string
type: object
host: localhost:8000
info:
contact: {}
contact:
email: support@swagger.io
name: API Support
url: http://www.swagger.io/support
description: API Docs based on Gin framework
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: NixCN CMS API
version: "1.0"
paths:
/auth/exchange:
post:
@@ -823,4 +835,7 @@ paths:
summary: Update User Information
tags:
- User
schemes:
- http
- https
swagger: "2.0"