0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00

📎 Add additional reformating to specs naming

This commit is contained in:
Andrey Antukh 2022-08-01 15:01:03 +02:00
parent d54ebaa0d7
commit abfca5c89a
8 changed files with 23 additions and 25 deletions

View file

@ -84,7 +84,7 @@
;; a server prop key where initial project is stored.
:initial-project-skey "initial-project"})
(s/def ::flags ::us/vec-of-keywords)
(s/def ::flags ::us/vec-of-valid-keywords)
;; DEPRECATED PROPERTIES
(s/def ::telemetry-enabled ::us/boolean)
@ -93,7 +93,7 @@
(s/def ::audit-log-archive-uri ::us/string)
(s/def ::audit-log-gc-max-age ::dt/duration)
(s/def ::admins ::us/set-of-str)
(s/def ::admins ::us/set-of-non-empty-strings)
(s/def ::file-change-snapshot-every ::us/integer)
(s/def ::file-change-snapshot-timeout ::dt/duration)
@ -128,8 +128,8 @@
(s/def ::oidc-token-uri ::us/string)
(s/def ::oidc-auth-uri ::us/string)
(s/def ::oidc-user-uri ::us/string)
(s/def ::oidc-scopes ::us/set-of-str)
(s/def ::oidc-roles ::us/set-of-str)
(s/def ::oidc-scopes ::us/set-of-non-empty-strings)
(s/def ::oidc-roles ::us/set-of-non-empty-strings)
(s/def ::oidc-roles-attr ::us/keyword)
(s/def ::oidc-email-attr ::us/keyword)
(s/def ::oidc-name-attr ::us/keyword)
@ -165,7 +165,7 @@
(s/def ::profile-complaint-threshold ::us/integer)
(s/def ::public-uri ::us/string)
(s/def ::redis-uri ::us/string)
(s/def ::registration-domain-whitelist ::us/set-of-str)
(s/def ::registration-domain-whitelist ::us/set-of-non-empty-strings)
(s/def ::rlimit-font ::us/integer)
(s/def ::rlimit-file-update ::us/integer)
(s/def ::rlimit-image ::us/integer)

View file

@ -29,7 +29,7 @@
(defn coerce-id
[id]
(let [res (us/uuid-conformer id)]
(let [res (parse-uuid id)]
(when-not (uuid? res)
(ex/raise :type :not-found
:hint "object not found"))

View file

@ -9,7 +9,6 @@
(:require
[app.common.exceptions :as ex]
[app.common.pprint :as pp]
[app.common.spec :as us]
[app.common.uuid :as uuid]
[app.config :as cf]
[app.db :as db]
@ -205,7 +204,7 @@
[{:keys [pool]} request]
(letfn [(parse-id [request]
(let [id (get-in request [:path-params :id])
id (us/uuid-conformer id)]
id (parse-uuid id)]
(when (uuid? id)
id)))

View file

@ -353,7 +353,7 @@
(declare create-team-invitation)
(s/def ::email ::us/email)
(s/def ::emails ::us/set-of-emails)
(s/def ::emails ::us/set-of-valid-emails)
(s/def ::invite-team-member
(s/keys :req-un [::profile-id ::team-id ::role]
:opt-un [::email ::emails]))
@ -443,7 +443,7 @@
;; --- Mutation: Create Team & Invite Members
(s/def ::emails ::us/set-of-emails)
(s/def ::emails ::us/set-of-valid-emails)
(s/def ::create-team-and-invite-members
(s/and ::create-team (s/keys :req-un [::emails ::role])))

View file

@ -133,7 +133,7 @@
(dm/str v))]
(s/def ::rgb-color-str (s/conformer conformer unformer)))
;; --- SPEC: set of Keywords
;; --- SPEC: set/vec of valid Keywords
(letfn [(conform-fn [dest s]
(let [xform (keep (fn [s]
@ -146,17 +146,17 @@
(string? s) (into dest xform (str/words s))
:else ::s/invalid)))]
(s/def ::set-of-keywords
(s/def ::set-of-valid-keywords
(s/conformer
(fn [s] (conform-fn #{} s))
(fn [s] (str/join " " (map name s)))))
(s/def ::vec-of-keywords
(s/def ::vec-of-valid-keywords
(s/conformer
(fn [s] (conform-fn [] s))
(fn [s] (str/join " " (map name s))))))
;; --- SPEC: set-of-emails
;; --- SPEC: set-of-valid-emails
(letfn [(conformer [v]
(cond
@ -171,9 +171,9 @@
:else ::s/invalid))
(unformer [v]
(str/join " " v))]
(s/def ::set-of-emails (s/conformer conformer unformer)))
(s/def ::set-of-valid-emails (s/conformer conformer unformer)))
;; --- SPEC: set-of-str
;; --- SPEC: set-of-non-empty-strings
(def non-empty-strings-xf
(comp
@ -189,7 +189,7 @@
:else ::s/invalid))
(unformer [s]
(str/join "," s))]
(s/def ::set-of-str (s/conformer conformer unformer)))
(s/def ::set-of-non-empty-strings (s/conformer conformer unformer)))
;; --- SPECS WITHOUT CONFORMER
@ -200,7 +200,6 @@
(s/def ::fn fn?)
(s/def ::id ::uuid)
;; NOTE: this is a coercerless version of `::set-of-str` spec
(s/def ::set-of-string (s/every ::string :kind set?))
(s/def ::coll-of-uuid (s/every ::uuid))
(s/def ::set-of-uuid (s/every ::uuid :kind set?))

View file

@ -452,9 +452,9 @@
(defn invite-team-members
[{:keys [emails role team-id resend?] :as params}]
(us/assert ::us/set-of-emails emails)
(us/assert ::us/keyword role)
(us/assert ::us/uuid team-id)
(us/assert! ::us/set-of-valid-emails emails)
(us/assert! ::us/keyword role)
(us/assert! ::us/uuid team-id)
(ptk/reify ::invite-team-members
IDeref
(-deref [_] {:role role :team-id team-id :resend? resend?})

View file

@ -77,7 +77,7 @@
]
(filterv identity)))
(s/def ::emails (s/and ::us/set-of-emails d/not-empty?))
(s/def ::emails (s/and ::us/set-of-valid-emails d/not-empty?))
(s/def ::role ::us/keyword)
(s/def ::team-id ::us/uuid)

View file

@ -96,7 +96,7 @@
[{:value "editor" :label (tr "labels.editor")}
{:value "admin" :label (tr "labels.admin")}])
(s/def ::emails (s/and ::us/set-of-emails d/not-empty?))
(s/def ::emails (s/and ::us/set-of-valid-emails d/not-empty?))
(s/def ::role ::us/keyword)
(s/def ::invite-form
(s/keys :req-un [::role ::emails]))
@ -180,10 +180,10 @@
[:div.action (tr "onboarding.choice.team-up.invite-members-skip")]]]]
[:& team-modal-right]
[:div.paginator "2/2"]
[:img.deco.square {:src "images/deco-square.svg" :border "0"}]
[:img.deco.circle {:src "images/deco-circle.svg" :border "0"}]
[:img.deco.line1 {:src "images/deco-line1.svg" :border "0"}]
[:img.deco.line2 {:src "images/deco-line2.svg" :border "0"}]]]))