datamodel-code-generator icon indicating copy to clipboard operation
datamodel-code-generator copied to clipboard

Support `webhooks` in `--openapi-scope`

Open stephanschielke opened this issue 1 year ago • 0 comments

OpenAPI Documents can have a webhooks root element instead of paths or component:

image https://spec.openapis.org/oas/latest.html#oasWebhooks

It usually contains path-like items with operations that have a requestBody which have content schema attribute. It's the same schema object that already is getting utilised for schema and paths openapi-scopes when used with --openapi-scope.

Here is an example OpenAPI JSON (for Zoom Account Webhooks)

It would be nice to extend the currently available openapi-scopes to include webhooks to generate pydantic model or data classes based on the schema information found.

Alternatively, it might be possible to merge the objects under paths with webhooks.

stephanschielke avatar Aug 06 '24 20:08 stephanschielke