Skip to content

[Bug] Unable to use --runner and --http-openapi3 options together in runn CLI #1207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
marimelon opened this issue Apr 3, 2025 · 1 comment · Fixed by #1213
Closed

[Bug] Unable to use --runner and --http-openapi3 options together in runn CLI #1207

marimelon opened this issue Apr 3, 2025 · 1 comment · Fixed by #1213
Assignees
Labels
bug Something isn't working pull request wanted

Comments

@marimelon
Copy link
Contributor

When I tried to use the --runner option and the --http-openapi3 option simultaneously, I encountered the following error.

$ runn run examples/test.yml \
--scopes read:parent \
--runner http1:https://api.github.com \
--http-openapi3 http1:ghes-3.9.yaml
Error: invalid type: <nil>
# examples/test.yml
steps:
  - http1:
      /repos/k1LoW/runn:
        get:
          body:
            application/json: null
@marimelon
Copy link
Contributor Author

Does this fix it?🤔

diff --git a/operator.go b/operator.go
index d2914b3..899b876 100644
--- a/operator.go
+++ b/operator.go
@@ -522,15 +522,18 @@ func New(opts ...Option) (*operator, error) {
 				if key != "" && key != k {
 					continue
 				}
-				runner, ok := bk.runners[k].(map[string]any)
+				runner, ok := bk.httpRunners[k]
 				if !ok {
 					return nil, fmt.Errorf("invalid type: %v", bk.runners[k])
 				}
 				c := &httpRunnerConfig{
 					OpenAPI3DocLocation: p,
 				}
-				c.SkipValidateRequest, _ = runner["skipValidateRequest"].(bool)
-				c.SkipValidateResponse, _ = runner["skipValidateResponse"].(bool)
+
+				if validator, ok := runner.validator.(*openAPI3Validator); ok && validator != nil {
+					c.SkipValidateRequest = validator.skipValidateRequest
+					c.SkipValidateResponse = validator.skipValidateResponse
+				}
 
 				val, err := newHttpValidator(c)
 				if err != nil {

@marimelon marimelon changed the title Unable to use --runner and --http-openapi3 options together in runn CLI [Bug] Unable to use --runner and --http-openapi3 options together in runn CLI Apr 6, 2025
@k1LoW k1LoW added bug Something isn't working pull request wanted labels Apr 8, 2025
k1LoW added a commit that referenced this issue Apr 9, 2025
@k1LoW k1LoW self-assigned this Apr 9, 2025
@k1LoW k1LoW closed this as completed in 57f8c84 Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pull request wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants