Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. (defn- schema->type
  2. [schema]
  3. (let [types (concat
  4. (m/search schema
  5. {"format" "date-time"} :db.type/instant
  6. {"format" "uri"} :db.type/uri
  7. {"type" "array"} '(Array nil)
  8. {"type" "boolean"} :db.type/boolean
  9. {"type" "integer"} :db.type/long
  10. {"type" "string"} :db.type/string
  11. {"items" (m/pred some? ?item)} (list 'Array (schema->type ?item))
  12. {"$ref" (m/pred some? ?ref)} (if (= ?ref "#uuid")
  13. :db.type/uuid
  14. (subs ?ref 1)))
  15. (map schema->type (get schema "allOf")))]
  16. (reduce narrower-type nil types)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement