Skip to main content



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

The value of the string validation keyword pattern must be a valid regular expression according to the ECMA 262 regular expression dialect. It is recommended to restrict yourself to following regular expression tokens: individual Unicode characters, as defined by the JSON specification [RFC8259], simple character classes ([abc]), range character classes ([a-z]), complemented character classes ([^abc], [^a-z]), simple quantifiers: + (one or more), * (zero or more), ? (zero or one), and their lazy versions (+?, *?, ??), range quantifiers: {x} (exactly x occurrences), {x,y} (at least x, at most y, occurrences), {x,} (x occurrences or more), and their lazy versions, the beginning-of-input (^) and end-of-input ($) anchors.

Maximum SeverityWarning
MessagePattern is invalid.
Rule SystemSyntax
Broad CategorySchemas
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi syntax linting regex pattern pattern string schema validation schema

Suggested Fixes

  • Ensure that the value of the pattern is a valid regex expression.
  • Ensure that the value of the pattern is properly escaped i.e. any reserved characters are appropriately handled.
  • Ensure that the regex expression is valid according to the ECMA 262 dialect of regular expressions.
  • Ensure that the pattern uses allowed tokens only.

For More Information