Skip to content

Commit 35c24b9

Browse files
authored
Fix #23 - Add OpenAPI validation tests to CI (#24)
* 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
1 parent d7af765 commit 35c24b9

File tree

6 files changed

+68
-1
lines changed

6 files changed

+68
-1
lines changed

.DS_Store

-6 KB
Binary file not shown.

.github/workflows/Spectral.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Validate OpenAPI schema - Spectral
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: stoplightio/spectral-action@latest
18+
with:
19+
file_glob: 'swagger.yaml'
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Validate OpenAPI schema - editor.swagger.io
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Validate OpenAPI definition
18+
uses: char0n/swagger-editor-validate@v1
19+
with:
20+
definition-file: 'swagger.yaml'
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Validate OpenAPI schema - openapi-spec-validator
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Set up Python
18+
uses: actions/setup-python@v3
19+
with:
20+
python-version: '3.11'
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install "openapi-spec-validator"
24+
- name: Run tests
25+
run: |
26+
python -m openapi_spec_validator "swagger.yaml"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
out/
1+
.DS_Store
2+
out/

.spectral.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extends: ["spectral:oas"]

0 commit comments

Comments
 (0)