Skip to content

Commit 4074644

Browse files
authored
fix: openapi: description length and default bearer auth (#221)
Signed-off-by: Grant Linville <grant@acorn.io>
1 parent eb35802 commit 4074644

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

pkg/engine/openapi.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ func (e *Engine) runOpenAPI(tool types.Tool, input string) (*Return, error) {
8484
}
8585

8686
// Check for authentication (only if using HTTPS)
87-
if u.Scheme == "https" && len(instructions.SecurityInfos) > 0 {
88-
if err := handleAuths(req, envMap, instructions.SecurityInfos); err != nil {
89-
return nil, fmt.Errorf("error setting up authentication: %w", err)
87+
if u.Scheme == "https" {
88+
if len(instructions.SecurityInfos) > 0 {
89+
if err := handleAuths(req, envMap, instructions.SecurityInfos); err != nil {
90+
return nil, fmt.Errorf("error setting up authentication: %w", err)
91+
}
9092
}
9193

9294
// If there is a bearer token set for the whole server, and no Authorization header has been defined, use it.

pkg/loader/openapi.go

+4
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ func getOpenAPITools(t *openapi3.T, defaultHost string) ([]types.Tool, error) {
8484
toolDesc = operation.Summary
8585
}
8686

87+
if len(toolDesc) > 1024 {
88+
toolDesc = toolDesc[:1024]
89+
}
90+
8791
var (
8892
// auths are represented as a list of maps, where each map contains the names of the required security schemes.
8993
// Items within the same map are a logical AND. The maps themselves are a logical OR. For example:

0 commit comments

Comments
 (0)