Gitlab Community Edition Instance

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

Merge branch 'bugfix/#1-mediaType' into 'develop'

fix: consider array for %rest:produces

Closes #1

See merge request subugoe/openapi4restxq!1
parents 15957d11 988974e4
No related branches found
No related tags found
No related merge requests found
project.name=https://lab.sub.uni-goettingen.de/openapi4restxq-develop
project.version=1.5.2
project.version=1.6.0
project.title=OpenAPI for RESTXQ
project.abbrev=openapi-develop
project.processorversion=4.6.1
......
......@@ -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"]),
$function/annotation[@name="rest:produces"]/string(value),
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))
)
};
(:~
......
......@@ -8,6 +8,15 @@
<type>application</type>
<target>openapi</target>
<changelog>
<change version="1.6.0">
<ul xmlns="http://www.w3.org/1999/xhtml">
<li class="bugs">Bugfix
<ul style="margin-left: 15px;">
<li>fix incorrect array parsing of %rest:produces</li>
</ul>
</li>
</ul>
</change>
<change version="1.5.2">
<ul xmlns="http://www.w3.org/1999/xhtml">
<li class="bugs">Bugfix
......
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