Skip to content

Commit

Permalink
Add specs for get public object-url
Browse files Browse the repository at this point in the history
  • Loading branch information
MikelElizondo committed Mar 18, 2024
1 parent fef0863 commit 14fb6a2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/dev/gethop/object_storage/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
(s/def ::error-details map?)
(s/def ::url (s/or :string string? :url #(instance? java.net.URL %)))
(s/def ::method #{:create :read :update :delete})
(s/def ::object-public-url? boolean?)
(s/def ::filename string?)
(s/def ::content-type string?)
(s/def ::content-disposition #{:attachment :inline})
Expand Down Expand Up @@ -43,13 +44,13 @@
(defmethod get-object-url-opts :default [{:keys [content-type content-disposition]}]
(cond
content-type
(s/keys :req-un [::filename ::content-type] :opt-un [::content-disposition ::method])
(s/keys :req-un [::filename ::content-type] :opt-un [::content-disposition ::method ::object-public-url?])

content-disposition
(s/keys :req-un [::filename ::content-disposition] :opt-un [::content-type ::method])
(s/keys :req-un [::filename ::content-disposition] :opt-un [::content-type ::method ::object-public-url?])

:else
(s/keys :opt-un [::method ::filename])))
(s/keys :opt-un [::method ::filename ::object-public-url?])))

(s/def ::get-object-url-opts (s/multi-spec get-object-url-opts :default))

Expand Down

0 comments on commit 14fb6a2

Please sign in to comment.