Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: swagger using swaggo/swag and gin-swagger #32

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ mod-tidy:
clean:
rm -f $(BINARIES)

format: mod-tidy
go fmt ./...

swagger:
swag f -g api.go -d internal/api,.
swag i -g api.go -d internal/api,.

test: mod-tidy
go test -v ./...

Expand Down
103 changes: 103 additions & 0 deletions docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 82 additions & 0 deletions docs/swagger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"schemes": [
"http"
],
"swagger": "2.0",
"info": {
"description": "Programmable Cardano Wallet API",
"title": "bursa",
"contact": {
"name": "Blink Labs",
"url": "https://blinklabs.io",
"email": "[email protected]"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "v0"
},
"basePath": "/",
"paths": {
"/api/wallet/create": {
"get": {
"description": "Create a wallet and return details",
"produces": [
"application/json"
],
"summary": "CreateWallet",
"responses": {
"200": {
"description": "Ok",
"schema": {
"$ref": "#/definitions/bursa.Wallet"
}
}
}
}
}
},
"definitions": {
"bursa.KeyFile": {
"type": "object",
"properties": {
"cborHex": {
"type": "string"
},
"description": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"bursa.Wallet": {
"type": "object",
"properties": {
"mnemonic": {
"type": "string"
},
"payment_address": {
"type": "string"
},
"payment_kvey": {
"$ref": "#/definitions/bursa.KeyFile"
},
"payment_skey": {
"$ref": "#/definitions/bursa.KeyFile"
},
"stake_address": {
"type": "string"
},
"stake_skey": {
"$ref": "#/definitions/bursa.KeyFile"
},
"stake_vkey": {
"$ref": "#/definitions/bursa.KeyFile"
}
}
}
}
}
54 changes: 54 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
basePath: /
definitions:
bursa.KeyFile:
properties:
cborHex:
type: string
description:
type: string
type:
type: string
type: object
bursa.Wallet:
properties:
mnemonic:
type: string
payment_address:
type: string
payment_kvey:
$ref: '#/definitions/bursa.KeyFile'
payment_skey:
$ref: '#/definitions/bursa.KeyFile'
stake_address:
type: string
stake_skey:
$ref: '#/definitions/bursa.KeyFile'
stake_vkey:
$ref: '#/definitions/bursa.KeyFile'
type: object
info:
contact:
email: [email protected]
name: Blink Labs
url: https://blinklabs.io
description: Programmable Cardano Wallet API
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
title: bursa
version: v0
paths:
/api/wallet/create:
get:
description: Create a wallet and return details
produces:
- application/json
responses:
"200":
description: Ok
schema:
$ref: '#/definitions/bursa.Wallet'
summary: CreateWallet
schemes:
- http
swagger: "2.0"
14 changes: 14 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,36 @@ require (
github.com/gin-contrib/zap v0.2.0
github.com/gin-gonic/gin v1.9.1
github.com/kelseyhightower/envconfig v1.4.0
github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.0
github.com/swaggo/swag v1.16.2
github.com/tyler-smith/go-bip39 v1.1.0
go.uber.org/zap v1.26.0
)

require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/btcsuite/btcutil v1.0.2 // indirect
github.com/bytedance/sonic v1.10.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.15.3 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
Expand All @@ -39,6 +51,8 @@ require (
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.7.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading