Understand Discord OpenAPI spec conventions
mainWhen consuming the Discord OpenAPI spec, be aware of the following implementation details and discrepancies:
Union Types (anyOf vs oneOf)
While the spec uses anyOf, it often behaves like a oneOf union. This means you must provide exactly one type from the list (e.g., Cat OR Dog, not both). This is explicitly marked with the custom extension x-discord-union: oneOf.
Field Specification
- Loose Constraints: The spec avoids over-specifying response fields. It defines types (like
int32) but avoids defining specific minimums, maximums, or other constraints. - String vs Integer Types: Some fields documented as strings in the official Discord documentation may be typed as integers in the spec. The API accepts strings for integer fields if they are parseable as integers.
Discrepancies
If you find discrepancies between the OpenAPI spec and the official Discord developer documentation, follow the documentation, not the spec.