Skip to main content

valid-schema-dollar-anchor-format

Overview

This rule belongs to the openapi-v3-syntax-validation ruleset and states that:

Property $anchor in a Schema Object is an identifier keyword used for creation of named fragments. The value of this property must start with a letter ([A-Za-z]) or underscore (_), followed by any number of letters, digits ([0-9]), hyphens (-), underscores (_), and periods (.).

PropertyValue
EnabledYes
Maximum SeverityError
MessageValue for $anchor in Schema Object is invalid.
CodeOPENAPI3SYNTAX_V141
TypeValidation
Rule SystemSyntax
Broad CategorySchemas
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi syntax validation $anchor anchor json schema schema

Suggested Fixes

  • Ensure that the $anchor value does not contain any forbidden characters.
  • Ensure that the $anchor value follows the regex pattern: ^[A-Za-z_]+[A-Za-z0-9-_.]*$
  • Use only alpha-numeric characters, underscores, hyphens, and periods.
  • Ensure that the starting character is a letter or underscore. Numbers and other symbols cannot be used to start an $anchor value.

For More Information