Skip to content

Instantly share code, notes, and snippets.

@xsenechal
Last active September 8, 2015 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xsenechal/afb5b7338efd5524419a to your computer and use it in GitHub Desktop.
Save xsenechal/afb5b7338efd5524419a to your computer and use it in GitHub Desktop.
Application wadl to CSV
def parser = new XmlParser()
def result = parser.parseText("<?xml ...</application>")
def lst = []
def url = "/rest"
def url2
def url3
def httpMethod
def javaMethod
def responseType
def params
result.'resources'[0].'resource'.each{
url2 = it.@path
it.'resource'.each{r3->
url3 = r3.@path
def method = r3.'method'
httpMethod = method.@name[0]
javaMethod = method.@id[0]
responseType = method.'response'.'representation'*.@mediaType
params = ""
r3.'param'.each{
params += "(${it.@name}|${it.@type})"
}
lst << "$url$url2/$url3;$httpMethod;$javaMethod;$responseType;$params".replaceAll("//", "/")
}
}
lst.sort()
lst.add(0, "PATH;HTTP method;JAVA method;Response Type;Parameters")
println lst.join('\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment