Skip to main content

schema-message-type-string

Requires an error schema's message property to use type: string.

AttributeValue
CategorySchema
MaturityGold
OpenAPISwagger 2.0; OpenAPI 3.0, 3.1, 3.2
StarterOff
Lenient–StrictWarning
CompleteError

Intent

Error messages are human-readable text. A consistent string type keeps client rendering and logging predictable.

Flags

A message property in the first media-type schema of a 4xx or 5xx response when its type is not string. A missing type is also reported.

Does not flag

String messages, error schemas without message, and non-error responses. Use error-schema-message to require the property itself.

See it fail

responses:
'400':
description: Invalid request
content:
application/problem+json:
schema:
type: object
properties:
message:
type: array
items:
type: string

Diagnostic: Error property `message` should be string.

Fix it

responses:
'400':
description: Invalid request
content:
application/problem+json:
schema:
type: object
properties:
message:
type: string

Configure

profiles:
default:
rules:
extends: [recommended]
override:
schema-message-type-string: error

Nearby: error-schema-message, schema-code-type-string.