Last active
September 8, 2015 08:46
-
-
Save xsenechal/afb5b7338efd5524419a to your computer and use it in GitHub Desktop.
Application wadl to CSV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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