swagger-api / swagger-api/swagger-ui

Swagger-ui doesnt work with yaml file.

Open
#5,088 3 comments 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

  • OS: [WINDOWS 10]
  • Browser: [chrome, safari]
  • docker-compose
  • Swagger-UI version: latest
  • Swagger/OpenAPI version: latest

Im trying to start swagger-ui on docker using docker-compose
i have a custom yaml file that i need to load.
i converted my yaml file into a json

swagger-ui:
image: swaggerapi/swagger-ui
container_name: "swagger-ui"
ports:
- "8888:8080"
volumes:
- ./swagger/swagger.json:/swagger.json
environment:
SWAGGER_JSON: /swagger.json
# API_URL: ""
networks:
- xdsjdh

and it works perfectly, but if i try with yaml file

swagger-ui:
image: swaggerapi/swagger-ui
container_name: "swagger-ui"
ports:
- "8888:8080"
volumes:
- ./swagger/swagger.yaml:/swagger.yaml
environment:
SWAGGER_JSON: /swagger.yaml
# API_URL: ""
networks:
- xdsjdh

when i look swagger ui page on ./swagger.yaml
i got a error message "failed to fetch /swagger.yaml"

all files are in the same directory
swagger.json and swagger.yaml

Thanks in advance.

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 issue with the provided docker-compose configuration, mounting swagger.yaml and setting SWAGGER_JSON to /swagger.yaml. Compare the YAML and JSON cases in Swagger UI and verify that the mounted YAML specification loads successfully without the “failed to fetch /swagger.yaml” error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose, javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.