File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 "@monaco-editor/react" : " ^4.5.0" ,
66 "@sooro-io/react-gtm-module" : " ^3.0.0" ,
77 "antd" : " ^5.18.3" ,
8+ "comment-json" : " ^4.2.5" ,
89 "fhirpath-autocomplete-ts" : " git@github.com:Aidbox/fhirpath-autocomplete-ts.git" ,
910 "react" : " ^18.2.0" ,
1011 "react-dom" : " ^18.3.1" ,
Original file line number Diff line number Diff line change 435435 {:dataLayer {:event " vd_run"
436436 :resource-type (get (:current-vd db) :resource " " )}})
437437 (let [sandbox? (settings-model/in-sandbox? db)
438+ parse (if (= :language/json (::m/language db))
439+ yaml/json-parse
440+ yaml/try-parse)
438441 view-definition (-> (::m/view-definition-code db)
439- yaml/try- parse
442+ parse
440443 (js->clj :keywordize-keys true )
441444 strip-empty-select-nodes
442445 strip-empty-where-nodes)
481484(reg-event-fx
482485 ::on-eval-view-definition-error
483486 (fn [{:keys [db]} [_ result]]
484- (prn result)
485487 {:db (assoc db ::m/eval-loading false )
486488 :notification-error (str (get-in result [:response :text :div ] " Error" ) " : "
487489 (->> (get-in result [:response :issue ])
702704
703705(defn format-vd-code [code lang]
704706 (case lang
705- :language/yaml (-> code js/JSON. parse yaml/stringify)
707+ :language/yaml (-> code yaml/json- parse yaml/stringify)
706708 :language/json (-> code yaml/str->yaml (js/JSON.stringify nil 2 ))
707709 " " ))
708710
Original file line number Diff line number Diff line change 88 [vd-designer.components.tabs :as tabs]
99 [vd-designer.pages.lists.vds.controller :as c]
1010 [vd-designer.pages.lists.vds.model :as m]
11- [vd-designer.utils.yaml :refer [str->yaml]]))
11+ [vd-designer.utils.yaml :refer [str->yaml json-parse ]]))
1212
1313(def supported-extensions
1414 [" .json" " .yaml" " .yml" ])
3434 (try
3535 (str->yaml content)
3636 (catch js/Error _
37- (js/JSON. parse content))))
37+ (json- parse content))))
3838
3939(defn parse-vd [^String content]
4040 (js->clj (try-parse-vd content) :keywordize-keys true ))
Original file line number Diff line number Diff line change 11(ns vd-designer.utils.yaml
22 (:require [" yaml" :as y]
3+ [" comment-json" :as json]
34 [clojure.string :as str]))
45
56(defn edn->yaml [edn]
1819 (try
1920 (str->yaml content)
2021 (catch js/Error _
21- (js/JSON.parse content))))
22+ nil )))
23+
24+ (defn json-parse [^String content]
25+ (try
26+ (json/parse content nil true )
27+ (catch js/Error _
28+ nil )))
You can’t perform that action at this time.
0 commit comments