You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we document error responses with a common ErrorInfo schema:
ErrorInfo:
type: object
required:
- message
- status
- code
properties:
message:
type: string
description: A human readable description of what the event represent
status:
type: integer
description: HTTP response status code
code:
type: string
description: Friendly Code to describe the error
And then examples are provided to illustrate the error cases, with the model:
Specification by examples is not normative. This strictly allows any code to be sent, and setting any integer for status and string for code would pass any standard tool validation.
Possible evolution
The way to enforce a subset of values for status and code is specifying the allowed values as an enum:
The allOf in content.application/json.schema allows a combination of both the generic ErrorInfo schema and the specific schema for this error response, which validates that status and code have only the specified values. This allOf is used without discriminator because it does not imply any hierarchy between the models, just 2 schemas that must be independently validated.
The text was updated successfully, but these errors were encountered:
Problem description
Currently we document error responses with a common
ErrorInfo
schema:And then examples are provided to illustrate the error cases, with the model:
Specification by examples is not normative. This strictly allows any code to be sent, and setting any integer for
status
and string forcode
would pass any standard tool validation.Possible evolution
The way to enforce a subset of values for
status
andcode
is specifying the allowed values as anenum
:The
allOf
in content.application/json.schema allows a combination of both the genericErrorInfo
schema and the specific schema for this error response, which validates thatstatus
andcode
have only the specified values. ThisallOf
is used withoutdiscriminator
because it does not imply any hierarchy between the models, just 2 schemas that must be independently validated.The text was updated successfully, but these errors were encountered: