Skip to content

Commit

Permalink
Add a test to validate the OAS spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémy HUBSCHER committed Aug 7, 2017
1 parent e27b674 commit bd3893c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
25 changes: 15 additions & 10 deletions api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ paths:
produces:
- "application/json"
parameters:
- $ref: "#/parameters/versionId"
- $ref: "#/parameters/product"
- $ref: "#/parameters/version"
responses:
200:
"200":
description: "successful operation"
schema:
$ref: "#/definitions/existanceStatus"
Expand All @@ -55,9 +56,10 @@ paths:
produces:
- "application/json"
parameters:
- $ref: "#/parameters/versionId"
- $ref: "#/parameters/product"
- $ref: "#/parameters/version"
responses:
200:
"200":
description: "successful operation"
schema:
$ref: "#/definitions/existanceStatus"
Expand All @@ -69,9 +71,10 @@ paths:
produces:
- "application/json"
parameters:
- $ref: "#/parameters/versionId"
- $ref: "#/parameters/product"
- $ref: "#/parameters/version"
responses:
200:
"200":
description: "successful operation"
schema:
$ref: "#/definitions/existanceStatus"
Expand All @@ -83,9 +86,10 @@ paths:
produces:
- "application/json"
parameters:
- $ref: "#/parameters/versionId"
- $ref: "#/parameters/product"
- $ref: "#/parameters/version"
responses:
200:
"200":
description: "successful operation"
schema:
$ref: "#/definitions/existanceStatus"
Expand All @@ -96,9 +100,10 @@ paths:
produces:
- "application/json"
parameters:
- $ref: "#/parameters/versionId"
- $ref: "#/parameters/product"
- $ref: "#/parameters/version"
responses:
200:
"200":
description: "successful operation"
schema:
$ref: "#/definitions/existanceStatus"
Expand Down
2 changes: 2 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ pytest-cache
pytest-capturelog
pytest-cover
pytest-sugar
ruamel.yaml
swagger-spec-validator
tox
wheel
zest.releaser
12 changes: 12 additions & 0 deletions tests/test_oas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import os.path
import ruamel.yaml as yaml
from swagger_spec_validator.validator20 import validate_spec

HERE = os.path.dirname(__file__)


def test_oas_spec():
with open(os.path.join(HERE, "..", "api.yaml"), 'r') as stream:
oas_spec = yaml.load(stream)
# example for swagger spec v2.0
validate_spec(oas_spec)

0 comments on commit bd3893c

Please sign in to comment.