2

I have an OpenAPI yaml file that I have built in the Swagger Editor tool. I would now like to build a static site that looks exactly the same as that.

I would like to incorporate this into a Gitlab CI/CD pipeline so that any changes are automatically updated.

Currently, I am using the redoc-cli and I really don't like the way it looks. Also, there is no "Try it out" functionality.

I have been searching all day for the necessary components to build that static site, but there do not seem to be any concrete answers.

I am currently build my GitLab Pages site like this:

 pages:
  stage: deploy
  script:
  - mkdir ~/.npm-global
  - npm config set prefix '~/.npm-global'
  - echo "export PATH=~/.npm-global/bin:$PATH" > ~/.profile
  - source ~/.profile
  - npm install -g redoc-cli --verbose
  - redoc-cli bundle -o public/index.html swagger.yaml
  artifacts:
    paths:
    - public
  only:
  - master
danielnelz
  • 3,794
  • 4
  • 25
  • 35
  • _"I would now like to build a static site that looks exactly the same as that."_ Check out Swagger UI. Take the static [`dist`](https://github.com/swagger-api/swagger-ui/tree/master/dist) assets and change the `url` in `index.html` to point to your OpenAPI YAML/JSON file. See [Plain old HTML/CSS/JS installation](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/installation.md#plain-old-htmlcssjs-standalone) – Helen Jun 23 '21 at 10:03
  • Hey Helen. Per your suggestion, I am trying Swagger UI again. However, when i put my yaml file in the same dist directory as the index.html file.. then point the 'url' to that file (./my-swagger-file.yaml), then open index.html.. the page throws this error like it is trying to make a call somewhere else for the file: Fetch error NetworkError when attempting to fetch resource. ./my-swagger-file.yaml –  Jun 23 '21 at 12:35
  • What's the full error message on the Console tab in browser dev tools? – Helen Jun 23 '21 at 13:23

0 Answers0