Skip to content

Instantly share code, notes, and snippets.

@verma
Last active April 18, 2018 01:35
Show Gist options
  • Save verma/e918834d93484d7d5c36cd2492c1b30b to your computer and use it in GitHub Desktop.
Save verma/e918834d93484d7d5c36cd2492c1b30b to your computer and use it in GitHub Desktop.
(ns ramlpg.core
(:import [org.raml.v2.api RamlModelBuilder]
[org.raml.v2.internal.impl.commons.model.type
TypeDeclaration
FileTypeDeclaration
ArrayTypeDeclaration ObjectTypeDeclaration]))
(defn parse-raml [raml-resource]
(let [api (.buildApi (RamlModelBuilder.) raml-resource)]
(println (.isVersion10 api))
(println (.isVersion08 api))
(println (.hasErrors api))
(.getApiV10 api)))
(defonce api (parse-raml "resources/api.raml"))
;; relevant part of the code
(doseq [s (seq (.types api))]
(println s)
(println (type s))
(println (instance? FileTypeDeclaration s)))
#object[com.sun.proxy.$Proxy10 0x56e1b91a org.raml.v2.internal.impl.commons.model.type.FileTypeDeclaration@2f929b72]
com.sun.proxy.$Proxy10
false
#object[com.sun.proxy.$Proxy10 0x565d5a5c org.raml.v2.internal.impl.commons.model.type.FileTypeDeclaration@4a7bd89a]
com.sun.proxy.$Proxy10
false
#object[com.sun.proxy.$Proxy11 0x5eb7d0da org.raml.v2.internal.impl.commons.model.type.UnionTypeDeclaration@772d192]
com.sun.proxy.$Proxy11
false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment