add swagger validator workflow

This commit is contained in:
bymyself 2025-05-21 21:15:41 -07:00
parent e8a92e4c9b
commit d65ad9940b

View File

@ -0,0 +1,49 @@
name: Validate OpenAPI
on:
push:
branches: [ master ]
paths:
- 'openapi.yaml'
pull_request:
branches: [ master ]
paths:
- 'openapi.yaml'
jobs:
openapi-check:
runs-on: ubuntu-latest
# Service containers to run with `runner-job`
services:
# Label used to access the service container
swagger-editor:
# Docker Hub image
image: swaggerapi/swagger-editor
ports:
# Maps port 8080 on service container to the host 80
- 80:8080
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate OpenAPI definition
uses: swaggerexpert/swagger-editor-validate@v1
with:
definition-file: openapi.yaml
swagger-editor-url: http://localhost/
default-timeout: 20000
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install test dependencies
run: |
pip install -r tests-api/requirements.txt
- name: Run OpenAPI spec validation tests
run: |
pytest tests-api/test_spec_validation.py -v