-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add basic logic for openapi specs and add annotation for status…
… endpoint
- Loading branch information
Showing
10 changed files
with
284 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,3 +122,9 @@ docker.down: ## Stop & Remove all services (app and redis) and network. | |
docker.clean: ## Stop & Remove all app containers (without the volume) and delete the images. | ||
@docker rm -f $(docker ps -aq --filter "name=app.demo.redis") | ||
@docker rmi -f $(docker images -aq --filter="reference=app.demo.redis:*") | ||
|
||
.PHONY: swagger.generate | ||
swagger.generate: ## Install swaggo/swag and generate openapi specs. | ||
## use v1.8.12 due to https://github.com/swaggo/swag/issues/1568 | ||
go install github.com/swaggo/swag/cmd/[email protected] | ||
swag init -g api.services.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "This provides a CRUD service on Book.", | ||
"title": "Book Store API", | ||
"contact": { | ||
"name": "Jerome Amon", | ||
"url": "https://learn.cloudmentor-scale.com/contact" | ||
}, | ||
"license": { | ||
"name": "MIT", | ||
"url": "https://github.com/jeamon/demo-redis/blob/main/LICENSE" | ||
}, | ||
"version": "1.0" | ||
}, | ||
"host": "localhost:8080", | ||
"basePath": "/v1", | ||
"paths": { | ||
"/status": { | ||
"get": { | ||
"description": "Get how long the application has been online.", | ||
"produces": [ | ||
"application/json" | ||
], | ||
"tags": [ | ||
"Books" | ||
], | ||
"summary": "Get the app status", | ||
"operationId": "get-status", | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"schema": { | ||
"$ref": "#/definitions/main.StatusResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"main.StatusResponse": { | ||
"type": "object", | ||
"properties": { | ||
"message": { | ||
"type": "string" | ||
}, | ||
"requestid": { | ||
"type": "string" | ||
}, | ||
"status": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"externalDocs": { | ||
"description": "OpenAPI", | ||
"url": "https://swagger.io/resources/open-api/" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
basePath: /v1 | ||
definitions: | ||
main.StatusResponse: | ||
properties: | ||
message: | ||
type: string | ||
requestid: | ||
type: string | ||
status: | ||
type: string | ||
type: object | ||
externalDocs: | ||
description: OpenAPI | ||
url: https://swagger.io/resources/open-api/ | ||
host: localhost:8080 | ||
info: | ||
contact: | ||
name: Jerome Amon | ||
url: https://learn.cloudmentor-scale.com/contact | ||
description: This provides a CRUD service on Book. | ||
license: | ||
name: MIT | ||
url: https://github.com/jeamon/demo-redis/blob/main/LICENSE | ||
title: Book Store API | ||
version: "1.0" | ||
paths: | ||
/status: | ||
get: | ||
description: Get how long the application has been online. | ||
operationId: get-status | ||
produces: | ||
- application/json | ||
responses: | ||
"200": | ||
description: OK | ||
schema: | ||
$ref: '#/definitions/main.StatusResponse' | ||
summary: Get the app status | ||
tags: | ||
- Books | ||
swagger: "2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.