swagger-api / swagger-api/swagger-codegen
Validator badge misses host in path to json spec
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I compiled the validator-badge project to a war file and started it in a jetty instance on port 9091. I modified file \modules\swagger-generator\src\main\webpp\index.htm, I added the line validatorUrl: "http://localhost:9091", in the call to const ui = SwaggerUIBundle. I compiled swagger-codegen and started the war in a jetty container on port 9090. Now, I call the swagger-ui in the browser and the validator badge for the sample /api/swagger.json is red.
It is called by http://localhost:9091/?url=/api/swagger.json It seems to miss a host name in the path to the json file.
If I enter the full path http://localhost:9090/api/swagger.json into the text field and click Explore the host is cut off and I am being redirected to the page I've been before.
When I call the validator in the browser and include the host name in the URL param like http://localhost:9091/?url=http://localhost:9090/api/swagger.json I get the green badge as expected.
Is it not allowed to enter a host name in the text field? How to pass a json specification including host name?
Command line used for generation
I compiled validator-badge and codegen using this mvn call from latest head
mvn clean package -DskipTests -Dmaven.test.skip=true
I generated the files swagger-validator-1.0.5-SNAPSHOT.war and swagger-generator-2.2.3-SNAPSHOT.war
My working copy of validator is on commit c7c2d84c4aa3fe798e1dcee213fc542b920148e2
codegen commit f14d8067c45554ab7fed4d214b459a177f8b1217
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 with modules/swagger-generator/src/main/webpp/index.htm and the SwaggerUIBundle validatorUrl configuration. Reproduce the validator badge and Explore behavior using the two Jetty WARs and the sample /api/swagger.json, then trace how the validator URL parameter is handled. Done means a specification URL containing a host is preserved and produces the expected green badge.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, javascript
- Domain
- api, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100