Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn- schema->type
- [schema]
- (let [types (concat
- (m/search schema
- {"format" "date-time"} :db.type/instant
- {"format" "uri"} :db.type/uri
- {"type" "array"} '(Array nil)
- {"type" "boolean"} :db.type/boolean
- {"type" "integer"} :db.type/long
- {"type" "string"} :db.type/string
- {"items" (m/pred some? ?item)} (list 'Array (schema->type ?item))
- {"$ref" (m/pred some? ?ref)} (if (= ?ref "#uuid")
- :db.type/uuid
- (subs ?ref 1)))
- (map schema->type (get schema "allOf")))]
- (reduce narrower-type nil types)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement