summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeo Nikkilä <hello@lnikki.la>2024-08-24 22:28:19 +0100
committerSharlatan Hellseher <sharlatanus@gmail.com>2024-08-25 20:46:48 +0100
commite7bdf27d9843c233dc124a25a5e2438f72469a52 (patch)
treee8cbb9c5f880affcbeba8298ddd85d2e2a3ff491
parent1a9765284e52a29dc853c43989dfe364b05bf436 (diff)
downloadguix-e7bdf27d9843c233dc124a25a5e2438f72469a52.tar.gz
gnu: Add go-github-com-go-openapi-loads.
* gnu/packages/golang-web.scm (go-github-com-go-openapi-loads): New
variable.

Co-authored-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Change-Id: If5c3d479064ae04e01035c7c7ff1b61acb406749
-rw-r--r--gnu/packages/golang-web.scm63
1 files changed, 63 insertions, 0 deletions
diff --git a/gnu/packages/golang-web.scm b/gnu/packages/golang-web.scm
index 91b3291b53..0383becf75 100644
--- a/gnu/packages/golang-web.scm
+++ b/gnu/packages/golang-web.scm
@@ -1502,6 +1502,69 @@ prototyped in @url{https://github.com/xeipuuv/gojsonpointer}.")
 prototyped in @url{https://github.com/xeipuuv/gojsonreference}.")
     (license license:asl2.0)))
 
+(define-public go-github-com-go-openapi-loads
+  (package
+    (name "go-github-com-go-openapi-loads")
+    (version "0.22.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/go-openapi/loads")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0qlcpdlm4y4v9r2r533aqvrc86b67nj31gsz29x9ilr7smr5299d"))))
+    (build-system go-build-system)
+    (arguments
+     (list
+      #:import-path "github.com/go-openapi/loads"
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; 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: <https://github.com/golang/go/blob/>
+          ;; - 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-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-go-openapi-analysis
+           go-github-com-go-openapi-spec
+           go-github-com-go-openapi-swag
+           go-gopkg-in-yaml-v3))
+    (home-page "https://github.com/go-openapi/loads")
+    (synopsis "Load OAI specification documents")
+    (description
+     "This package implements functionality of loading of @acronym{OpenAPI
+Initiative,OAI} specification documents from local or remote locations.
+Supports JSON and YAML documents.")
+    (license license:asl2.0)))
+
 (define-public go-github-com-go-openapi-spec
   (package
     (name "go-github-com-go-openapi-spec")