Skip to content

Commit 2e89e05

Browse files
committed
fix: openapi revamp: return error to LLM if args are invalid JSON
Signed-off-by: Grant Linville <[email protected]>
1 parent 8128bbc commit 2e89e05

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: pkg/openapi/run.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ func Run(operationID, defaultHost, args string, t *openapi3.T, envs []string) (s
3838
// Validate args against the schema.
3939
validationResult, err := gojsonschema.Validate(gojsonschema.NewStringLoader(schemaJSON), gojsonschema.NewStringLoader(args))
4040
if err != nil {
41-
return "", false, err
41+
// We don't return an error here because we want the LLM to be able to maintain control and try again.
42+
return "ERROR: failed to validate arguments. Make sure your arguments are valid JSON.", false, nil
4243
}
4344

4445
if !validationResult.Valid() {

0 commit comments

Comments
 (0)