1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6
7 # build-system
8 poetry-core,
9
10 # propagates
11 importlib-resources,
12 jsonschema,
13 jsonschema-path,
14 lazy-object-proxy,
15 openapi-schema-validator,
16
17 # tests
18 pytestCheckHook,
19 pytest-cov-stub,
20}:
21
22buildPythonPackage rec {
23 pname = "openapi-spec-validator";
24 version = "0.7.2";
25 pyproject = true;
26
27 disabled = pythonOlder "3.8";
28
29 # no tests via pypi sdist
30 src = fetchFromGitHub {
31 owner = "python-openapi";
32 repo = "openapi-spec-validator";
33 tag = version;
34 hash = "sha256-APEx7+vc824DLmdzLvhfFVrcjPxVwwUwxkh19gjXEvc=";
35 };
36
37 nativeBuildInputs = [ poetry-core ];
38
39 propagatedBuildInputs = [
40 jsonschema
41 jsonschema-path
42 lazy-object-proxy
43 openapi-schema-validator
44 ]
45 ++ lib.optionals (pythonOlder "3.9") [ importlib-resources ];
46
47 nativeCheckInputs = [
48 pytestCheckHook
49 pytest-cov-stub
50 ];
51
52 disabledTests = [
53 # network access
54 "test_default_valid"
55 "test_urllib_valid"
56 "test_valid"
57 ];
58
59 pythonImportsCheck = [
60 "openapi_spec_validator"
61 "openapi_spec_validator.readers"
62 ];
63
64 meta = with lib; {
65 changelog = "https://github.com/p1c2u/openapi-spec-validator/releases/tag/${src.tag}";
66 description = "Validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger) and OpenAPI 3.0.0 specification";
67 mainProgram = "openapi-spec-validator";
68 homepage = "https://github.com/p1c2u/openapi-spec-validator";
69 license = licenses.asl20;
70 };
71}