[ADP-403] Problem Type Design
Core Principles
- MUST be a human-readable URI reference.
TIP
According to RFC 9457, the
type
field must be a relative or absolute URI. In practice, thetype
should be designed to be human-readable. Avoid opaque or meaningless URIs such as/1234088abc
—prefer descriptive, hierarchical URIs. - When the publication location is uncertain, MAY use a relative URI reference. Currently we are not publishing any problem types, so we SHOULD use relative URIs.
- General Problem Types: SHOULD maximize reuse of existing problem types.
- Avoid about:blank: MUST NOT use
about:blank
for identical - Refer to ADP-406 for more examples of types.
- SHOULD provide the type list in the OpenAPI document with the example.
Design Process
- Review existing HTTP status codes, referencing ADP-200.
- For exact matches, use the URI reference conversion of the HTTP status code (e.g.,
/problems/not-found
). - Use the
detail
field to provide methods for correcting errors. - If there is no matching status, consult the predefined problem type list.
- Propose new types when necessary.
- Add the new problem type into API document(which is OpenAPI spec in our case) in the example field.
- Add extra field specific to the problem type if necessary. For example,
out-of-stock
problem type may haveproductId
andstockCount
fields in the problem object. - Use the
errors
field to describe multiple errors.
[DEPRECATED] Subtype/extraType Design
Note: This section is historical. The use of an
extraType
field is now discouraged. All problem classification should be done via thetype
URI, using hierarchical or descriptive paths as needed.
Previously, it was considered to introduce an extraType
field for more granular subtypes. The recommended practice now is to encode all specificity into the type
URI, for example:
json
{
"type": "https://example.com/problems/authentication-error/user-not-found",
"title": "Authentication Error",
"status": 409,
"detail": "Your session has expired due to JWT",
"errors": []
}
Do not use extraType
. Always use a descriptive type
URI to represent all levels of problem classification.
References
Changelog
2025.05.09
: Remove product specific type design