oas2-unused-definition
Potentially unused definition has been detected.
- Applies to
definitions- Selects
$.definitions- Function
unreferencedReusableObject- 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-unused-definition: warn # or off, or another severity
Definition
As defined in @openlint/openlint-rulesets. Functions show by name.
oas2-unused-definition:
description: Potentially unused definition has been detected.
recommended: true
formats:
- OpenAPI 2.0 (Swagger)
given: $.definitions
resolved: false
then:
function: unreferencedReusableObject
functionOptions:
reusableObjectsLocation: '#/definitions'
About this rule
Potential unused reusable definition entry has been detected.
Warning
This rule may identify false positives when linting a specification that acts as a library (a container storing reusable objects, leveraged by other specifications that reference those objects).