swagger-api / swagger-api/swagger-ui

Plugins CheckPropTypes Failes for swagger-ui-react

Open
#7,030 0 comments 3 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:
  • Method of installation: yarn
  • Swagger-UI version: 3.35
  • Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration

Example Swagger/OpenAPI definition:

# your YAML here

Swagger-UI configuration options:

        <SwaggerUI
          url="/api/v2/openapi.yaml"
          plugins={[sidebarPlugin]}
		/>
export default function sidebarPlugin(system: any): sidebarPluginInterface {
  return {
    wrapComponents: {
      operations: (Original, system) => (props) => {
		}
	}
  }
}
Describe the bug you're encountering

The following warning/error shows in dev environment.
```Warning: Failed prop type: Invalid prop plugins[0] of type `function` supplied to `SwaggerUI`, expected `object`.

I think the PropTypes definition for plugins on the swagger-ui-react package is incorrect.

### To reproduce...

Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

### Expected behavior
<!-- A clear and concise description of what you expected to happen. -->

### Screenshots
<!-- If applicable, add screenshots to help explain your problem. -->

### Additional context or thoughts
<!-- Add any other context about the problem here. -->

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 warning with the shown swagger-ui-react configuration and function-valued sidebarPlugin. Then inspect the swagger-ui-react package's PropTypes definition for the plugins prop; done means the supplied plugin no longer triggers the reported invalid-prop warning.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.