Skip to content
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

Vacuum 0.16.3 always fails on "post-response-success" rule, dashboard panics #624

Open
AtomicTroop opened this issue Feb 19, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@AtomicTroop
Copy link

AtomicTroop commented Feb 19, 2025

Running vacuum lint -dz openapi.yml always reports the post-response-success rule as an error.
As you can see from the reproduction spec included at the end of this message, a '200' response is present.

The warning includes the following message:
'postResponseSuccess' function has invalid options supplied. Example valid options are 'properties' = [200,201,300]: minimum property number not met (1)

If the '200' response is not present, linting will also report a warning on the operation-success-response rule correctly as expected. This rule seems to be a superset of post-response-success though, making the latter rule seem redundant.

Additionally, running vacuum dashboard -z openapi.yml and navigating to Operations > Check POST operations for success response panics:

panic: runtime error: index out of range [-1]

goroutine 1 [running]:
github.com/daveshanley/vacuum/cui.generateConsoleSnippet(0xc0004d6420, {0xc000294008, 0x25, 0x1?}, 0x0?, 0x10000001000?)
        /home/runner/work/vacuum/vacuum/cui/tabbed_view.go:350 +0x88d
github.com/daveshanley/vacuum/cui.(*TabbedView).generateRuleViolationView(0xc0004dc028)
        /home/runner/work/vacuum/vacuum/cui/tabbed_view.go:269 +0x748
github.com/daveshanley/vacuum/cui.(*Dashboard).generateViewsAfterEvent(0xc0004dc000)
        /home/runner/work/vacuum/vacuum/cui/dashboard.go:209 +0xe9
github.com/daveshanley/vacuum/cui.(*Dashboard).eventLoop(0xc0004dc000, {0xc000420320?, 0x9, 0xc00047eea0?})
        /home/runner/work/vacuum/vacuum/cui/dashboard.go:165 +0x4e5
github.com/daveshanley/vacuum/cui.(*Dashboard).Render(0xc0004dc000)
        /home/runner/work/vacuum/vacuum/cui/dashboard.go:133 +0x9ef
github.com/daveshanley/vacuum/cmd.GetRootCommand.GetDashboardCommand.func6(0xc00051cf08, {0xc000411120, 0x4?, 0x16621eb?})
        /home/runner/work/vacuum/vacuum/cmd/dashboard.go:125 +0x5c5
github.com/spf13/cobra.(*Command).execute(0xc00051cf08, {0xc000411100, 0x2, 0x2})
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc000499208)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1041
github.com/daveshanley/vacuum/cmd.Execute({0x18d338c?, 0x19?}, {0x18e4c40?, 0x16c509e?}, {0xc000428ee0?, 0xc0000061c0?})
        /home/runner/work/vacuum/vacuum/cmd/root.go:30 +0x8f
main.main()
        /home/runner/work/vacuum/vacuum/vacuum.go:25 +0x158

Minimal spec to reproduce
openapi: 3.1.1
paths:
  /foo:
    post:
      operationId: foo
      responses:
        '200':
          description: "success"
          content:
            application/json:
              examples:
                success:
                  summary: "success"
                  value:
                    foo: "bar"
              schema:
                type: object
                properties:
                  foo:
                    type: string
                    example: "foo"
        '400':
          description: "bad request"
          content:
            application/json:
              examples:
                badRequest:
                  summary: "Invalid request parameters"
                  value:
                    foo: "bar"
              schema:
                type: object
                properties:
                  foo:
                    type: string
                    example: "foo"
@daveshanley daveshanley added the bug Something isn't working label Feb 20, 2025
@daveshanley
Copy link
Owner

oh dear, willfix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants