stoplightio / spectral

A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI (v3.1, v3.0, and v2.0), Arazzo v1.0, as well as AsyncAPI v2.x.
https://stoplight.io/spectral
Apache License 2.0
2.48k stars 233 forks source link

fix(rulesets): make rule `oas2-operation-formData-consume-check` consistent with Swagger Editor similar rule #2542

Closed pavelkornev closed 5 months ago

pavelkornev commented 1 year ago

Swagger Editor has a similar rule to check values of consumes array: https://github.com/swagger-api/swagger-editor/blob/249d4f0044d2104fdbe582cf53f27f3538b361d7/src/plugins/validate-semantic/validators/form-data.js#L50-L96

The difference is that Spectral rule does not fail if consumes array is completely missing which seems to be a mistake.

Checklist

Does this PR introduce a breaking change?

Potentially, it might be a breaking change for those who use this rule as it will though an additional validation issue in this edge case.

pavelkornev commented 1 year ago

@P0lip, where can i find the failing test file? test-harness/tests/examples.oas2/examples.oas2.test.js

P0lip commented 12 months ago

That'd be https://github.com/stoplightio/spectral/blob/develop/test-harness/scenarios/examples.oas2.scenario

mnaumanali94 commented 5 months ago

Closing as stale.