Gitlab Community Edition Instance

Skip to content
Snippets Groups Projects
Commit 90c7f8ec authored by Michelle Weidling's avatar Michelle Weidling :herb:
Browse files

fix: consider array for %rest:produces

parent 15957d11
No related branches found
Tags v1.5.1
1 merge request!1fix: consider array for %rest:produces
Pipeline #168261 passed
......@@ -23,20 +23,20 @@ declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
: @see http://example.com/documentation/about/this
:)
declare
%rest:POST("{$body}")
%rest:consumes("application/xml", "text/xml")
%rest:path("/openapi-test/full/post/{$paramPath}/{$int}.{$format}")
%rest:query-param("getParam", "{$getParam}", "2019")
%rest:produces("application/json")
%output:method("json")
%test:arg("paramPath", "here")
%test:arg("int", "123")
%test:arg("format", "xquery")
%test:arg("getParam", "and-get")
%test:arg("body", "<incomming><node/></incomming>")
%rest:POST("{$body}")
%rest:consumes("application/xml", "text/xml")
%rest:path("/openapi-test/full/post/{$paramPath}/{$int}.{$format}")
%rest:query-param("getParam", "{$getParam}", "2019")
%rest:produces("application/xml" ,"text/xml")
%output:method("json")
%test:arg("paramPath", "here")
%test:arg("int", "123")
%test:arg("format", "xquery")
%test:arg("getParam", "and-get")
%test:arg("body", "<incoming><node/></incoming>")
function openapi-test-full:post(
$paramPath as xs:string,
$int as xs:int,
......
......@@ -316,15 +316,19 @@ as map(*)* {
declare %private function openapi:mediaType-object($function)
as map(*) {
let $produces := (
string($function/annotation[@name="rest:produces"]),
for $v in $function/annotation[@name="rest:produces"]/value return string($v),
string($function/annotation[@name="output:media-type"]),
string($function/annotation[@name="output:method"]/openapi:method-mediaType(string(.))),
"application/xml"
)
return
map{
$produces[. != ""][1]: openapi:schema-object($function/returns)
}
map:merge(
for $iii in 1 to count($produces) return
if($produces[$iii] = "") then
()
else
map:entry($produces[$iii], openapi:schema-object($function/returns))
)
};
(:~
......
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