# Swagger 2.0 linter rules

Source: https://apigenie.pl/docs/linter/swagger
See also: [Linter rules](https://apigenie.pl/docs/linter.md), [Recommended ruleset](https://apigenie.pl/docs/linter/swagger/rulesets/recommended.md), [Strict ruleset](https://apigenie.pl/docs/linter/swagger/rulesets/strict.md), [All ruleset](https://apigenie.pl/docs/linter/swagger/rulesets/all.md).

The linter reads Swagger 2.0 documents; OpenAPI 3 documents go to the OpenAPI linter.

## Rulesets

- [Recommended ruleset](/docs/linter/swagger/rulesets/recommended.md)
- [Strict ruleset](/docs/linter/swagger/rulesets/strict.md)
- [All ruleset](/docs/linter/swagger/rulesets/all.md)

## Rules

| Rule | What it checks | Since |
| --- | --- | --- |
| [`audience-defined`](/docs/linter/swagger/rules/audience-defined.md) | This rule checks whether the intended audience of an API is declared in the `x-audience` extension of the info object of a Swagger 2.0 document. | 0.9.0 |
| [`contact-defined`](/docs/linter/swagger/rules/contact-defined.md) | This rule checks whether complete contact information is present in a Swagger 2.0 document. | 0.9.0 |
| [`host-defined`](/docs/linter/swagger/rules/host-defined.md) | This rule checks whether a Swagger 2.0 document declares the host that serves the API. | 0.9.0 |
| [`id-defined`](/docs/linter/swagger/rules/id-defined.md) | This rule checks whether the info object of a Swagger 2.0 document has an identifier extension (`x-id` by default), and whether its value has the expected format (a UUID by default). | 0.9.0 |
| [`info-defined`](/docs/linter/swagger/rules/info-defined.md) | This rule checks whether the info object of a Swagger 2.0 document provides a description and a version. | 0.9.0 |
| [`license-defined`](/docs/linter/swagger/rules/license-defined.md) | This rule checks whether the licensing information is present in a Swagger 2.0 document. | 0.9.0 |
| [`media-types-defined`](/docs/linter/swagger/rules/media-types-defined.md) | This rule checks whether the operations of a Swagger 2.0 document that send or receive a body declare its media types. | 0.9.0 |
| [`no-content-response-defined`](/docs/linter/swagger/rules/no-content-response-defined.md) | This rule checks whether `204 No Content` responses of a Swagger 2.0 document declare a body. | 0.9.0 |
| [`operation-description-defined`](/docs/linter/swagger/rules/operation-description-defined.md) | This rule checks whether every operation of a Swagger 2.0 document has a meaningful description. | 0.9.0 |
| [`operation-id-defined`](/docs/linter/swagger/rules/operation-id-defined.md) | This rule checks whether every operation of a Swagger 2.0 document has an operation ID. | 0.9.0 |
| [`operation-id-unique`](/docs/linter/swagger/rules/operation-id-unique.md) | This rule checks whether the operation IDs of a Swagger 2.0 document are unique. | 0.9.0 |
| [`operation-rate-limiting-defined`](/docs/linter/swagger/rules/operation-rate-limiting-defined.md) | This rule checks whether the responses of Swagger 2.0 operations declare rate limiting headers. | 0.9.0 |
| [`operation-security-defined`](/docs/linter/swagger/rules/operation-security-defined.md) | This rule checks whether every operation of a Swagger 2.0 document is covered by a security requirement. | 0.9.0 |
| [`operation-success-response`](/docs/linter/swagger/rules/operation-success-response.md) | This rule checks whether every operation of a Swagger 2.0 document declares at least one success response. | 0.9.0 |
| [`operation-tags-defined`](/docs/linter/swagger/rules/operation-tags-defined.md) | This rule checks whether every operation of a Swagger 2.0 document has at least one tag. | 0.9.0 |
| [`parameter-description-defined`](/docs/linter/swagger/rules/parameter-description-defined.md) | This rule checks whether every parameter of a Swagger 2.0 document has a meaningful description. | 0.9.0 |
| [`parameter-naming`](/docs/linter/swagger/rules/parameter-naming.md) | This rule checks whether parameter names of a Swagger 2.0 document follow a naming convention. | 0.9.0 |
| [`parameters-unique`](/docs/linter/swagger/rules/parameters-unique.md) | This rule checks whether the parameter lists of a Swagger 2.0 document contain duplicates. | 0.9.0 |
| [`path-parameters-defined`](/docs/linter/swagger/rules/path-parameters-defined.md) | This rule checks whether every parameter of a path template is declared as a path parameter. | 0.9.0 |
| [`path-parameters-on-items`](/docs/linter/swagger/rules/path-parameters-on-items.md) | This rule checks whether path parameters are declared on path items rather than on individual operations. | 0.9.0 |
| [`paths-max-count`](/docs/linter/swagger/rules/paths-max-count.md) | This rule checks whether a Swagger 2.0 document defines more paths than a configured maximum. | 0.9.0 |
| [`paths-max-depth`](/docs/linter/swagger/rules/paths-max-depth.md) | This rule checks whether the paths of a Swagger 2.0 document are nested deeper than a configured maximum. | 0.9.0 |
| [`paths-sorted`](/docs/linter/swagger/rules/paths-sorted.md) | This rule checks whether the paths of a Swagger 2.0 document are sorted. | 0.9.0 |
| [`paths-unique`](/docs/linter/swagger/rules/paths-unique.md) | This rule checks whether a Swagger 2.0 document defines paths that are equivalent to each other. | 0.9.0 |
| [`paths-well-formed`](/docs/linter/swagger/rules/paths-well-formed.md) | This rule checks whether the paths of a Swagger 2.0 document are well-formed. | 0.9.0 |
| [`safe-markdown`](/docs/linter/swagger/rules/safe-markdown.md) | This rule ensures that the GFM descriptions of a Swagger 2.0 document do not contain unsafe constructs like `script` elements or `eval()` calls. | 0.9.0 |
| [`schema-constraints`](/docs/linter/swagger/rules/schema-constraints.md) | This rule ensures that typed objects of a Swagger 2.0 document define constraints restricting the size of the underlying data. | 0.9.0 |
| [`schema-datetime-suffix`](/docs/linter/swagger/rules/schema-datetime-suffix.md) | This rule ensures that the names of date and date-time properties end with a common suffix. | 0.9.0 |
| [`schema-enum-naming`](/docs/linter/swagger/rules/schema-enum-naming.md) | This rule ensures that the string values of `enum` lists adhere to a predefined naming convention. | 0.9.0 |
| [`schema-enum-no-duplicates`](/docs/linter/swagger/rules/schema-enum-no-duplicates.md) | This rule ensures that `enum` lists do not contain duplicate values. | 0.9.0 |
| [`schema-enum-types`](/docs/linter/swagger/rules/schema-enum-types.md) | This rule ensures that all values of an `enum` list match the declared `type`. | 0.9.0 |
| [`schema-example-defined`](/docs/linter/swagger/rules/schema-example-defined.md) | This rule ensures that the schemas of a Swagger 2.0 document provide examples. | 0.9.0 |
| [`schema-format-defined`](/docs/linter/swagger/rules/schema-format-defined.md) | This rule ensures that numeric objects declare the size of their values with a `format`. | 0.9.0 |
| [`schema-format-deprecated`](/docs/linter/swagger/rules/schema-format-deprecated.md) | This rule reports the formats which the OpenAPI format registry marks as deprecated from OpenAPI 3.1, and names what replaces them. | 0.10.0 |
| [`schema-format-type-mismatch`](/docs/linter/swagger/rules/schema-format-type-mismatch.md) | This rule ensures that the `format` of an object is one that applies to its `type`. | 0.9.0 |
| [`schema-format-unknown`](/docs/linter/swagger/rules/schema-format-unknown.md) | This rule reports a `format` of a Swagger 2.0 document which is neither in the OpenAPI format registry nor declared in `openapi.custom_formats` of the configuration file. | 0.10.0 |
| [`schema-no-additional-properties`](/docs/linter/swagger/rules/schema-no-additional-properties.md) | This rule ensures that object schemas do not accept arbitrary additional properties. | 0.9.0 |
| [`schema-property-naming`](/docs/linter/swagger/rules/schema-property-naming.md) | This rule ensures that the names of schema properties adhere to a predefined naming convention. | 0.9.0 |
| [`schema-required-properties-defined`](/docs/linter/swagger/rules/schema-required-properties-defined.md) | This rule checks that every name listed in `required` is declared in `properties`. | 0.9.0 |
| [`schemes-secure`](/docs/linter/swagger/rules/schemes-secure.md) | This rule checks whether a Swagger 2.0 document serves its API over secure transfer protocols only, and whether its host is written in lower case. | 0.9.0 |
| [`spell-check`](/docs/linter/swagger/rules/spell-check.md) | This rule checks the spelling of the texts of a Swagger 2.0 document written for humans: titles, summaries and descriptions. | 0.9.0 |
| [`standard-media-types`](/docs/linter/swagger/rules/standard-media-types.md) | This rule checks whether a Swagger 2.0 document uses only well-known media types. | 0.9.0 |
| [`swagger-validation`](/docs/linter/swagger/rules/swagger-validation.md) | This rule reports violations of the Swagger 2.0 specification that span several objects, and therefore cannot be detected while a single object is read. | 0.9.0 |
| [`tag-description-defined`](/docs/linter/swagger/rules/tag-description-defined.md) | This rule checks whether each tag declared in the root `tags` array of a Swagger 2.0 document has a meaningful description. | 0.9.0 |
| [`tags-sorted`](/docs/linter/swagger/rules/tags-sorted.md) | This rule checks whether the tags in the root `tags` array of a Swagger 2.0 document are sorted by name. | 0.9.0 |
| [`tags-unique`](/docs/linter/swagger/rules/tags-unique.md) | This rule checks whether the tags in the root `tags` array of a Swagger 2.0 document have unique names, comparing names case-insensitively. | 0.9.0 |
| [`unused-request-body`](/docs/linter/swagger/rules/unused-request-body.md) | This rule checks whether `GET` and `HEAD` operations of a Swagger 2.0 document declare a request body. | 0.9.0 |
| [`unused-shared-component`](/docs/linter/swagger/rules/unused-shared-component.md) | This rule checks whether every shared object of a Swagger 2.0 document is actually used. | 0.9.0 |
