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