-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
796 additions
and
716 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
default_stages: [commit, push] | ||
default_language_version: | ||
# force all unspecified python hooks to run python3 | ||
python: python3 | ||
minimum_pre_commit_version: "1.20.0" | ||
repos: | ||
- repo: meta | ||
hooks: | ||
- id: check-hooks-apply | ||
|
||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v2.19.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: ["--py36-plus"] | ||
|
||
- repo: local | ||
hooks: | ||
- id: flynt | ||
name: Convert to f-strings with flynt | ||
entry: flynt | ||
language: python | ||
additional_dependencies: ['flynt==0.76'] | ||
|
||
- id: black | ||
name: black | ||
entry: black | ||
language: system | ||
require_serial: true | ||
types: [python] | ||
|
||
- id: isort | ||
name: isort | ||
entry: isort | ||
args: ['--filter-files'] | ||
language: system | ||
require_serial: true | ||
types: [python] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
# -*- coding: utf-8 -*- | ||
from openapi_schema_validator._format import oas30_format_checker, \ | ||
oas31_format_checker | ||
from openapi_schema_validator._format import oas30_format_checker | ||
from openapi_schema_validator._format import oas31_format_checker | ||
from openapi_schema_validator.shortcuts import validate | ||
from openapi_schema_validator.validators import OAS30Validator, OAS31Validator | ||
from openapi_schema_validator.validators import OAS30Validator | ||
from openapi_schema_validator.validators import OAS31Validator | ||
|
||
__author__ = 'Artur Maciag' | ||
__email__ = 'maciag.artur@gmail.com' | ||
__version__ = '0.3.2' | ||
__url__ = 'https://github.com/p1c2u/openapi-schema-validator' | ||
__license__ = '3-clause BSD License' | ||
__author__ = "Artur Maciag" | ||
__email__ = "maciag.artur@gmail.com" | ||
__version__ = "0.3.2" | ||
__url__ = "https://github.com/p1c2u/openapi-schema-validator" | ||
__license__ = "3-clause BSD License" | ||
|
||
__all__ = [ | ||
'validate', | ||
'OAS30Validator', | ||
'oas30_format_checker', | ||
'OAS31Validator', | ||
'oas31_format_checker', | ||
"validate", | ||
"OAS30Validator", | ||
"oas30_format_checker", | ||
"OAS31Validator", | ||
"oas31_format_checker", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
from jsonschema._types import ( | ||
TypeChecker, is_array, is_bool, is_integer, | ||
is_object, is_number, draft202012_type_checker, | ||
) | ||
from typing import Any | ||
|
||
from jsonschema._types import TypeChecker | ||
from jsonschema._types import draft202012_type_checker | ||
from jsonschema._types import is_array | ||
from jsonschema._types import is_bool | ||
from jsonschema._types import is_integer | ||
from jsonschema._types import is_number | ||
from jsonschema._types import is_object | ||
|
||
|
||
def is_string(checker, instance): | ||
def is_string(checker: TypeChecker, instance: Any) -> bool: | ||
return isinstance(instance, (str, bytes)) | ||
|
||
|
||
oas30_type_checker = TypeChecker( | ||
{ | ||
u"string": is_string, | ||
u"number": is_number, | ||
u"integer": is_integer, | ||
u"boolean": is_bool, | ||
u"array": is_array, | ||
u"object": is_object, | ||
"string": is_string, | ||
"number": is_number, | ||
"integer": is_integer, | ||
"boolean": is_bool, | ||
"array": is_array, | ||
"object": is_object, | ||
}, | ||
) | ||
oas31_type_checker = draft202012_type_checker |
Oops, something went wrong.