Redocly / Redocly/redoc

Does not work with data URLs

Open
#2,775 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Bug
Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

Describe the bug
I thought I could quickly share work in progress schema by embedding it into base64 encoded data uri but unfortunately that didn't work.

openapi: 3.1.0
info:
  title: My Minimal API
  version: 1.0.0
paths: {}
open "$(printf "https://redocly.github.io/redoc/?nocors&url=data:;base64," && pbpaste | base64)"

Expected behavior
Redocly shows the spec from clipboard

Minimal reproducible OpenAPI snippet(if possible)

https://redocly.github.io/redoc/?nocors&url=data:;base64,b3BlbmFwaTogMy4xLjAKaW5mbzoKICB0aXRsZTogTXkgTWluaW1hbCBBUEkKICB2ZXJzaW9uOiAxLjAuMApwYXRoczoge30K

Generated from:

printf "https://redocly.github.io/redoc/?nocors&url=data:;base64," && cat << EOT | base64
openapi: 3.1.0
info:
  title: My Minimal API
  version: 1.0.0
paths: {}
EOT

Screenshots

Something went wrong...
i.lstatSync is not a function
Stack trace
Error: i.lstatSync is not a function
    at Object.<anonymous> (https://redocly.github.io/redoc/redoc-demo.bundle.js:2:33012)
    at Generator.next (<anonymous>)
    at https://redocly.github.io/redoc/redoc-demo.bundle.js:2:30967
    at new Promise (<anonymous>)
    at https://redocly.github.io/redoc/redoc-demo.bundle.js:2:30712
    at Object.loadExternalRef (https://redocly.github.io/redoc/redoc-demo.bundle.js:2:32614)
    at Object.<anonymous> (https://redocly.github.io/redoc/redoc-demo.bundle.js:2:33529)
    at Generator.next (<anonymous>)
    at https://redocly.github.io/redoc/redoc-demo.bundle.js:2:30967
    at new Promise (<anonymous>)

ReDoc Version: 2.5.0
Commit: 00bc6edf

Additional context
I disabled cors but redocly could be smart enough to do that for data urls.

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 with the minimal reproducible data URL in the issue and inspect the external-loading path represented by redoc-demo.bundle.js, where the lstatSync error occurs. Done means the embedded base64 OpenAPI document renders in ReDoc when opened through the supplied URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
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.