Skip to content

Commit

Permalink
render api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rvhonorato committed Nov 27, 2024
1 parent e6a1af4 commit 140e978
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 7 deletions.
8 changes: 4 additions & 4 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ const docTemplate = `{

// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "",
Version: "1.0",
Host: "",
BasePath: "",
BasePath: "/api",
Schemes: []string{},
Title: "",
Description: "",
Title: "jobd (Job Daemon) API",
Description: "API for managing job queue in jobd application",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
Expand Down
29 changes: 29 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>API Documentation</title>
<link
rel="stylesheet"
type="text/css"
href="https://unpkg.com/[email protected]/swagger-ui.css"
/>
<script src="https://unpkg.com/[email protected]/swagger-ui-bundle.js"></script>
</head>
<body>
<div id="swagger-ui"></div>
<script>
window.onload = function () {
SwaggerUIBundle({
url: "./swagger.json",
dom_id: "#swagger-ui",
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIBundle.SwaggerUIStandalonePreset,
],
layout: "BaseLayout",
});
};
</script>
</body>
</html>
6 changes: 5 additions & 1 deletion docs/swagger.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"swagger": "2.0",
"info": {
"contact": {}
"description": "API for managing job queue in jobd application",
"title": "jobd (Job Daemon) API",
"contact": {},
"version": "1.0"
},
"basePath": "/api",
"paths": {
"/api/get/{id}": {
"get": {
Expand Down
4 changes: 4 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
basePath: /api
definitions:
errors.RestErr:
properties:
Expand Down Expand Up @@ -31,6 +32,9 @@ definitions:
type: object
info:
contact: {}
description: API for managing job queue in jobd application
title: jobd (Job Daemon) API
version: "1.0"
paths:
/api/get/{id}:
get:
Expand Down
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ func init() {
flag.Parse()
}

// @title jobd (Job Daemon) API
// @version 1.0
// @description API for managing job queue in jobd application
// @BasePath /api
func main() {

errDB := db.InitDB()
if errDB != nil {
log.Fatal(errDB)
Expand All @@ -35,5 +38,4 @@ func main() {

r := router.SetupRouter()
_ = r.Run()

}

0 comments on commit 140e978

Please sign in to comment.