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}:
20
21buildPythonPackage rec {
22 pname = "openapi-spec-validator";
23 version = "0.7.1";
24 pyproject = true;
25
26 disabled = pythonOlder "3.8";
27
28 # no tests via pypi sdist
29 src = fetchFromGitHub {
30 owner = "python-openapi";
31 repo = "openapi-spec-validator";
32 tag = version;
33 hash = "sha256-X0ePdHQeBSWjsCFQgCoNloQZRhKbvPBE43aavBppvmg=";
34 };
35
36 postPatch = ''
37 sed -i '/--cov/d' pyproject.toml
38 '';
39
40 nativeBuildInputs = [ poetry-core ];
41
42 propagatedBuildInputs = [
43 jsonschema
44 jsonschema-path
45 lazy-object-proxy
46 openapi-schema-validator
47 ] ++ lib.optionals (pythonOlder "3.9") [ importlib-resources ];
48
49 nativeCheckInputs = [ pytestCheckHook ];
50
51 disabledTests = [
52 # network access
53 "test_default_valid"
54 "test_urllib_valid"
55 "test_valid"
56 ];
57
58 pythonImportsCheck = [
59 "openapi_spec_validator"
60 "openapi_spec_validator.readers"
61 ];
62
63 meta = with lib; {
64 changelog = "https://github.com/p1c2u/openapi-spec-validator/releases/tag/${version}";
65 description = "Validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger) and OpenAPI 3.0.0 specification";
66 mainProgram = "openapi-spec-validator";
67 homepage = "https://github.com/p1c2u/openapi-spec-validator";
68 license = licenses.asl20;
69 };
70}