question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for describing OpenAPI 3.1.0 webhooks

See original GitHub issue

First Check

  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn’t find it.
  • I searched the FastAPI documentation, with the integrated search.
  • I already searched in Google “How to X in FastAPI” and didn’t find any information.
  • I already read and followed all the tutorial in the docs and didn’t find an answer.
  • I already checked if it is not related to FastAPI but to Pydantic.
  • I already checked if it is not related to FastAPI but to Swagger UI.
  • I already checked if it is not related to FastAPI but to ReDoc.

Commit to Help

  • I commit to help with one of those options 👆

Example Code

# Example taken from https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.1/webhook-example.yaml
openapi: 3.1.0
info:
  title: Webhook Example
  version: 1.0.0
# Since OAS 3.1.0 the paths element isn't necessary. Now a valid OpenAPI Document can describe only paths, webhooks, or even only reusable components
webhooks:
  # Each webhook needs a name
  newPet:
    # This is a Path Item Object, the only difference is that the request is initiated by the API provider
    post:
      requestBody:
        description: Information about a new pet in the system
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Pet"
      responses:
        "200":
          description: Return a 200 status to indicate that the data was received successfully

components:
  schemas:
    Pet:
      required:
        - id
        - name
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        tag:
          type: string

Description

I would like to be able to describe webhooks in FastAPI as described in OpenAPI 3.1 Webhooks.

References

Wanted Solution

I would like an official way to use fastapi idioms to describe these webhooks and potentially add a way to hook into the setup/orchestration of said hooks.

Wanted Code

from fastapi import FastAPI

app = FastAPI()


# Some way to describe webhooks...

Alternatives

No response

Operating System

Linux, Windows, macOS

Operating System Details

No response

FastAPI Version

0.75.0

Python Version

3.9.0

Additional Context

No response

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Kludexcommented, Aug 21, 2022

I see. It makes sense. 👍

Thanks @michaeloliverx 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Two OpenAPI 3.1 changes we love - Bump.sh
Webhooks support. This is one of the most important changes in 3.1: you can now describe webhooks provided by your API in your...
Read more >
What's New in OpenAPI 3.1 | LornaJane - Lorna Jane Mitchell
The new webhooks keyword is a top-level element, alongside paths . There are also changes to the required fields: OpenAPI 3.0 required openapi...
Read more >
OpenAPI Specification 3.1.0 Released
This new version now supports 100% compatibility with the latest draft ... New top-level element for describing Webhooks that are registered ...
Read more >
OpenAPI 3.1 - Feeling afraid of hooks? This is what GEFEG ...
The OpenAPI initiative has also regarded webhooks as so essential that they are a new document type in OpenAPI. An OpenAPI specification now...
Read more >
What's New in OpenAPI 3.1.0? - Nordic APIs
OAS 3.1.0 introduces a new top-level element to describe out-of-band webhooks. The same goes for webhooks that are externally registered.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found