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