From 6d508ef6905a17d269fe53532dd5009fff77ffb6 Mon Sep 17 00:00:00 2001 From: Leo Nikkilä Date: Sat, 24 Aug 2024 22:41:57 +0100 Subject: gnu: Add go-github-com-go-openapi-validate. * gnu/packages/golang-web.scm (go-github-com-go-openapi-validate): New variable. Co-authored-by: Sharlatan Hellseher Signed-off-by: Sharlatan Hellseher Change-Id: I775c1d2acdfa58f42a3898ced33f24a0a0fb2ee9 --- gnu/packages/golang-web.scm | 80 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) (limited to 'gnu/packages') diff --git a/gnu/packages/golang-web.scm b/gnu/packages/golang-web.scm index 0383becf75..b36a618e56 100644 --- a/gnu/packages/golang-web.scm +++ b/gnu/packages/golang-web.scm @@ -1660,6 +1660,86 @@ specifications knows how to deal with those.") projects.") (license license:asl2.0))) +(define-public go-github-com-go-openapi-validate + (package + (name "go-github-com-go-openapi-validate") + (version "0.24.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/go-openapi/validate") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "04inl03ha8sqqn1ccslbsl68shzf53qqk4yi88kvis0qdhcpl9fk")))) + (build-system go-build-system) + (arguments + (list + #:import-path "github.com/go-openapi/validate" + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'remove-failing-tests + (lambda* (#:key import-path #:allow-other-keys) + (with-directory-excursion (string-append "src/" import-path) + ;; Tests requiring network access. + (for-each delete-file + (list "benchmark_test.go" + "example_validator_test.go" + "doc_test.go"))))) + ;; FIXME: pattern schemas/*.json: cannot embed irregular file + ;; schemas/jsonschema-draft-04.json + ;; + ;; This happens due to Golang can't determine the valid directory of + ;; the module which is sourced during setup environment phase, but + ;; easy resolved after coping to expected directory "vendor" within + ;; the current package, see details in Golang source: + ;; + ;; - URL: + ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454 + ;; - file: src/cmd/go/internal/load/pkg.go#L2059 + (add-before 'build 'copy-input-to-vendor-directory + (lambda* (#:key import-path #:allow-other-keys) + (with-directory-excursion (string-append "src/" import-path) + (mkdir "vendor") + (copy-recursively + (string-append + #$(this-package-input "go-github-com-go-openapi-loads") + "/src/github.com") + "vendor/github.com") + (copy-recursively + (string-append + #$(this-package-input "go-github-com-go-openapi-spec") + "/src/github.com") + "vendor/github.com") + (copy-recursively + (string-append + #$(this-package-input "go-github-com-go-openapi-analysis") + "/src/github.com") + "vendor/github.com")))) + (add-before 'install 'remove-vendor-directory + (lambda* (#:key import-path #:allow-other-keys) + (with-directory-excursion (string-append "src/" import-path) + (delete-file-recursively "vendor"))))))) + (native-inputs + (list go-github-com-stretchr-testify)) + (propagated-inputs + (list go-github-com-davecgh-go-spew + go-github-com-go-openapi-analysis + go-github-com-go-openapi-errors + go-github-com-go-openapi-jsonpointer + go-github-com-go-openapi-loads + go-github-com-go-openapi-spec + go-github-com-go-openapi-strfmt + go-github-com-go-openapi-swag + go-gopkg-in-yaml-v3)) + (home-page "https://github.com/go-openapi/validate") + (synopsis "OpenAPI toolkit validation helpers") + (description + "This package provides helpers to validate Swagger 2.0 specification (aka +OpenAPI 2.0).") + (license license:asl2.0))) + (define-public go-github-com-go-webauthn-webauthn (package (name "go-github-com-go-webauthn-webauthn") -- cgit v1.2.3