Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Previewing empty paths OAS v3.1.0 #32

Open
pedrodovale opened this issue Jun 6, 2022 · 1 comment
Open

Previewing empty paths OAS v3.1.0 #32

pedrodovale opened this issue Jun 6, 2022 · 1 comment

Comments

@pedrodovale
Copy link

When trying to preview the documentation for an OpenAPI Document complying to the version 3.1.0 of the spec with empty paths, an error is shown.

Can you please check this? Thanks in advance.

How to reproduce

The OpenAPI Document I'm trying to render:

openapi: 3.1.0
info:
  title: Book Shelf API
  description: An API to keep track of Books
  version: "0.1"
  contact:
    name: API Designer
  license:
    url: https://opensource.org/licenses/MIT
    name: MIT
servers:
  - url: http://api.bookshelf.com
paths: {}

Expected Behavior

The API metadata is rendered.

Actual Behavior

This error is show:

Something went wrong...
Cannot read properties of undefined (reading 'type')
Stack trace
(...)

More context

According to the spec, a document with an empty paths is a valid one:

The Paths MAY be empty, due to Access Control List (ACL) constraints.

(source: https://spec.openapis.org/oas/v3.1.0#paths-object)

Leaving the paths empty can be useful for API Designers that want to describe only the contact information or the API Security requirements.

The Redoc Interactive Demo seems to handle this correctly, rendering the API metadata.

@tatomyr
Copy link
Contributor

tatomyr commented Jun 7, 2022

Thank you @pedrodovale for notifying!
Additional context: to reproduce the case I had to put a change to the definition (otherwise only blank screen is shown).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants