swagger-api / swagger-api/swagger-ui
Error on operation display when we serve a json from blob:url
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/linux
- Browser: all
- Method of installation: yarn
- Swagger-UI version: "swagger-ui-react": "^3.46.0",
- Swagger/OpenAPI version: Swagger 2.0
Content & configuration
On ReactJS@16 app
I get a json content from API, I build it as blob url as :
export const getSwagger = async (token) => {
const { body } = await agent.get('/api/v1/documentation/swagger')
.set('Authorization', `Bearer ${token}`)
.set('Accept', 'application/json');
const swaggerJson = JSON.stringify(body);
const blob = new Blob([swaggerJson], { type: 'application/json' });
const url = window.URL.createObjectURL(blob);
return url;
};
Swagger-UI configuration options:
SwaggerUI({
url: "blob:https://localhost/<myblob id>"
})
- I get the json from API
- I build an url with blob (the json behind the blob url is correct when I copy/paste it on editor.swagger.io)
- The swagger ui load with the swagger ui interface and all possible operations
- I click on any of operation (example : POST /api/v1/pet)
- There is a call on network console to the url : blob:https//localhost:8080/
- I experienced this error :
Fetch API cannot load blob:https//localhost:8080/. URL scheme must be "http" or "https" for CORS request.
I see that the ":" in the "blob:https//" is missing from the network console error.
There is maybe a parsing url error with blob url.
Current parsing give : blob:https///
Needed result : blob:https:///
Feel free to ask more information.
Have a happy day !
MF
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the SwaggerUI configuration using the blob URL and follow the operation display request shown in the network console. Verify how the blob:https:/// URL is parsed or requested; the issue is done when operations load without the malformed blob:https// URL or CORS scheme error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100