feat: Add Swagger documentation for Time Tracker API with hello endpoint
This commit is contained in:
parent
dde2017ad1
commit
4b98c1a9e5
62
backend/cmd/api/docs/docs.go
Normal file
62
backend/cmd/api/docs/docs.go
Normal file
@ -0,0 +1,62 @@
|
||||
// Package docs 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}}",
|
||||
"contact": {},
|
||||
"version": "{{.Version}}"
|
||||
},
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"description": "Get a hello message",
|
||||
"produces": [
|
||||
"text/plain"
|
||||
],
|
||||
"summary": "Say hello",
|
||||
"operationId": "hello",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Hello from the Time Tracker Backend!",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
"BearerAuth": {
|
||||
"type": "apiKey",
|
||||
"name": "Authorization",
|
||||
"in": "header"
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = &swag.Spec{
|
||||
Version: "1.0",
|
||||
Host: "localhost:8080",
|
||||
BasePath: "/api",
|
||||
Schemes: []string{},
|
||||
Title: "Time Tracker API",
|
||||
Description: "This is a simple time tracker API.",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
LeftDelim: "{{",
|
||||
RightDelim: "}}",
|
||||
}
|
||||
|
||||
func init() {
|
||||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||||
}
|
38
backend/cmd/api/docs/swagger.json
Normal file
38
backend/cmd/api/docs/swagger.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "This is a simple time tracker API.",
|
||||
"title": "Time Tracker API",
|
||||
"contact": {},
|
||||
"version": "1.0"
|
||||
},
|
||||
"host": "localhost:8080",
|
||||
"basePath": "/api",
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"description": "Get a hello message",
|
||||
"produces": [
|
||||
"text/plain"
|
||||
],
|
||||
"summary": "Say hello",
|
||||
"operationId": "hello",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Hello from the Time Tracker Backend!",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
"BearerAuth": {
|
||||
"type": "apiKey",
|
||||
"name": "Authorization",
|
||||
"in": "header"
|
||||
}
|
||||
}
|
||||
}
|
26
backend/cmd/api/docs/swagger.yaml
Normal file
26
backend/cmd/api/docs/swagger.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
basePath: /api
|
||||
host: localhost:8080
|
||||
info:
|
||||
contact: {}
|
||||
description: This is a simple time tracker API.
|
||||
title: Time Tracker API
|
||||
version: "1.0"
|
||||
paths:
|
||||
/:
|
||||
get:
|
||||
description: Get a hello message
|
||||
operationId: hello
|
||||
produces:
|
||||
- text/plain
|
||||
responses:
|
||||
"200":
|
||||
description: Hello from the Time Tracker Backend!
|
||||
schema:
|
||||
type: string
|
||||
summary: Say hello
|
||||
securityDefinitions:
|
||||
BearerAuth:
|
||||
in: header
|
||||
name: Authorization
|
||||
type: apiKey
|
||||
swagger: "2.0"
|
@ -24,8 +24,6 @@ import (
|
||||
// @in header
|
||||
// @name Authorization
|
||||
|
||||
// @x-extension ulid.ULID string
|
||||
|
||||
// @Summary Say hello
|
||||
// @Description Get a hello message
|
||||
// @ID hello
|
||||
|
Loading…
x
Reference in New Issue
Block a user