swagger-api / swagger-api/swagger-ui

Warnings are occurred at <tbody> of server variables

Open
#5,788 0 comments 2 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: Windows 10
  • Browser: Google Chrome
  • Version: Version 79.0.3945.117 (Official Build) (64-bit)
  • Method of installation: npm install swagger-ui-react
  • Swagger-UI version: swagger-ui-react@3.24.3, swagger-ui@3.24.3
  • Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration

I used SwaggerUI component with the url of definition that includes server variables.

<SwaggerUI url="https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/uspto.yaml" />
Describe the bug you're encountering
To reproduce...

Install swagger-ui-react

npx create-react-app sample-project
cd sample-project
npm install swagger-ui-react

Replace src/App.js's code to below and run it.

import React from "react"
import SwaggerUI from "swagger-ui-react"
import "swagger-ui-react/swagger-ui.css"
 
export default App = () => <SwaggerUI url="https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/uspto.yaml" />
npm start

Then, some warnings have occurred on the browser's console. See the screenshot below.

Warning: Using Maps as children is unsupported and will likely yield unexpected results. Convert it to a sequence/iterable of keyed ReactElements instead.
Warning: validateDOMNesting(...): Text nodes cannot appear as a child of <tbody>.

And the incorrect text node is shown under <tbody> like this. See the screenshot below.

...
<table>
  <tbody>
    scheme
    <tr>
      <td>scheme</td>
      ...
Expected behavior
  • No warning on the browser's console.
  • Any text node doesn't appear as a child of <tbody>.
Screenshots

image
image

Additional context or thoughts

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 src/App.js reproduction using the SwaggerUI component and the linked USPTO OpenAPI definition containing server variables. Run the sample with npm start and inspect the browser console and rendered tbody. Done means the Map and DOM-nesting warnings are gone and no stray text node appears under tbody.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.