swagger-api / swagger-api/swagger-ui

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

Open
#9,530 0 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by importing the linked webhook-example.yaml URL in editor-next.swagger.io and observe how Swagger UI handles a specification containing only webhooks. Trace the code path that produces “No operations defined in spec!” and verify that webhook documentation renders without this message when the change is complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.