Gitlab Community Edition Instance

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

Merge branch 'release/1.2.0'

parents 944242e2 a5fc627b
No related branches found
Tags v1.6.0
No related merge requests found
Pipeline #91232 passed
...@@ -33,9 +33,37 @@ the file in the `autodeploy` directory or using the package manager application ...@@ -33,9 +33,37 @@ the file in the `autodeploy` directory or using the package manager application
installed by default at a running database. installed by default at a running database.
## Use ## Use
The package provides a ### Integrated in own applications
By adding the following lines to the `controller.xql` a path like
[/myApplication/openapi/index.html](http://localhost:8080/exist/apps/myApplication/openapi/index.html)
will become available. (The usage of the pipe operator requires XQuery version 3.1.)
```xq
else if (starts-with($exist:path, "/openapi/")) then
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward
url="/openapi/{ $exist:path => substring-after("/openapi/") => replace("json", "xq") }"
method="get">
<add-parameter name="target" value="{ substring-after($exist:root, "://") || $exist:controller }"/>
<add-parameter name="register" value="false"/>
</forward>
</dispatch>
```
### Standalone
By default the application provides a preview and a few simple REST paths as test
interfaces. Open the application via the Dashboard or browse to [http://localhost:8080/exist/apps/openapi/index.html](http://localhost:8080/exist/apps/openapi/index.html).
To view the documentation for other packages, use the input filed in the top bar
to ask for a description file at `openapi.json?target=/db/apps/myApplication`.
Optional the re-registration of functions to the RESTXQ engine is possible via
an additional parameter: `&register=true`.
## Configure ## Configure
To include information not present in one of the parsed documents, the library
checks the availability of a resources named `openapi-config.xml` in the
root collection of the application where to create the description file for.
It is recommended to place a customized copy of the file provided with this
package.
## Develop ## Develop
To start developing or testing the package a ant target is available that sets To start developing or testing the package a ant target is available that sets
...@@ -49,7 +77,6 @@ Behind the curtain the information will be collected by calling ...@@ -49,7 +77,6 @@ Behind the curtain the information will be collected by calling
inspect:inspect-module(xs:anyURI("/db/apps/openapi/content/openapi-tests-full.xqm")) inspect:inspect-module(xs:anyURI("/db/apps/openapi/content/openapi-tests-full.xqm"))
``` ```
## Limitations ## Limitations
### combining path and query parameters ### combining path and query parameters
Query parameters passed by `%rest:query-param()` MUST use a name different from Query parameters passed by `%rest:query-param()` MUST use a name different from
......
project.name=https://lab.sub.uni-goettingen.de/openapi4restxq-develop project.name=https://lab.sub.uni-goettingen.de/openapi4restxq-develop
project.version=1.1.1 project.version=1.2.0
project.title=OpenAPI for RESTXQ project.title=OpenAPI for RESTXQ
project.abbrev=openapi-develop project.abbrev=openapi-develop
project.processorversion=4.6.0 project.processorversion=4.6.0
......
...@@ -6,17 +6,22 @@ import module namespace openapi="https://lab.sub.uni-goettingen.de/restxqopenapi ...@@ -6,17 +6,22 @@ import module namespace openapi="https://lab.sub.uni-goettingen.de/restxqopenapi
at "content/openapi.xqm"; at "content/openapi.xqm";
(: prepare a json document on HTTP requests :) (: prepare a json document on HTTP requests :)
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method "json"; declare option output:method "json";
declare option output:media-type "application/json"; declare option output:media-type "application/json";
let $thisPath := replace(system:get-module-load-path(),
'^(xmldb:exist://)?(embedded-eXist-server)?(.+)$', '$3')
(: we register the REST interface :) (: we register the REST interface :)
let $prepare := xmldb:get-child-resources("/db/apps/openapi/content")[. != "openapi.xqm"] let $prepare :=
! exrest:register-module(xs:anyURI("/db/apps/openapi/content/" || .)) if(xs:boolean(request:get-parameter("register", "false")))
then
xmldb:get-child-resources($thisPath || "/content")[. != "openapi.xqm"]
! exrest:register-module(xs:anyURI($thisPath || "/content/" || .))
else ()
(: locate the target path :) (: locate the target path :)
let $thisPath := replace(system:get-module-load-path(),
'^(xmldb:exist://)?(embedded-eXist-server)?(.+)$', '$3')
let $target := request:get-parameter("target", $thisPath) let $target := request:get-parameter("target", $thisPath)
return return
......
...@@ -8,6 +8,15 @@ ...@@ -8,6 +8,15 @@
<type>application</type> <type>application</type>
<target>openapi</target> <target>openapi</target>
<changelog> <changelog>
<change version="1.1.1">
<ul xmlns="http://www.w3.org/1999/xhtml">
<li class="feat">Features
<ul style="margin-left: 15px;">
<li>Add a parameter for re-registration of RestXQ functions</li>
</ul>
</li>
</ul>
</change>
<change version="1.1.1"> <change version="1.1.1">
<ul xmlns="http://www.w3.org/1999/xhtml"> <ul xmlns="http://www.w3.org/1999/xhtml">
<li class="feat">Features <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