/swagger-validate-container

A docker image to be used in CI validation of the OpenAPI or Swagger YAML

Primary LanguageShell

swagger-validate-container

This repository creates a container image swagger-validate that has the swagget validator in-built.

Usage

This is to be used in CI runners to validate the openapi spec yaml files or json files for the specified directory.

GitLab Example

To use in GitLab,

image: gkarthics/swagger-validate:0.2.0

before_script:
  - swagger-cli -v

swagger-validate:
  stage: deploy
  script:
    - validate <folder path for yaml or json files>

GitHub Example

To use in GitHub Actions,

name: swagger-validate
on:
  push:
    branches: [ master ]
jobs:
  build:
    container: gkarthics/swagger-validate:0.2.0
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: validate
      run: validate .

Credits

This container image uses the swagger-cli to validate the yaml files.