From d7c19325cc4ae2f3a91510c7f1a72d7e13f2df46 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 19 Aug 2025 20:51:19 +0200 Subject: [PATCH] :sparkles: Add better type references naming on openapi output --- common/src/app/common/schema/openapi.cljc | 29 ++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/common/src/app/common/schema/openapi.cljc b/common/src/app/common/schema/openapi.cljc index 19ff8ca176..33e8b2561d 100644 --- a/common/src/app/common/schema/openapi.cljc +++ b/common/src/app/common/schema/openapi.cljc @@ -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))))