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