swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

`No operations defined in spec!` for OpenAPI 3.1 example file of `webhooks`

Open eggplants opened this issue 1 year ago • 0 comments

Q&A (please complete the following information)

  • OS: macOS
  • Browser: chrome
  • Version: 121.0.6167.85
  • Method of installation: -
  • Swagger-UI version: 5.0.0-alpha.87
  • Swagger/OpenAPI version: 3.1.0

Content & configuration

Example Swagger/OpenAPI definition: https://raw.githubusercontent.com/OAI/OpenAPI-Specification/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

Swagger-UI configuration options: -

Describe the bug you're encountering

Swagger UI says: No operations defined in spec!

To reproduce...

Steps to reproduce the behavior:

  1. Go to https://editor-next.swagger.io/
  2. Select File > Import URL
  3. Paste: https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/webhook-example.yaml
  4. See error

Expected behavior

Hide or remove No operations defined in spec!

Screenshots

image

Additional context or thoughts

I think the error is meaningless for webhook documentation written in OpenAPI.

eggplants avatar Jan 30 '24 07:01 eggplants