oas2-operation-formData-consume-check
Operations with "in: formData" parameter must include "application/x-www-form-urlencoded" or "multipart/form-data" in their "consumes" property.
- Applies to
operation- Selects
#OperationObject- Function
oasOpFormDataConsumeCheck- Specs
- OpenAPI 2.0
Use it
This rule ships with OpenLint in spectral:oas. Extending the ruleset turns it on:
extends: spectral:oas
rules:
oas2-operation-formData-consume-check: warn # or off, or another severity
Definition
As defined in @openlint/openlint-rulesets. Functions show by name.
oas2-operation-formData-consume-check:
description: >-
Operations with "in: formData" parameter must include
"application/x-www-form-urlencoded" or "multipart/form-data" in their
"consumes" property.
recommended: true
formats:
- OpenAPI 2.0 (Swagger)
given: '#OperationObject'
then:
function: oasOpFormDataConsumeCheck
About this rule
Operations with an in: formData parameter must include application/x-www-form-urlencoded or multipart/form-data in their consumes property.