Skip to content

Commit

Permalink
Fix #23 - Add OpenAPI validation tests to CI (#24)
Browse files Browse the repository at this point in the history
* Fix #23 - Add OpenAPI validation tests to CI

* Move `workflows` to `.github` directory

* Run Spectral linter

* Add linter config file

* Split validation tasks

* Add validation through the editor

* Use editor.swagger.io

* Remove .DS_Store
  • Loading branch information
lorddaedra authored Mar 13, 2023
1 parent d7af765 commit 35c24b9
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 1 deletion.
Binary file removed .DS_Store
Binary file not shown.
19 changes: 19 additions & 0 deletions .github/workflows/Spectral.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Validate OpenAPI schema - Spectral

on:
push:
branches:
- 'main'
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: stoplightio/spectral-action@latest
with:
file_glob: 'swagger.yaml'
20 changes: 20 additions & 0 deletions .github/workflows/editor-swagger-io.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Validate OpenAPI schema - editor.swagger.io

on:
push:
branches:
- 'main'
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Validate OpenAPI definition
uses: char0n/swagger-editor-validate@v1
with:
definition-file: 'swagger.yaml'
26 changes: 26 additions & 0 deletions .github/workflows/openapi-spec-validator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Validate OpenAPI schema - openapi-spec-validator

on:
push:
branches:
- 'main'
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install "openapi-spec-validator"
- name: Run tests
run: |
python -m openapi_spec_validator "swagger.yaml"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
out/
.DS_Store
out/
1 change: 1 addition & 0 deletions .spectral.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends: ["spectral:oas"]

0 comments on commit 35c24b9

Please sign in to comment.