Question
OpenAPI 3.1 Callbacks – Missing Deterministic Ordering
Rahul Sage
0 reputation · 26 Aug 2020, 06:22 UTC
72K views0
Goal
Determine a reliable sequence for callback invocations defined in an OpenAPI 3.1 document.
Uncertain Constraints
- The spec declares callbacks as a map of names to callback objects, with no ordering requirement.
- JSON object order is not guaranteed by the language spec, so the iteration sequence can differ across parsers.
- Current tooling (e.g., Swagger UI, OpenAPI Generator) serializes callbacks in lexical order by default, which may not match author intent.
- Server‑side frameworks often ignore map order entirely, potentially breaking workflows that rely on a specific callback sequence.
Questions
- Is there a vendor‑specific extension or best practice to declare callback priority in OpenAPI 3.1?
- Do existing client code generators expose any API to retrieve callbacks in the order they were defined?
- What mechanisms can be implemented in server frameworks to enforce a deterministic callback invocation order?