Validation & limits

Input validation rules and service limits for Style guide API.

These constraints apply to patterns, suggestions, context_include, context_exclude, and description.

Forbidden characters

Forbidden characters are validated per-field.

Field(s)
Forbidden characters
Notes

patterns, suggestions, context_include, context_exclude

# ; [ ] < > { } and control characters: \n \t \b \r \a \f \v

Control characters are rejected even if escaped.

description

# [ ] < > { } and control characters: \n \t \b \r \a \f \v

Same as above, but ; is allowed.

Length limits

Limits are Unicode character count.

The limit is the total length across all values when the field is an array.

Field
Max length (Unicode chars)
Notes

patterns

150

If this is an array, sum of all items must be ≤ 150.

suggestions

150

If this is an array, sum of all items must be ≤ 150.

context_include

150

If this is an array, sum of all items must be ≤ 150.

context_exclude

150

If this is an array, sum of all items must be ≤ 150.

description

200

Always checked as a single string.

Uniqueness and cross-field rules

Constraint
What it means

Unique patterns

All patterns values must be unique within a rule.

Unique suggestions

All suggestions values must be unique within a rule.

Pattern vs suggestion collision

A patterns value cannot equal any suggestions value.

Context vs pattern collision (include)

No context_include item may equal any patterns item.

Context vs pattern collision (exclude)

No context_exclude item may equal any patterns item.

Include vs exclude collision

No context_exclude item may equal any context_include item.

No substring overlap in context_include

No context_include value may be a substring of another context_include value.

No substring overlap in context_exclude

No context_exclude value may be a substring of another context_exclude value.

Rule-level duplication in a file

Two rules with the same patterns + context_include combination are not allowed within the same file.

Limits

Limit
Value

Maximum rules per language

2,000

Last updated

Was this helpful?