Skip to main content

resolvable-model-reference

Overview

This rule belongs to the swagger-v1-validation ruleset and states that:

A model can be referenced using either the type or $ref properties in several Swagger v1 document entities like operations, parameters and model properties. When a model is referenced this way, it must be pre-defined with the same name or id in the root level models section of the API Declaration/Resource Listing file.

PropertyValue
EnabledYes
Maximum SeverityError
MessageReferenced model type could not be found.
CodeSWAGGER1_V300
TypeValidation
Rule SystemSemantic
Broad CategoryData Types
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsswagger1 swagger semantic validation name model $ref type data type

Suggested Fixes

  • Ensure that the root level models property is set in the document and is a non-empty object containing model definitions.
  • Ensure that the name used for referencing a model matches exactly with the key name or id of a model definition in the root level models property. Name is compared in a case-sensitive manner.
  • Ensure that the name has no typos.
  • Ensure that the referenced model definition is a valid Model Object.

For More Information