daveshanley / vacuum

vacuum is the worlds fastest OpenAPI 3, OpenAPI 2 / Swagger linter and quality analysis tool. Built in go, it tears through API specs faster than you can think. vacuum is compatible with Spectral rulesets and generates compatible reports.
https://quobix.com/vacuum
MIT License
488 stars 39 forks source link

`path-param` rule not finding missing parameters #435

Closed mehdi-sol closed 5 months ago

mehdi-sol commented 5 months ago

Hey! In this sample, the path has two params, but the parameters property only defines one:

```yaml openapi: 3.0.3 info: description: Pizza title: Pizza API version: 1.0.0 paths: /pizza/{type}/{topping}: parameters: - name: type description: Pizza type. in: path required: true schema: type: string get: operationId: get_pizza summary: summary description: description responses: '204': description: no description ```

I believe this is the second bad example from here, so it should be an error. Running vacuum v0.8.4 with the recommended ruleset on this file results in no errors. However, running spectral v6.6.0 with spectral:oas does pick this up.

I believe ensureAllExpectedParamsInPathAreDefined needs a bit of work to correctly pick this up. I'm happy to do a PR for this.

daveshanley commented 5 months ago

All PRs are welcome!

mehdi-sol commented 5 months ago

Thanks for the swift response @daveshanley. I've opened PR #436 for this issue.