1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, poetry-core
5, setuptools
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.1";
26 format = "pyproject";
27
28 # no tests via pypi sdist
29 src = fetchFromGitHub {
30 owner = "p1c2u";
31 repo = pname;
32 rev = version;
33 hash = "sha256-8VhD57dNG0XrPUdcq39GEfHUAgdDwJ8nv+Lp57OpTLg=";
34 };
35
36 nativeBuildInputs = [
37 poetry-core
38 setuptools
39 ];
40
41 propagatedBuildInputs = [
42 importlib-resources
43 jsonschema
44 jsonschema-spec
45 lazy-object-proxy
46 openapi-schema-validator
47 pyyaml
48 ];
49
50 passthru.optional-dependencies.requests = [
51 requests
52 ];
53
54 preCheck = ''
55 sed -i '/--cov/d' pyproject.toml
56 '';
57
58 checkInputs = [
59 pytestCheckHook
60 ];
61
62 disabledTests = [
63 # network access
64 "test_default_valid"
65 "test_urllib_valid"
66 "test_valid"
67 ];
68
69 pythonImportsCheck = [
70 "openapi_spec_validator"
71 "openapi_spec_validator.readers"
72 ];
73
74 meta = with lib; {
75 changelog = "https://github.com/p1c2u/openapi-spec-validator/releases/tag/${version}";
76 description = "Validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger) and OpenAPI 3.0.0 specification";
77 homepage = "https://github.com/p1c2u/openapi-spec-validator";
78 license = licenses.asl20;
79 maintainers = with maintainers; [ rvl ];
80 };
81}