File tree 2 files changed +48
-23
lines changed
2 files changed +48
-23
lines changed Original file line number Diff line number Diff line change 345
345
; ; Search Params
346
346
; ;
347
347
348
+ (defn distinct-by [key-fn coll]
349
+ (reduce (fn [acc item]
350
+ (if (some #(= (key-fn %) (key-fn item)) acc)
351
+ acc
352
+ (conj acc item)))
353
+ []
354
+ coll))
355
+
348
356
(defn resolve-elements [schemas resource]
349
357
(->> schemas
350
358
(filter #(contains? (set (:base %)) resource))
351
- (map :code )
352
- (distinct )
353
- (sort )))
359
+ (distinct-by :code )))
354
360
355
361
(defn convert-search-params [search-params-schemas all-schemas]
356
362
(->> all-schemas
363
369
:base (when-let [base (:base schema)]
364
370
(->pascal-case (url->resource-name base)))
365
371
:elements (->> (resolve-elements search-params-schemas (:id schema))
366
- (map (fn [el] {:type " string" :name el})))}))
372
+ (map (fn [el] {:type " string"
373
+ :name (:code el)
374
+ :target (:target el)})))}))
367
375
(remove #(and
368
376
(not= (:name %) " Base" )
369
377
(empty? (:elements %))))))
You can’t perform that action at this time.
0 commit comments