Skip to main content

valid-trait-name

Overview

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

A method can specify one or more traits it inherits by using the optional is property. Each element in the is list must be the name of a trait defined within the root-level traits property or in a library. A trait can also be applied to a resource by using the is property.

PropertyValue
EnabledYes
Maximum SeverityError
MessageTrait with provided name could not be found.
CodeRAML_V501
TypeValidation
Rule SystemSemantic
Broad CategoryResource Types and Traits
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsraml semantic validation name trait method resource

Suggested Fixes

  • Ensure that the trait name matches name of the pre-defined trait exactly and has no typos. Names are compared in a case-sensitive manner.
  • Ensure that a trait with that name is defined in the root object level traits property in the same RAML file or an external library.
  • If you are trying to reference a library's trait, ensure that the library is accessible and the library key used in the reference matches with the library declaration. Also ensure that the trait does indeed exist in the same library.

For More Information