Redocly / Redocly/redoc

Using @param annotation with body causes redoc rendering to fail

Open
#2,552 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
rodoc fails with error:

Something went wrong...
n.slice is not a function or its return value is not iterable
Stack trace
TypeError: n.slice is not a function or its return value is not iterable
    at get codeSamples (http://127.0.0.1:8001/docs:57:87280)
    at Tu.get (http://127.0.0.1:8001/docs:57:9924)
    at Vb.render (http://127.0.0.1:8001/docs:1688:133)
    at http://127.0.0.1:8001/docs:1108:5907
    at http://127.0.0.1:8001/docs:1108:5926
    at Je (http://127.0.0.1:8001/docs:18:571444)
    at t.track (http://127.0.0.1:8001/docs:18:575944)
    at Vb.<anonymous> (http://127.0.0.1:8001/docs:1108:5846)
    at t.render (http://127.0.0.1:8001/docs:1108:7803)
    at js (http://127.0.0.1:8001/docs:18:404628)

ReDoc Version: 2.1.5
Commit: 3658b6d

Minimal reproducible OpenAPI snippet(if possible)

{
    "description": "body",
     "name": "request",
     "in": "body",
      "required": true,
      "schema": {
           "type": "string"
       }
},

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 reproducing the failure in ReDoc 2.1.5 with the minimal OpenAPI parameter object shown in the issue, using the reported code-samples rendering error as the entry point. The work is done when an operation with an @param annotation and a body parameter renders without the n.slice error.

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.