Skip to content

Support OpenAPI 3.1 webhooks and the JSON Schema dialect - #1004

Open
numbata wants to merge 1 commit into
pr/5-builder-responses-schemasfrom
pr/6-oas31-extras
Open

numbata wants to merge 1 commit into
pr/5-builder-responses-schemasfrom
pr/6-oas31-extras

Conversation

@numbata

@numbata numbata commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Teams on OpenAPI 3.1 can document the events their API sends as webhooks and declare which JSON Schema dialect their schemas follow. Without this they had to edit the generated document by hand. Projects on 3.0 or Swagger 2.0 are unaffected.

Problem solved

Webhooks and a declared dialect are 3.1 features that do not come from routes, so the builder cannot infer them. Users need a way to supply them through configuration.

What changes

webhooks: accepts Path Item definitions keyed by name and json_schema_dialect: accepts the dialect URI. Swagger 2.0 style definition references inside webhooks are rewritten to point to components.

Drawbacks and nuances

  • Both options are silently ignored unless openapi_version is '3.1'.
  • Webhook definitions are passed through verbatim apart from key symbolization and reference rewriting; they are not validated beyond the final document checks.
  • Two more configuration keys to maintain.

Alternatives considered

  • Derive webhooks from Grape routes: there is no Grape concept for outgoing calls.
  • Accept a Grape DSL for webhooks: more ergonomic, but speculative and a larger public API than configuration needs.
  • Ship with the core builder: kept separate so 3.1-only surface can be reviewed on its own.

Stacks on: pr/5-builder-responses-schemas.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Danger Report

No issues found.

View run

@numbata
numbata added this pull request to stack #1007 October 14, 2026 16:31
@numbata
numbata force-pushed the pr/6-oas31-extras branch 2 times, most recently from 157cead to f95a545 Compare October 14, 2026 19:41
OpenAPI 3.1 describes events an API sends to its consumers as webhooks and
lets a document declare which JSON Schema dialect its schemas use. Neither
could be expressed through the new builder, so users on 3.1 had to patch the
generated document by hand.

`webhooks:` takes Path Item definitions keyed by name and
`json_schema_dialect:` takes the dialect URI. Both apply only when
`openapi_version` is '3.1'; with '3.0' or Swagger 2.0 they are ignored.
Swagger 2.0 style `#/definitions/` references inside webhooks are rewritten
to `#/components/schemas/`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant