Skip to content

Commit

Permalink
embed swagger ui
Browse files Browse the repository at this point in the history
  • Loading branch information
trajan0x committed May 14, 2024
1 parent 2b6d25a commit eb379ab
Show file tree
Hide file tree
Showing 28 changed files with 774 additions and 29 deletions.
1 change: 1 addition & 0 deletions agents/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ require (
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/deepmap/oapi-codegen v1.8.2 // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
github.com/getsentry/sentry-go v0.18.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions agents/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSw
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b h1:oy54yVy300Db264NfQCJubZHpJOl+SoT6udALQdFbSI=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b/go.mod h1:/RJwPD5L4xWgCbqQ1L5cB12ndgfKKT54n9cZFf+8pus=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
github.com/friendsofgo/graphiql v0.2.2 h1:ccnuxpjgIkB+Lr9YB2ZouiZm7wvciSfqwpa9ugWzmn0=
Expand Down
1 change: 1 addition & 0 deletions committee/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ require (
github.com/fatih/structtag v1.2.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fjl/memsize v0.0.2 // indirect
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b // indirect
github.com/flynn/noise v1.1.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions committee/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSw
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b h1:oy54yVy300Db264NfQCJubZHpJOl+SoT6udALQdFbSI=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b/go.mod h1:/RJwPD5L4xWgCbqQ1L5cB12ndgfKKT54n9cZFf+8pus=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg=
github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag=
Expand Down
2 changes: 2 additions & 0 deletions contrib/promexporter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,8 @@ github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSw
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b h1:oy54yVy300Db264NfQCJubZHpJOl+SoT6udALQdFbSI=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b/go.mod h1:/RJwPD5L4xWgCbqQ1L5cB12ndgfKKT54n9cZFf+8pus=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
Expand Down
2 changes: 1 addition & 1 deletion docs/bridge/docs/Services/Omnirpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ curl --location --request POST 'http://localhost:5000/rpc/1' \
}'
```

A full postman collection can be found [here](https://github.com/synapsecns/sanguine/blob/master/services/omnirpc/swagger/collection.json) or at the `/collection.json endpoint`
A full postman collection can be found [here](https://github.com/synapsecns/sanguine/blob/master/services/omnirpc/swagger/collection.json) or at the `/collection.json endpoint`. Swagger docs are also available at `/swagger`.

Not all requests are confirmable. Please see [here](https://pkg.go.dev/github.com/synapsecns/sanguine/services/omnirpc#section-readme) for details.
1 change: 1 addition & 0 deletions services/cctp-relayer/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ require (
github.com/fatih/structtag v1.2.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fjl/memsize v0.0.2 // indirect
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
Expand Down
2 changes: 2 additions & 0 deletions services/cctp-relayer/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSw
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b h1:oy54yVy300Db264NfQCJubZHpJOl+SoT6udALQdFbSI=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b/go.mod h1:/RJwPD5L4xWgCbqQ1L5cB12ndgfKKT54n9cZFf+8pus=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
Expand Down
1 change: 1 addition & 0 deletions services/explorer/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ require (
github.com/fatih/structtag v1.2.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fjl/memsize v0.0.2 // indirect
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
Expand Down
2 changes: 2 additions & 0 deletions services/explorer/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,8 @@ github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSw
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b h1:oy54yVy300Db264NfQCJubZHpJOl+SoT6udALQdFbSI=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b/go.mod h1:/RJwPD5L4xWgCbqQ1L5cB12ndgfKKT54n9cZFf+8pus=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
Expand Down
5 changes: 3 additions & 2 deletions services/omnirpc/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OmniRPC

[![Go Reference](https://pkg.go.dev/badge/github.com/synapsecns/sanguine/services/omnirpc.svg)](https://pkg.go.dev/github.com/synapsecns/sanguine/services/omnirpc)
[![Go Reference](httpsa://pkg.go.dev/badge/github.com/synapsecns/sanguine/services/omnirpc.svg)](https://pkg.go.dev/github.com/synapsecns/sanguine/services/omnirpc)
[![Go Report Card](https://goreportcard.com/badge/github.com/synapsecns/sanguine/services/omnirpc)](https://goreportcard.com/report/github.com/synapsecns/sanguine/services/omnirpc)


Expand Down Expand Up @@ -73,7 +73,7 @@ This is because chains might have different states for "latest", resulting in fa

You can also query using a customizable number of confirmations using (for 2 confirmations on eth): `http://localhost:5000/confirmations/2/rpc/1`.

A postman collection is also available at `/collection.json`
A full postman collection can be found [here](https://github.com/synapsecns/sanguine/blob/master/services/omnirpc/swagger/collection.json) or at the `/collection.json endpoint`

Confirmable only when latest or pending are not passed:

Expand Down Expand Up @@ -122,3 +122,4 @@ You can also quickly start a server running against all public chainlist rpcs wi
## Additional functionality

Please see [modules/README.md](modules/README.md) for additional functionality.

1 change: 1 addition & 0 deletions services/omnirpc/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ require (
github.com/buger/jsonparser v1.1.1
github.com/davecgh/go-spew v1.1.1
github.com/ethereum/go-ethereum v1.11.6
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b
github.com/gin-gonic/gin v1.9.1
github.com/go-http-utils/headers v0.0.0-20181008091004-fed159eddc2a
github.com/go-resty/resty/v2 v2.11.0
Expand Down
2 changes: 2 additions & 0 deletions services/omnirpc/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSw
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b h1:oy54yVy300Db264NfQCJubZHpJOl+SoT6udALQdFbSI=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b/go.mod h1:/RJwPD5L4xWgCbqQ1L5cB12ndgfKKT54n9cZFf+8pus=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
"github.com/flowchartsman/swaggerui"
"github.com/gin-gonic/gin"
"github.com/synapsecns/sanguine/core/ginhelper"
"github.com/synapsecns/sanguine/core/metrics"
Expand All @@ -17,6 +18,7 @@ import (
"github.com/synapsecns/sanguine/ethergo/parser/rpc"
"github.com/synapsecns/sanguine/services/omnirpc/collection"
omniHTTP "github.com/synapsecns/sanguine/services/omnirpc/http"
"github.com/synapsecns/sanguine/services/omnirpc/swagger"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
"io"
Expand Down Expand Up @@ -82,6 +84,8 @@ func (r *finalizedProxyImpl) Run(ctx context.Context) error {
c.Data(http.StatusOK, gin.MIMEJSON, res)
})

router.Any("/swagger/*any", gin.WrapH(http.StripPrefix("/swagger", swaggerui.Handler(swagger.OpenAPI))))

r.logger.Infof(ctx, "running on port %d", r.port)
err := router.Run(fmt.Sprintf("0.0.0.0:%d", r.port))
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions services/omnirpc/modules/harmonyproxy/harmonyproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/filters"
"github.com/flowchartsman/swaggerui"
"github.com/gin-gonic/gin"
"github.com/ipfs/go-log"
"github.com/synapsecns/sanguine/core/ginhelper"
Expand All @@ -19,6 +20,7 @@ import (
"github.com/synapsecns/sanguine/services/omnirpc/collection"
omniHTTP "github.com/synapsecns/sanguine/services/omnirpc/http"
"github.com/synapsecns/sanguine/services/omnirpc/proxy"
"github.com/synapsecns/sanguine/services/omnirpc/swagger"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
"golang.org/x/sync/errgroup"
Expand Down Expand Up @@ -71,6 +73,8 @@ func (r *HarmonyProxy) Run(_ context.Context) error {
}
})

router.Any("/swagger/*any", gin.WrapH(http.StripPrefix("/swagger", swaggerui.Handler(swagger.OpenAPI))))

router.GET("/collection.json", func(c *gin.Context) {
res, err := collection.CreateCollection()
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions services/omnirpc/proxy/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package proxy
import (
"context"
"fmt"
"github.com/flowchartsman/swaggerui"
"github.com/gin-gonic/gin"
"github.com/synapsecns/sanguine/core/ginhelper"
"github.com/synapsecns/sanguine/core/metrics"
"github.com/synapsecns/sanguine/services/omnirpc/chainmanager"
"github.com/synapsecns/sanguine/services/omnirpc/collection"
"github.com/synapsecns/sanguine/services/omnirpc/config"
omniHTTP "github.com/synapsecns/sanguine/services/omnirpc/http"
"github.com/synapsecns/sanguine/services/omnirpc/swagger"
"go.opentelemetry.io/otel/trace"
"net/http"
"strconv"
Expand Down Expand Up @@ -96,6 +98,8 @@ func (r *RPCProxy) Run(ctx context.Context) {
c.JSON(http.StatusOK, r.chainManager.GetChainIDs())
})

router.Any("/swagger/*any", gin.WrapH(http.StripPrefix("/swagger", swaggerui.Handler(swagger.OpenAPI))))

router.GET("/collection.json", func(c *gin.Context) {
res, err := collection.CreateCollection()
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions services/omnirpc/swagger/gen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

cargo install postman2openapi-cli
# As go:generate does not support unix pipes, we need to do this here
postman2openapi collection.json > openapi.yaml
33 changes: 9 additions & 24 deletions services/omnirpc/swagger/generate.go
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
// package main generates a static swagger collection for use in documentation. This differs from collection which dynamically generates a collection for serving.
// this is purely meant for static linking in the repo.
package main
// Package swagger registers the swagger generated spec.
package swagger

import (
"github.com/synapsecns/sanguine/services/omnirpc/collection"
"os"
)
import _ "embed" // embed is required for go:embed

//go:generate go run github.com/synapsecns/sanguine/services/omnirpc/swagger
//go:generate go run github.com/synapsecns/sanguine/services/omnirpc/swagger/generator
//go:generate ./gen.sh

func main() {
res, err := collection.CreateCollection()
if err != nil {
panic(err)
}

file, err := os.Create("collection.json")
if err != nil {
panic(err)
}

_, err = file.Write(res)
if err != nil {
panic(err)
}
}
// OpenAPI is the openapi specification for the omnirpc service.
//
//go:embed openapi.yaml
var OpenAPI []byte
25 changes: 25 additions & 0 deletions services/omnirpc/swagger/generator/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// package main generates a static swagger collection for use in documentation. This differs from collection which dynamically generates a collection for serving.
// this is purely meant for static linking in the repo.
package main

import (
"github.com/synapsecns/sanguine/services/omnirpc/collection"
"os"
)

func main() {
res, err := collection.CreateCollection()
if err != nil {
panic(err)
}

file, err := os.Create("collection.json")
if err != nil {
panic(err)
}

_, err = file.Write(res)
if err != nil {
panic(err)
}
}
Loading

0 comments on commit eb379ab

Please sign in to comment.