Skip to content
New issue

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

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

Already on GitHub? # 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/cobra@v1.8.1/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc000499208)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/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

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

No branches or pull requests

2 participants