Skip to content

Commit

Permalink
Add openapi validator
Browse files Browse the repository at this point in the history
  • Loading branch information
Yrob committed Jun 10, 2024
1 parent bc83c3c commit 46c730d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .github/workflows/test-openapi-spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Validate openapi spec

on:
push:
branches:
- features/**
pull_request:
branches:
- main
- master

jobs:
docker:
timeout-minutes: 10
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v1

- name: Start containers
run: docker compose -f "docker-compose.yml" up -d --build

- name: Setup tests
run: |
mkdir spectral
echo 'extends: ["spectral:oas", "spectral:asyncapi"]' > ./spectral/.spectral.yaml
compose exec web curl http://web:8000/v1/bag/?format=json --output ./spectral/openapi.yaml
- name: Run spectral tests
run: docker run -v ./spectral:/mnt/spectral stoplight/spectral lint /mnt/spectral/openapi.yaml --ruleset /mnt/spectral/.spectral.yaml

- name: Stop containers
if: always()
run: docker compose -f "docker-compose.yml" down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: Run Pytest

on:
push:
Expand Down

0 comments on commit 46c730d

Please sign in to comment.