Skip to content

Commit

Permalink
docs: cleanup OpenAPI spec
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjan committed Dec 18, 2024
1 parent 9d3a308 commit 2c81c09
Show file tree
Hide file tree
Showing 4 changed files with 372 additions and 558 deletions.
2 changes: 1 addition & 1 deletion bus/bus.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ func (b *Bus) Handler() http.Handler {

"POST /consensus/acceptblock": b.consensusAcceptBlock,
"GET /consensus/network": b.consensusNetworkHandler,
"GET /consensus/siafundfee/:payout": b.contractTaxHandlerGET,
"GET /consensus/siafundfee/:payout": b.consensusPayoutContractTaxHandlerGET,
"GET /consensus/state": b.consensusStateHandler,

"PUT /contracts": b.contractsHandlerPUT,
Expand Down
15 changes: 3 additions & 12 deletions bus/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,7 @@ func (b *Bus) handlePOSTAlertsRegister(jc jape.Context) {

func (b *Bus) accountsHandlerGET(jc jape.Context) {
var owner string
if jc.DecodeForm("owner", &owner) != nil {
if jc.DecodeParam("owner", &owner) != nil {

Check failure on line 1872 in bus/routes.go

View workflow job for this annotation

GitHub Actions / analyze

Analyzer warning in bus,bus/client

DecodeParam called on param ("owner") not present in route definition
return
}
accounts, err := b.store.Accounts(jc.Request.Context(), owner)
Expand Down Expand Up @@ -1920,7 +1920,7 @@ func (b *Bus) broadcastAction(e webhooks.Event) {
}
}

func (b *Bus) contractTaxHandlerGET(jc jape.Context) {
func (b *Bus) consensusPayoutContractTaxHandlerGET(jc jape.Context) {
var payout types.Currency
if jc.DecodeParam("payout", (*api.ParamCurrency)(&payout)) != nil {
return
Expand Down Expand Up @@ -2021,12 +2021,6 @@ func (b *Bus) webhookHandlerPost(jc jape.Context) {
}

func (b *Bus) metricsHandlerDELETE(jc jape.Context) {
key := jc.PathParam("key")
if key == "" {
jc.Error(errors.New("unknown metric ''"), http.StatusBadRequest)
return
}

var cutoff time.Time
if jc.DecodeForm("cutoff", (*api.TimeRFC3339)(&cutoff)) != nil {
return
Expand All @@ -2035,10 +2029,7 @@ func (b *Bus) metricsHandlerDELETE(jc jape.Context) {
return
}

err := b.store.PruneMetrics(jc.Request.Context(), key, cutoff)
if jc.Check("failed to prune metrics", err) != nil {
return
}
jc.Check("failed to prune metrics", b.store.PruneMetrics(jc.Request.Context(), jc.PathParam("key"), cutoff))
}

func (b *Bus) metricsHandlerPUT(jc jape.Context) {
Expand Down
Loading

0 comments on commit 2c81c09

Please sign in to comment.