swagger-api / swagger-api/swagger-ui

How can I add a custom layout for SwaggerUI

Open
#10,054 1 comment 0 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

I have installed Swagger-UI-dist and after this wanted to add custom layout. In the docs there is a script, that I was searching for, but it's not working. Tried to add script on swagger-initializer.js, but there was a problem with React import. After that I found some information about system object and system.React reference for using React, but I can't get this system object into swagger-initializer.js. I haven't work with React before and don't know6 what the problem is. Can someone help me and answer, what am I doing incorrect.

  • OS: macOS
  • Browser: safari
  • Version: 22
  • Method of installation: dist assets
  • Swagger-UI version: 3.10.0
  • Swagger/OpenAPI version: OpenAPI 3.1
Снимок экрана 2024-07-02 в 17 34 11 Снимок экрана 2024-07-02 в 17 36 40

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 Swagger-UI dist assets and the referenced swagger-initializer.js script, then review how the documented custom-layout example uses the system object and React reference. Reproduce the React import problem in the reported Swagger-UI 3.10.0 setup. Done means a custom layout loads successfully without the initializer error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.