mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
✨ Add better type references naming on openapi output
This commit is contained in:
@@ -200,7 +200,34 @@
|
||||
(if (::embed options)
|
||||
result
|
||||
(if-let [ref (m/-ref schema)]
|
||||
(let [rkey (str/concat (str/camel (namespace ref)) "$" (name ref))]
|
||||
(let [nname (namespace ref)
|
||||
tname (name ref)
|
||||
tname (str/capital (str/camel tname))
|
||||
|
||||
nname (cond
|
||||
(or (= nname "app.common.schema")
|
||||
(= nname "app.common.time")
|
||||
(= nname "app.common.features"))
|
||||
""
|
||||
|
||||
(= nname "datoteka.fs")
|
||||
"Filesystem"
|
||||
|
||||
(str/starts-with? nname "app.common.geom")
|
||||
(-> (str/replace nname #"app\.common\.geom\.\w+" "geom")
|
||||
(str/camel)
|
||||
(str/capital))
|
||||
|
||||
(str/starts-with? nname "app.")
|
||||
(-> (subs nname 4)
|
||||
(str/camel)
|
||||
(str/capital))
|
||||
|
||||
:else
|
||||
(str/capital (str/camel nname)))
|
||||
|
||||
rkey (str nname tname)]
|
||||
|
||||
(some-> *definitions* (swap! assoc rkey result))
|
||||
{"$ref" (str/concat defpath rkey)})
|
||||
result))))
|
||||
|
||||
Reference in New Issue
Block a user