Gitlab Community Edition Instance

Skip to content
Snippets Groups Projects
Commit aa2f4776 authored by Mathias Goebel's avatar Mathias Goebel
Browse files

refine requestBody

parent 63689a3b
No related branches found
No related tags found
No related merge requests found
......@@ -146,7 +146,7 @@ as map(*) {
let $tags := array { $function/@name => substring-before(":") }
return
map{
$function/annotation[@name = "rest:path"]/replace(value, "\{\$", "{") :
$function/annotation[@name eq "rest:path"]/replace(value, "\{\$", "{") :
for $method in $function/annotation[@name = $openapi:supported-methods]/substring-after(lower-case(@name), "rest:")
return
map{
......@@ -159,12 +159,38 @@ as map(*) {
"description": "the official documentation by the maintainer or a thrid-party documentation"}},
$deprecated ! map{"deprecated": true()},
openapi:parameter-object($function),
openapi:responses-object($function)
openapi:responses-object($function),
openapi:requestBody-object($function)
))
}
}
};
declare %private function openapi:requestBody-object($function as element(function))
as map(*)? {
if(not(exists($function/annotation[@name = ("rest:POST", "rest:PUT")]/value))) then () else
let $name := replace($function/annotation[@name = ("rest:POST", "rest:PUT")]/value, "\{|\}|\$", "")
let $desc := string($function/argument[@var eq $name])
let $example := string(($function/annotation[@name="test:arg"][value[1] eq $name])[1]/value[2])
return
map{
"requestBody": map{
"description": "Value to process as variable: $" || $name,
"content": map{
"application/xml": map{
"examples": map{
$name: map{
"summary": $desc,
"value": serialize($example)
}
}
}
},
"required": true()
}
}
};
(:~
: Prepare OAS3 Response Object.
: @see https://swagger.io/specification/#responsesObject
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment