Gitlab Community Edition Instance

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

Merge branch 'release/1.4.0'

parents fe714d00 658304bd
No related branches found
Tags v1.5.1
No related merge requests found
Pipeline #91511 passed
project.name=https://lab.sub.uni-goettingen.de/openapi4restxq-develop
project.version=1.3.0
project.version=1.4.0
project.title=OpenAPI for RESTXQ
project.abbrev=openapi-develop
project.processorversion=4.6.1
......
......@@ -55,3 +55,19 @@ as element(test) {
<response n="1" type="application/json"/>
</test>
};
(:~
: GET Method with a path defined also for a POST in a different module
: @return xml fragment that describes request and response
: @see http://example.com/documentation/about/this
:)
declare
%rest:GET
%rest:path("/openapi-test/simple/multi-module")
function openapi-test-full:multi-post()
as element(test) {
<test>
<parameters n="0"/>
<response n="1" type="application/xml"/>
</test>
};
......@@ -168,3 +168,68 @@ declare
%rest:path("/openapi-test/simple/head")
function openapi-test-simple:head()
as empty-sequence() {()};
(:~
: All Methods Test for OpenAPI
: @return empty
: @see http://example.com/documentation/about/this
:)
declare
%rest:GET
%rest:HEAD
%rest:POST
%rest:PUT
%rest:DELETE
%rest:path("/openapi-test/simple/multi")
function openapi-test-simple:multi-methods(){
()
};
(:~
: GET Method with a path defined also for a POST in a different function
: @return xml fragment that describes request and response
: @see http://example.com/documentation/about/this
:)
declare
%rest:GET
%rest:path("/openapi-test/simple/multi-function")
function openapi-test-simple:multi-get()
as element(test) {
<test>
<parameters n="0"/>
<response n="1" type="application/xml"/>
</test>
};
(:~
: POST Method with a path defined also for a POST in a different function
: @return xml fragment that describes request and response
: @see http://example.com/documentation/about/this
:)
declare
%rest:POST("{$body}")
%rest:path("/openapi-test/simple/multi-function")
function openapi-test-simple:multi-post($body)
as element(test) {
<test>
<parameters n="0"/>
<response n="1" type="application/xml"/>
</test>
};
(:~
: POST Method with a path defined also for a POST in a different module
: @return xml fragment that describes request and response
: @see http://example.com/documentation/about/this
:)
declare
%rest:POST("{$body}")
%rest:path("/openapi-test/simple/multi-module")
function openapi-test-simple:multi-post($body)
as element(test) {
<test>
<parameters n="0"/>
<response n="1" type="application/xml"/>
</test>
};
......@@ -40,7 +40,7 @@ as map(*) {
let $test4rest := contains(util:binary-doc($module) => util:base64-decode(), "%rest:")
where $test4rest
return
inspect:inspect-module($module)
inspect:inspect-module($module)[.//annotation[@name = $openapi:supported-methods]]
let $config-uri := $target || "/openapi-config.xml"
let $config := if(doc-available($config-uri))
......@@ -129,10 +129,18 @@ as map(*) {
:)
declare %private function openapi:paths-object($module as element(module)+)
as map(*) {
let $paths := $module/function/annotation[@name = "rest:path"]/value => distinct-values()
return
map{
"paths":
map:merge((
$module/function[annotation/@name = "rest:path"] ! openapi:operation-object(.)
for $path in $paths
let $functions := $module/function[annotation[@name = "rest:path"]/value = $path]
return
map{
$path => replace("\{\$", "{"):
map:merge(($functions ! openapi:operation-object(.)))
}
))
}
};
......@@ -148,8 +156,7 @@ as map(*) {
let $deprecated := $function/deprecated
let $tags := array { $function/@name => substring-before(":") }
return
map{
$function/annotation[@name eq "rest:path"]/replace(value, "\{\$", "{") :
map:merge((
for $method in $function/annotation[@name = $openapi:supported-methods]/substring-after(lower-case(@name), "rest:")
return
map{
......@@ -166,7 +173,7 @@ as map(*) {
openapi:requestBody-object($function)
))
}
}
))
};
declare %private function openapi:requestBody-object($function as element(function))
......
......@@ -6,7 +6,7 @@
spec="1.0"
xml:id="restxqopenapi">
<title>@project.title@</title>
<dependency processor="http://exist-db.org" semver-min="@project.processorversion@"/>
<dependency processor="http://exist-db.org" semver-min="4.0.0"/>
<xquery>
<namespace>https://lab.sub.uni-goettingen.de/restxqopenapi</namespace>
<file>openapi.xqm</file>
......
......@@ -8,6 +8,16 @@
<type>application</type>
<target>openapi</target>
<changelog>
<change version="1.4.0">
<ul xmlns="http://www.w3.org/1999/xhtml">
<li class="feat">Features
<ul style="margin-left: 15px;">
<li>Support multiple method annotations</li>
<li>Support a single path mapped to different functions</li>
</ul>
</li>
</ul>
</change>
<change version="1.3.0">
<ul xmlns="http://www.w3.org/1999/xhtml">
<li class="feat">Features
......
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