Skip to content

Commit

Permalink
updated swagger dpcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tíghearnán Carroll committed Nov 29, 2021
1 parent 22df9ce commit bb4bd29
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ install-swagger-gen:
@go get github.com/swaggo/swag/cmd/swag

generate-swagger:
@swag init --parseVendor --parseDependency --parseInternal -g ./cmd/rest-server/main.go
@swag init --parseVendor --parseDependency --parseInternal -g ./cmd/server/main.go
60 changes: 59 additions & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,44 @@ var doc = `{
}
}
}
},
"/v1/proofs/{txid}": {
"post": {
"description": "Creates a json envelope proof",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Proofs"
],
"summary": "InvoiceCreate proof",
"parameters": [
{
"type": "string",
"description": "Transaction ID",
"name": "txid",
"in": "path",
"required": true
},
{
"description": "JSON Envelope",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/envelope.JSONEnvelope"
}
}
],
"responses": {
"201": {
"description": ""
}
}
}
}
},
"definitions": {
Expand Down Expand Up @@ -198,6 +236,26 @@ var doc = `{
"bt.FeeQuote": {
"type": "object"
},
"envelope.JSONEnvelope": {
"type": "object",
"properties": {
"encoding": {
"type": "string"
},
"mimetype": {
"type": "string"
},
"payload": {
"type": "string"
},
"publicKey": {
"type": "string"
},
"signature": {
"type": "string"
}
}
},
"p4.ClientError": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -470,5 +528,5 @@ func (s *s) ReadDoc() string {
}

func init() {
swag.Register(swag.Name, &s{})
swag.Register("swagger", &s{})
}
58 changes: 58 additions & 0 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,44 @@
}
}
}
},
"/v1/proofs/{txid}": {
"post": {
"description": "Creates a json envelope proof",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Proofs"
],
"summary": "InvoiceCreate proof",
"parameters": [
{
"type": "string",
"description": "Transaction ID",
"name": "txid",
"in": "path",
"required": true
},
{
"description": "JSON Envelope",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/envelope.JSONEnvelope"
}
}
],
"responses": {
"201": {
"description": ""
}
}
}
}
},
"definitions": {
Expand Down Expand Up @@ -183,6 +221,26 @@
"bt.FeeQuote": {
"type": "object"
},
"envelope.JSONEnvelope": {
"type": "object",
"properties": {
"encoding": {
"type": "string"
},
"mimetype": {
"type": "string"
},
"payload": {
"type": "string"
},
"publicKey": {
"type": "string"
},
"signature": {
"type": "string"
}
}
},
"p4.ClientError": {
"type": "object",
"properties": {
Expand Down
38 changes: 38 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ definitions:
type: object
bt.FeeQuote:
type: object
envelope.JSONEnvelope:
properties:
encoding:
type: string
mimetype:
type: string
payload:
type: string
publicKey:
type: string
signature:
type: string
type: object
p4.ClientError:
properties:
code:
Expand Down Expand Up @@ -332,4 +345,29 @@ paths:
is validated before being broadcast to the network.
tags:
- Payment
/v1/proofs/{txid}:
post:
consumes:
- application/json
description: Creates a json envelope proof
parameters:
- description: Transaction ID
in: path
name: txid
required: true
type: string
- description: JSON Envelope
in: body
name: body
required: true
schema:
$ref: '#/definitions/envelope.JSONEnvelope'
produces:
- application/json
responses:
"201":
description: ""
summary: InvoiceCreate proof
tags:
- Proofs
swagger: "2.0"
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ require (
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/ghodss/yaml v1.0.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.3 // indirect
Expand All @@ -51,12 +53,15 @@ require (
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2 // indirect
github.com/urfave/cli/v2 v2.3.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.1 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
Expand Down
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnht
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -105,6 +106,7 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
Expand Down Expand Up @@ -366,10 +368,12 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.26.0 h1:ORM4ibhEZeTeQlCojCK2kPz1ogAY4bGs4tD+SaAdGaE=
github.com/rs/zerolog v1.26.0/go.mod h1:yBiM87lvSqX8h0Ww4sdzNSkVYZ8dL2xjZJG1lAuGZEo=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sagikazarmark/crypt v0.1.0/go.mod h1:B/mN0msZuINBtQ1zZLEQcegFJJf9vnYIR88KRMEuODE=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
Expand Down Expand Up @@ -412,6 +416,7 @@ github.com/theflyingcodr/lathos v0.0.6 h1:xIHMZTinurvodmFOgvSGD+OrDhSj42+Xz+FOXY
github.com/theflyingcodr/lathos v0.0.6/go.mod h1:68tGFEbAqAzydWDb1KEJZPQY57l3hH32GXO11Hf1zGQ=
github.com/theflyingcodr/sockets v0.0.11-beta h1:73rvasQ8aQkuzX1usPjAu9YyE73Kn6ffMfCucRGu1Pw=
github.com/theflyingcodr/sockets v0.0.11-beta/go.mod h1:9WuWIyja/Q8PF3WmblAjFmfzkKabEBLto2Gx1XYnerc=
github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
Expand Down
2 changes: 2 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package server is needed for swagger doc generation. Do not delete.
package server
10 changes: 10 additions & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ github.com/beorn7/perks/quantile
# github.com/cespare/xxhash/v2 v2.1.1
## explicit; go 1.11
github.com/cespare/xxhash/v2
# github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d
## explicit; go 1.12
# github.com/davecgh/go-spew v1.1.1
## explicit
github.com/davecgh/go-spew/spew
# github.com/fsnotify/fsnotify v1.5.1
## explicit; go 1.13
github.com/fsnotify/fsnotify
# github.com/ghodss/yaml v1.0.0
## explicit
# github.com/go-openapi/jsonpointer v0.19.5
## explicit; go 1.13
github.com/go-openapi/jsonpointer
Expand Down Expand Up @@ -147,6 +151,10 @@ github.com/rs/zerolog
github.com/rs/zerolog/internal/cbor
github.com/rs/zerolog/internal/json
github.com/rs/zerolog/log
# github.com/russross/blackfriday/v2 v2.0.1
## explicit
# github.com/shurcooL/sanitized_anchor_name v1.0.0
## explicit
# github.com/spf13/afero v1.6.0
## explicit; go 1.13
github.com/spf13/afero
Expand Down Expand Up @@ -196,6 +204,8 @@ github.com/theflyingcodr/sockets
github.com/theflyingcodr/sockets/internal
github.com/theflyingcodr/sockets/middleware
github.com/theflyingcodr/sockets/server
# github.com/urfave/cli/v2 v2.3.0
## explicit; go 1.11
# github.com/valyala/bytebufferpool v1.0.0
## explicit
github.com/valyala/bytebufferpool
Expand Down

0 comments on commit bb4bd29

Please sign in to comment.