Skip to content

Commit

Permalink
Fix registration of default /_query endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Lennart Elsen committed Jul 15, 2024
1 parent 5dc16b7 commit cd2d1e9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkg/api/query_api_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ func RegisterQueryAPI(a huma.API, caller string, querier query.Runner, middlewar
},
getParamsValidationHandler(),
)

// register routes specific to distributed querying
dqr, ok := querier.(*distributed.QueryRunner)
if ok {
registerDistributedQueryAPI(a, caller, dqr, middlewares)
}
}

func registerDistributedQueryAPI(a huma.API, caller string, qr *distributed.QueryRunner, middlewares huma.Middlewares) {
// query running
huma.Register(a,
huma.Operation{
Expand All @@ -48,17 +57,8 @@ func RegisterQueryAPI(a huma.API, caller string, querier query.Runner, middlewar
Middlewares: middlewares,
Tags: queryTags,
},
getBodyQueryRunnerHandler(caller, querier),
getBodyQueryRunnerHandler(caller, qr),
)

// register routes specific to distributed querying
dqr, ok := querier.(*distributed.QueryRunner)
if ok {
registerDistributedQueryAPI(a, caller, dqr, middlewares)
}
}

func registerDistributedQueryAPI(a huma.API, caller string, qr *distributed.QueryRunner, middlewares huma.Middlewares) {
sse.Register(a,
huma.Operation{
OperationID: "query-post-run-sse",
Expand Down

0 comments on commit cd2d1e9

Please sign in to comment.