Gitlab Community Edition Instance

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

Merge branch 'release/1.6.0' into main

parents 99e85095 074604ef
No related branches found
Tags v1.6.0
No related merge requests found
Pipeline #168705 passed
...@@ -7,7 +7,7 @@ stages: ...@@ -7,7 +7,7 @@ stages:
build-develop: build-develop:
except: except:
- master - main
- tags - tags
stage: build stage: build
script: script:
...@@ -18,12 +18,12 @@ build-develop: ...@@ -18,12 +18,12 @@ build-develop:
- build/*.xar - build/*.xar
- test/ - test/
build-master: build-main:
only: only:
- master - main
stage: build stage: build
script: script:
- cp master.build.properties local.build.properties - cp main.build.properties local.build.properties
- npm install - npm install
- ant test - ant test
artifacts: artifacts:
...@@ -52,7 +52,7 @@ installation: ...@@ -52,7 +52,7 @@ installation:
upload: upload:
only: only:
- master - main
- develop - develop
except: except:
- tags - tags
......
project.name=https://lab.sub.uni-goettingen.de/openapi4restxq-develop project.name=https://lab.sub.uni-goettingen.de/openapi4restxq-develop
project.version=1.5.1 project.version=1.6.0
project.title=OpenAPI for RESTXQ project.title=OpenAPI for RESTXQ
project.abbrev=openapi-develop project.abbrev=openapi-develop
project.processorversion=4.6.1 project.processorversion=4.6.1
......
...@@ -23,20 +23,20 @@ declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; ...@@ -23,20 +23,20 @@ declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
: @see http://example.com/documentation/about/this : @see http://example.com/documentation/about/this
:) :)
declare declare
%rest:POST("{$body}") %rest:POST("{$body}")
%rest:consumes("application/xml", "text/xml") %rest:consumes("application/xml", "text/xml")
%rest:path("/openapi-test/full/post/{$paramPath}/{$int}.{$format}") %rest:path("/openapi-test/full/post/{$paramPath}/{$int}.{$format}")
%rest:query-param("getParam", "{$getParam}", "2019") %rest:query-param("getParam", "{$getParam}", "2019")
%rest:produces("application/json") %rest:produces("application/xml" ,"text/xml")
%output:method("json") %output:method("json")
%test:arg("paramPath", "here") %test:arg("paramPath", "here")
%test:arg("int", "123") %test:arg("int", "123")
%test:arg("format", "xquery") %test:arg("format", "xquery")
%test:arg("getParam", "and-get") %test:arg("getParam", "and-get")
%test:arg("body", "<incomming><node/></incomming>") %test:arg("body", "<incoming><node/></incoming>")
function openapi-test-full:post( function openapi-test-full:post(
$paramPath as xs:string, $paramPath as xs:string,
$int as xs:int, $int as xs:int,
......
...@@ -17,7 +17,7 @@ declare namespace repo="http://exist-db.org/xquery/repo"; ...@@ -17,7 +17,7 @@ declare namespace repo="http://exist-db.org/xquery/repo";
declare %private variable $openapi:supported-methods := ("rest:GET", "rest:HEAD", "rest:POST", "rest:PUT", "rest:DELETE"); declare %private variable $openapi:supported-methods := ("rest:GET", "rest:HEAD", "rest:POST", "rest:PUT", "rest:DELETE");
(:~ (:~
: Prepares a JSON document usually to be stored as "openapi.json". : Prepares a JSON document conform to OpenAPI 3.0.2, usually to be stored as "openapi.json".
: @param $target the collection to prepare the descriptor for, e.g. “/db/apps/application” : @param $target the collection to prepare the descriptor for, e.g. “/db/apps/application”
: :) : :)
declare function openapi:json($target as xs:string) declare function openapi:json($target as xs:string)
...@@ -34,7 +34,7 @@ as xs:string { ...@@ -34,7 +34,7 @@ as xs:string {
:) :)
declare function openapi:main($target as xs:string) declare function openapi:main($target as xs:string)
as map(*) { as map(*) {
let $modules-uris := collection($target)[ends-with(base-uri(), ".xqm")]/base-uri() let $modules-uris := collection($target)[openapi:xquery-resource(string(base-uri()))]/base-uri()
let $module := let $module :=
for $module in $modules-uris for $module in $modules-uris
let $test4rest := contains(util:binary-doc($module) => util:base64-decode(), "%rest:") let $test4rest := contains(util:binary-doc($module) => util:base64-decode(), "%rest:")
...@@ -174,7 +174,7 @@ as map(*) { ...@@ -174,7 +174,7 @@ as map(*) {
$method: $method:
map:merge(( map:merge((
map{ "summary": $desc[1]}, map{ "summary": $desc[1]},
map{ "description": $desc[2]}, $desc[2] ! map{ "description": .},
map{ "tags": $tags}, map{ "tags": $tags},
$see[1] ! map{"externalDocs": $see ! map{ $see[1] ! map{"externalDocs": $see ! map{
"url": ., "url": .,
...@@ -316,15 +316,19 @@ as map(*)* { ...@@ -316,15 +316,19 @@ as map(*)* {
declare %private function openapi:mediaType-object($function) declare %private function openapi:mediaType-object($function)
as map(*) { as map(*) {
let $produces := ( 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:media-type"]),
string($function/annotation[@name="output:method"]/openapi:method-mediaType(string(.))), string($function/annotation[@name="output:method"]/openapi:method-mediaType(string(.))),
"application/xml" "application/xml"
) )
return return
map{ map:merge(
$produces[. != ""][1]: openapi:schema-object($function/returns) for $iii in 1 to count($produces) return
} if($produces[$iii] = "") then
()
else
map:entry($produces[$iii], openapi:schema-object($function/returns))
)
}; };
(:~ (:~
...@@ -410,3 +414,10 @@ as map(*)* { ...@@ -410,3 +414,10 @@ as map(*)* {
string(($function/annotation[@name = "test:arg"][value[1] eq $name])[1]/value[2]) string(($function/annotation[@name = "test:arg"][value[1] eq $name])[1]/value[2])
! map{ "example": .} ! map{ "example": .}
}; };
declare function openapi:xquery-resource($baseuri as xs:string)
as xs:boolean {
ends-with($baseuri, ".xqm")
or ends-with($baseuri, ".xql")
or ends-with($baseuri, ".xq")
};
File moved
...@@ -8,9 +8,27 @@ ...@@ -8,9 +8,27 @@
<type>application</type> <type>application</type>
<target>openapi</target> <target>openapi</target>
<changelog> <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
<ul style="margin-left: 15px;">
<li>omit “null” on description</li>
</ul>
</li>
</ul>
</change>
<change version="1.5.1"> <change version="1.5.1">
<ul xmlns="http://www.w3.org/1999/xhtml"> <ul xmlns="http://www.w3.org/1999/xhtml">
<li class="bugs">Bugfixes <li class="bugs">Bugfix
<ul style="margin-left: 15px;"> <ul style="margin-left: 15px;">
<li>bugfix for string() call with multiple test annotations</li> <li>bugfix for string() call with multiple test annotations</li>
</ul> </ul>
......
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