diff --git a/.gitignore b/.gitignore index 519b085..e9f2325 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -target/ - -*.iml +build/ +.gradle/ .idea/ +.vscode/ .tool-versions diff --git a/.tool-versions b/.tool-versions index e19316f..f86c714 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -java zulu-8.68.0.21 +java zulu-21.40.17 diff --git a/README.md b/README.md index 9267b51..187e8f8 100644 --- a/README.md +++ b/README.md @@ -8,19 +8,29 @@ This is a wrapper around the [Swagger-Parser](https://github.com/swagger-api/swa ## Installation -1. Download a pre-built XAR from the [releases](https://github.com/eeditiones/oad/releases/latest) -2. Install the package in your exist-db instance -3. Restart the database -4. Try - ```xquery - import module namespace oad="//eeditiones.org/ns/oad"; +Built packages of OAD are available on [GitHub releases](https://github.com/eeditiones/oad/releases/latest) +and the [public package repository](https://exist-db.org/exist/apps/public-repo/packages/oad?eXist-db-min-version=6.2.0). - oad:report('https://petstore3.swagger.io/api/v3/openapi.json') - ``` +You can visit one of the pages, download the XAR and then install it in your exist-db instance using the package manager. +Alternatively, you can run the [xst](https://github.com/exist-db/xst) command below. +```sh +xst packages install from-registry oad +``` + +**NOTE:** This XAR comes with addtional JAR files that need to be available at runtime. +It is safer to restart the database after installation - or upgrade - in order to make sure that +the classpath was updated. ## Usage +Try +```xquery +import module namespace oad="//eeditiones.org/ns/oad"; + +oad:report('https://petstore3.swagger.io/api/v3/openapi.json') +``` + All module functions assume you have a API specification _stored_ in exist or available via HTTP. The spec can be YAML or JSON. It allows to work with internal and external references. @@ -129,19 +139,19 @@ The available options are listed in the table below: ## Build * Requirements - * Java 8 - * Apache Maven 3.3+ + * Java 17 + * Gradle 8.5 ```bash -mvn package +./gradlew build ``` -will create a `oad-.xar` file in the `target/` sub-folder. +will create a `oad-.xar` file in the folder `build/libs`. ## Tests There are no unit tests that will be executed when building the project. -The build package does include [xqsuite tests](src/main/xar-resources/xqsuite/oad-test.xqm) which test the integration +The built package does include [xqsuite tests](src/main/xar-resources/xqsuite/oad-test.xqm) which test the integration into exist-db works as intended. You can call that as part of your development workflow by running @@ -152,12 +162,12 @@ You can call that as part of your development workflow by running ## Release -```bash -mvn release:prepare -``` -```bash -mvn release:perform -``` +- Update the version in build.gradle.kts +- commit, tag and push the new version +- build the project +- draft a new release and add the XAR file to it + +**NOTE:** The release process is work in progress after switching to gradle as the build tool. ## Sponsors diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..0d3e63d --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,74 @@ +import org.existdb.plugin.PackageType.LIBRARY +import org.existdb.plugin.exist6only + +plugins { + id("java") + id("base") + id("org.exist-db.plugin.xar") version "1.0.0" +} + +group = "org.eeditiones.oad" +description = "Validate, inspect and convert OpenAPI definitions" + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +repositories { + mavenCentral() +} + +dependencies { + implementation("io.swagger.parser.v3:swagger-parser:2.1.19") + implementation("com.fasterxml.jackson.core:jackson-core:2.15.3") + + compileOnly("org.exist-db:exist-core:6.4.1") + + testImplementation("org.exist-db:exist-core:6.4.1") + testImplementation("junit:junit:4.13.2") + testImplementation("org.xmlunit:xmlunit-core:2.9.0") +} + +xar { + namespace = "//eeditiones.org/ns/oad" + abbrev = "oad" + title = "OpenAPI Definition Utility" + description = "OpenAPI Definition Utility for eXist-db" + author = "The e-editiones contributors" + home = "https://github.com/eeditiones/oad" + status = "beta" + license = "GNU Lesser General Public License, version 3.0" + type = LIBRARY + javaClass = "org.eeditiones.oad.OadModule" + requiredJars = listOf( + "swagger-parser-core-2.1.19.jar", + "swagger-parser-2.1.19.jar", + "swagger-parser-safe-url-resolver-2.1.19.jar", + "swagger-core-2.2.19.jar", + "swagger-parser-v3-2.1.19.jar", + "swagger-models-2.2.19.jar", + "jackson-core-2.15.3.jar", + "jackson-databind-2.15.3.jar", + "jackson-dataformat-yaml-2.15.3.jar", + "jackson-datatype-jsr310-2.15.3.jar", + "snakeyaml-2.2.jar" + ) + processorDependencies = listOf( exist6only ) +} + +tasks.named("jar") { + manifest { + attributes( + "Implementation-Title" to project.name, + "Implementation-Version" to project.version.toString(), + "Implementation-URL" to "https://github.com/eeditiones/oad", + "Source-Repository" to "scm:git:https://github.com/eeditiones/oad.git" + ) + } +} + +tasks.named("wrapper") { + gradleVersion = "9.4.1" + distributionType = Wrapper.DistributionType.BIN +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..e162ea5 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,7 @@ +org.gradle.parallel=true +org.gradle.caching=true +org.gradle.jvmargs=-Xmx2g + +# Project properties +archivesBaseName=oad +version=1.0.8 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..d997cfc Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..c61a118 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..739907d --- /dev/null +++ b/gradlew @@ -0,0 +1,248 @@ +#!/bin/sh + +# +# Copyright © 2015 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/2d6327017519d23b96af35865dc997fcb544fb40/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..c4bdd3a --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,93 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 9107826..0000000 --- a/pom.xml +++ /dev/null @@ -1,452 +0,0 @@ - - - - 4.0.0 - - - - - - - - - org.eeditiones.oad - oad - 1.0.7-SNAPSHOT - - OpenAPI Definition Utility - Validate, inspect and convert OpenAPI definitions - https://github.com/eeditiones/oad - - - e-editiones - http://eeditiones.org - - - - - GNU Lesser General Public License, version 3.0 - http://opensource.org/licenses/LGPL-3.0 - repo - - - - - https://github.com/eeditiones/oad - scm:git:https://github.com/eeditiones/oad.git - scm:git:https://github.com/eeditiones/oad.git - HEAD - - - - GitHub - https://github.com/eeditiones/oad/issues - - - - UTF-8 - 1.8 - 1.8 - - 6.2.0 - 2.1.19 - - - //eeditiones.org/ns/oad - - //eeditiones.org/ns/oad - OadModule - - ${project.name} - ${project.artifactId} - ${project.artifactId}-${project.version} - - - - - - - junit - junit - 4.13.2 - test - - - - - - - io.swagger.parser.v3 - swagger-parser - ${swagger.version} - - - - org.exist-db - exist-core - ${exist.version} - provided - - - - - junit - junit - test - - - org.xmlunit - xmlunit-core - 2.9.0 - test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - 3.2.0 - - - com.mycila - license-maven-plugin - 4.1 - - - com.code54.mojo - buildversion-plugin - 1.0.3 - - - org.codehaus.mojo - xml-maven-plugin - 1.0.2 - - - org.apache.maven.plugins - maven-compiler-plugin - 3.10.0 - - ${project.build.source} - ${project.build.target} - ${project.build.sourceEncoding} - - - - ro.kuberam.maven.plugins - kuberam-expath-plugin - 0.6.3 - - - create-xar - package - - make-xar - - - xar-assembly.xml - ${package-final-name} - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.2 - - - - true - true - - - ${build-tag} - ${build-commit} - ${build-commit-abbrev} - ${build-version} - ${build-tstamp} - ${project.scm.connection} - ${project.description} - ${project.url} - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.2.1 - - - - true - true - - - ${build-tag} - ${build-commit} - ${build-commit-abbrev} - ${build-version} - ${build-tstamp} - ${project.scm.connection} - ${project.description} - ${project.url} - - - - - - attach-sources - verify - - jar - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.3.2 - - - attach-javadocs - - jar - - - - - ${project.build.source} - - - true - true - - - ${build-tag} - ${build-commit} - ${build-commit-abbrev} - ${build-version} - ${build-tstamp} - ${project.scm.connection} - ${project.description} - ${project.url} - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 3.0.1 - - - org.apache.maven.plugins - maven-deploy-plugin - 3.1.1 - - true - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - - org.apache.maven.plugins - maven-changes-plugin - 2.12.1 - - false - false - Type, Summary - ${project.basedir} - - - - - - - - - src/main/xar-resources - true - - templates/** - - - - src/main/xar-resources - false - - templates/** - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - true - true - - - ${build-tag} - ${build-commit} - ${build-commit-abbrev} - ${build-version} - ${build-tstamp} - ${project.scm.connection} - ${project.description} - ${project.url} - - - - - - ro.kuberam.maven.plugins - kuberam-expath-plugin - - - create-xar - package - - make-xar - - - xar-assembly.xml - ${package-final-name} - - - - - - org.apache.maven.plugins - maven-gpg-plugin - - true - - - - org.apache.maven.plugins - maven-release-plugin - - forked-path - - true - v@{project.version} - chore: - - - - - - org.apache.maven.plugins - maven-help-plugin - 3.2.0 - - - - de.jutzig - github-release-plugin - 1.6.0 - - - github-upload - deploy - - release - - - v${project.version} - - v${project.version} - - - ${project.build.directory} - - ${project.artifactId}*.xar - - - - - - - - - - - - - - exist-db - https://repo.evolvedbinary.com/repository/exist-db/ - - true - - - false - - - - exist-db-snapshots - https://repo.evolvedbinary.com/repository/exist-db-snapshots/ - - false - - - true - - - - - - - maven.org - https://maven.org/repo - - - clojars.org - https://clojars.org/repo - - - diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..e45d172 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,9 @@ +pluginManagement { + repositories { + mavenLocal() + gradlePluginPortal() + mavenCentral() + } +} + +rootProject.name = 'oad' diff --git a/src/main/xar-resources/xqsuite/api.json b/src/main/xar-resources/xqsuite/api.json new file mode 100644 index 0000000..67184d3 --- /dev/null +++ b/src/main/xar-resources/xqsuite/api.json @@ -0,0 +1,3622 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "1.0.0", + "title": "TEI Publisher API", + "description": "This is the core API for TEI Publisher 8. It describes all endpoints used by TEI Publisher web components, plus additional operations added for external access." + }, + "servers": [ + { + "description": "Endpoint for testing on localhost", + "url": "/exist/apps/tei-publisher" + } + ], + "tags": [ + { + "name": "documents", + "description": "Retrieve document content transformed to target format" + }, + { + "name": "collection", + "description": "Browse the collection hierarchy and upload new files" + }, + { + "name": "odd", + "description": "Manage the ODD files stored in TEI Publisher" + }, + { + "name": "search", + "description": "Searching the collection" + }, + { + "name": "transform", + "description": "Transform content on the fly" + }, + { + "name": "view", + "description": "View documents via an HTML template" + }, + { + "name": "apps", + "description": "Operations to generate/manage apps" + }, + { + "name": "dts", + "description": "Implementation of the DTS (Distributed Text Services) API" + }, + { + "name": "info", + "description": "Information about the server" + }, + { + "name": "register", + "description": "Manage entries in the local authority file" + }, + { + "name": "nlp", + "description": "Entity recognition and other natural language processing features" + }, + { + "name": "annotations", + "description": "Endpoints for the annotation editor" + }, + { + "name": "iiif", + "description": "Generate IIIF manifests" + } + ], + "components": { + "securitySchemes": { + "basicAuth": { + "type": "http", + "scheme": "basic" + }, + "cookieAuth": { + "type": "apiKey", + "name": "teipublisher.com.login", + "in": "cookie" + } + } + }, + "paths": { + "/{file}.html": { + "get": { + "summary": "Retrieve HTML page", + "description": "Retrieve an HTML page expanded through eXist templating. This is used to load the top-level HTML pages, e.g. `index.html`.", + "tags": [ + "view" + ], + "operationId": "vapi:html", + "x-error-handler": "vapi:handle-error", + "parameters": [ + { + "name": "file", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "HTML of the page", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "The document was not found", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/{docid}": { + "get": { + "summary": "Retrieve the HTML template used for displaying a document", + "description": "Get the HTML template associated with the given document. This is called whenever the users tries to view a document. The actual content of the document will then be loaded by the template.", + "tags": [ + "view" + ], + "operationId": "vapi:view", + "x-error-handler": "vapi:handle-error", + "parameters": [ + { + "name": "docid", + "in": "path", + "description": "Relative path to the document", + "required": true, + "schema": { + "type": "string", + "example": "test/orlik_to_serafin.xml" + }, + "allowReserved": true + }, + { + "name": "template", + "in": "query", + "description": "Name of the template to be used. Overwrites any default template setting.", + "schema": { + "type": "string" + } + }, + { + "name": "view", + "in": "query", + "schema": { + "type": "string", + "enum": [ + "page", + "div", + "single" + ] + }, + "example": "div", + "description": "The view type used by the main view which displays the document, e.g. 'page' or 'div'. This has an influence on the generated links, which need to differ when linking to a page rather than a section." + }, + { + "name": "odd", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "action", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "HTML view for the document", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "The document was not found", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "An error occurred", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/print/{docid}": { + "get": { + "summary": "Generate a print preview using Paged Media CSS", + "tags": [ + "view" + ], + "operationId": "vapi:view", + "x-error-handler": "vapi:handle-error", + "parameters": [ + { + "name": "docid", + "in": "path", + "description": "Relative path to the document", + "required": true, + "schema": { + "type": "string", + "example": "test/orlik_to_serafin.xml" + }, + "allowReserved": true + }, + { + "name": "template", + "in": "query", + "description": "Name of the template to be used. Overwrites any default template setting.", + "schema": { + "type": "string", + "default": "print-preview.html" + } + }, + { + "name": "odd", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "HTML view for the document", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "The document was not found", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "An error occurred", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/{docid}.md": { + "get": { + "summary": "Retrieve the HTML template for a markdown file and render it", + "description": "Get the HTML template associated with the given markdown document. This is called whenever the users tries to view a markdown file. The actual content of the document will then be loaded by the template.", + "tags": [ + "view" + ], + "operationId": "vapi:view", + "x-error-handler": "vapi:handle-error", + "parameters": [ + { + "name": "docid", + "in": "path", + "description": "Relative path to the document", + "required": true, + "schema": { + "type": "string", + "example": "about.md" + }, + "allowReserved": true + }, + { + "name": "template", + "in": "query", + "description": "Name of the template to be used. Overwrites any default template setting.", + "schema": { + "type": "string", + "default": "markdown.html" + } + }, + { + "name": "suffix", + "in": "query", + "schema": { + "type": "string", + "default": ".md" + } + } + ], + "responses": { + "200": { + "description": "HTML view for the document", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "The document was not found", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "An error occurred", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/version": { + "get": { + "summary": "Get version information about this service", + "description": "Get the version of TEI Publisher running this service as well as the API version implemented", + "operationId": "iapi:version", + "tags": [ + "info" + ], + "responses": { + "200": { + "description": "Version information about this service", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "api": { + "type": "string" + }, + "app": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "engine": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + }, + "/api/collection/{path}": { + "get": { + "summary": "Get formatted overview of documents in the collection", + "tags": [ + "collection" + ], + "operationId": "capi:list", + "parameters": [ + { + "name": "path", + "in": "path", + "required": true, + "schema": { + "type": "string", + "example": "test" + } + } + ], + "responses": { + "200": { + "description": "Returns HTML describing the collection", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/collection": { + "get": { + "summary": "Get formatted overview of documents in the collection", + "tags": [ + "collection" + ], + "operationId": "capi:list", + "responses": { + "200": { + "description": "Returns HTML describing the collection", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/upload": { + "post": { + "summary": "Upload a number of files to the top-level data collection of the app", + "tags": [ + "collection" + ], + "operationId": "capi:upload", + "x-constraints": { + "groups": [ + "tei" + ] + }, + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "files[]": { + "type": "array", + "items": { + "type": "string", + "format": "binary" + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Upload response", + "content": { + "application/json": { + "schema": { + "properties": { + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "type": { + "type": "string" + }, + "size": { + "type": "number" + } + } + } + } + } + }, + "401": { + "description": "Permission denied", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "details": { + "type": "object", + "nullable": true + } + } + } + } + } + }, + "404": { + "description": "Upload collection not found", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "500": { + "description": "Upload collection not found", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/upload/{collection}": { + "post": { + "summary": "Upload a number of files", + "tags": [ + "collection" + ], + "operationId": "capi:upload", + "x-constraints": { + "groups": [ + "tei" + ] + }, + "parameters": [ + { + "name": "collection", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "files[]": { + "type": "array", + "items": { + "type": "string", + "format": "binary" + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Upload response", + "content": { + "application/json": { + "schema": { + "properties": { + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "type": { + "type": "string" + }, + "size": { + "type": "number" + } + } + } + } + } + }, + "401": { + "description": "Permission denied", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "details": { + "type": "object", + "nullable": true + } + } + } + } + } + }, + "404": { + "description": "Upload collection not found", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "500": { + "description": "Upload collection not found", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/document/{id}": { + "get": { + "summary": "Get the source of a document", + "description": "Get the source of a document, either as XML, text or binary.", + "tags": [ + "documents" + ], + "operationId": "dapi:source", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "type", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Content of the document", + "content": { + "application/xml": { + "schema": { + "type": "string" + } + }, + "text/markdown": { + "schema": { + "type": "string" + } + }, + "text/text": { + "schema": { + "type": "string" + } + } + } + }, + "410": { + "description": "Document deleted" + } + } + }, + "delete": { + "summary": "Delete a document", + "tags": [ + "documents" + ], + "operationId": "dapi:delete", + "x-constraints": { + "groups": [ + "tei" + ] + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "410": { + "description": "Document deleted" + } + } + } + }, + "/api/document/{id}/html": { + "get": { + "summary": "Retrieve document content as HTML", + "description": "Retrieve whole document transformed to HTML via ODD", + "tags": [ + "documents" + ], + "operationId": "dapi:html", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "example": "test/F-rom.xml" + } + }, + { + "name": "odd", + "in": "query", + "schema": { + "type": "string", + "example": "shakespeare.odd" + } + }, + { + "name": "base", + "description": "Base URI to use", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "wc", + "description": "Include TEI Publisher webcomponents", + "in": "query", + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Returns the entire document as HTML", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "Document not found", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/document/{id}/print": { + "get": { + "summary": "Retrieve document content as HTML optimized for Print CSS", + "tags": [ + "documents" + ], + "operationId": "dapi:print", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "example": "test/F-rom.xml" + } + }, + { + "name": "odd", + "in": "query", + "schema": { + "type": "string", + "example": "shakespeare.odd" + } + }, + { + "name": "base", + "description": "Base URI to use for resolving links and images", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "wc", + "description": "Include TEI Publisher webcomponents if set. 'page' will also inject a wrapper if not present, using parameter 'base' as endpoint.", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "style", + "description": "Additional CSS stylesheet URLs to be loaded", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "description": "Additional script URLs to be loaded", + "name": "script", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Returns the entire document as HTML", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "Document not found", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/document/{id}/pdf": { + "get": { + "summary": "Retrieve document content as PDF", + "description": "Retrieve whole document transformed via ODD and FO", + "tags": [ + "documents" + ], + "operationId": "dapi:pdf", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "example": "test/F-rom.xml" + }, + "description": "Path to the XML document" + }, + { + "name": "source", + "in": "query", + "schema": { + "type": "boolean", + "default": false + }, + "description": "Set to true to see generated XML FO source" + }, + { + "name": "token", + "in": "query", + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "cache", + "in": "query", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "200": { + "description": "Returns a PDF", + "content": { + "application/pdf": { + "schema": { + "type": "string", + "format": "binary" + } + }, + "application/xml": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "Document not found", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/document/{id}/tex": { + "get": { + "summary": "Retrieve document content as PDF", + "description": "Retrieve whole document transformed via ODD and LaTeX", + "tags": [ + "documents" + ], + "operationId": "dapi:latex", + "x-error-handler": "vapi:handle-error", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "example": "test/F-rom.xml" + } + }, + { + "name": "source", + "in": "query", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "200": { + "description": "Returns a PDF", + "content": { + "application/pdf": { + "schema": { + "type": "string", + "format": "binary" + } + }, + "application/x-latex": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "Document not found", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "400": { + "description": "LaTeX processing failed", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "Internal server error", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/document/{id}/epub": { + "get": { + "summary": "Retrieve document content as EPub", + "description": "Retrieve whole document as EPub transformed via ODD", + "tags": [ + "documents" + ], + "operationId": "dapi:epub", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "example": "doc/documentation.xml" + } + }, + { + "name": "token", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "lang", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "odd", + "in": "query", + "schema": { + "type": "string", + "example": "docbook.odd" + } + }, + { + "name": "images-collection", + "in": "query", + "schema": { + "type": "string", + "example": "/apps/tei-publisher/data" + } + }, + { + "name": "skip-title", + "in": "query", + "schema": { + "type": "boolean", + "example": "true" + } + }, + { + "name": "cover-image", + "in": "query", + "schema": { + "type": "string", + "example": "images/cover.jpg" + } + } + ], + "responses": { + "200": { + "description": "Returns an ePUB", + "content": { + "application/epub+zip": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "404": { + "description": "Document not found", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/document/{id}/meta": { + "get": { + "summary": "Returns some metadata about the document", + "tags": [ + "documents" + ], + "operationId": "dapi:metadata", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "example": "test/kant_rvernunft_1781.TEI-P5.xml" + } + } + ], + "responses": { + "200": { + "description": "Metadata about the document as JSON object", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "404": { + "description": "Document not found", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/document/{id}/contents": { + "get": { + "summary": "Retrieve a formatted table of contents for the document", + "description": "Retrieve a formatted table of contents for the document, transformed via ODD", + "tags": [ + "documents" + ], + "operationId": "dapi:table-of-contents", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "example": "test/kant_rvernunft_1781.TEI-P5.xml" + } + }, + { + "name": "odd", + "in": "query", + "schema": { + "type": "string", + "example": "teipublisher.odd" + } + }, + { + "name": "view", + "in": "query", + "schema": { + "type": "string", + "enum": [ + "page", + "div", + "single" + ] + }, + "example": "div", + "description": "The view type used by the main view which displays the document, e.g. 'page' or 'div'. This has an influence on the generated links, which need to differ when linking to a page rather than a section." + }, + { + "name": "target", + "in": "query", + "schema": { + "type": "string" + }, + "description": "The target channel into which link selection events should be send (if the user clicks on a link)" + }, + { + "name": "icons", + "in": "query", + "schema": { + "type": "boolean", + "default": true + }, + "description": "Should an expand/collapse icon be displayed next to headings having nested child sections?" + }, + { + "name": "If-Modified-Since", + "in": "header", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Returns the formatted table of contents as HTML", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "Document not found", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/parts/{doc}/{format}": { + "get": { + "summary": "Retrieve parts of a document transformed via ODD", + "description": "Retrieve a document fragment, usually a division or page, transformed to HTML via the ODD. This operation is internally used by pb-view, but can also be helpful with pb-load or in other contexts.", + "operationId": "dapi:get-fragment", + "tags": [ + "documents" + ], + "parameters": [ + { + "name": "doc", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "example": "doc/documentation.xml", + "description": "path to the document, relative to TEI Publisher's data root colletion" + }, + { + "name": "format", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "json", + "html" + ] + }, + "description": "the format to return: either `json` or `html`. The first returns the HTML inside a JSON record with additional information about the next/previous page and so on. The latter is mainly for debugging purposes." + }, + { + "name": "odd", + "in": "query", + "schema": { + "type": "string", + "example": "shakespeare.odd" + } + }, + { + "name": "view", + "in": "query", + "schema": { + "type": "string", + "enum": [ + "page", + "div", + "single" + ] + }, + "example": "div", + "description": "the view to use: this determines the size of the fragment returned, i.e. just a page, a whole division or the entire document" + }, + { + "name": "root", + "in": "query", + "schema": { + "type": "string" + }, + "description": "an eXist node id used to identify the root of the fragment to return. mainly used to navigate to the next/previous fragment based on the properties received in the JSON record during a preceding request." + }, + { + "name": "id", + "in": "query", + "schema": { + "type": "string" + }, + "description": "an xml:id to load: can be used instead of `root` to determine the fragment root to be loaded. Should be an xml:id existing in the document." + }, + { + "name": "xpath", + "in": "query", + "schema": { + "type": "string" + }, + "description": "an XPath expression to directly select a sub-part of the document, e.g. the TEI body, front or back matter, or teiHeader. Usually only makes sense in combination with `view=single`." + }, + { + "name": "map", + "in": "query", + "schema": { + "type": "string" + }, + "description": "defines an optional mapping function (written in XQuery), which can be used to replace the document content to be processed with something else. Used to e.g. look up the translation for a given transcription and process it instead." + }, + { + "name": "highlight", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "If-Modified-Since", + "in": "header", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "view": { + "type": "string", + "description": "the view type used" + }, + "doc": { + "type": "string", + "description": "path to the document from which the fragment was retrieved" + }, + "root": { + "type": "string", + "nullable": true + }, + "odd": { + "type": "string", + "description": "the ODD used for the transformation" + }, + "next": { + "type": "string", + "nullable": true, + "description": "points to the next fragment in the document. Pass this value as `root` in a follow up request." + }, + "previous": { + "type": "string", + "nullable": true, + "description": "points to the previous fragment in the document. Pass this value as `root` in a follow up request." + }, + "switchView": { + "type": "string", + "nullable": true + }, + "content": { + "type": "string", + "description": "the content of the fragment as HTML string" + }, + "footnotes": { + "type": "string", + "nullable": true + } + } + } + }, + "text/html": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "Document not found", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/odd/{odd}": { + "get": { + "summary": "Retrieve an ODD", + "description": "Retrieve an ODD as TEI/XML", + "tags": [ + "odd" + ], + "operationId": "oapi:get-odd", + "parameters": [ + { + "name": "odd", + "in": "path", + "description": "Filename of the ODD including suffix (.odd)", + "schema": { + "type": "string", + "example": "docbook.odd" + }, + "required": true + }, + { + "name": "ident", + "in": "query", + "description": "Only return the elementSpec matching this ident. If set, response will be in JSON format.", + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "root", + "in": "query", + "description": "Context path against which the the ODD path will be resolved. Used by ODD editor.", + "schema": { + "type": "string", + "nullable": true + } + } + ], + "responses": { + "200": { + "description": "Returns the TEI/XML source of the ODD", + "content": { + "application/xml": { + "schema": { + "type": "string" + } + }, + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "404": { + "description": "ODD not found" + } + } + }, + "delete": { + "summary": "Delete an ODD from the database", + "description": "Delete the ODD given in the path parameter from the database. The ODD should be located in the collection referenced by `config:odd-root` in `modules/config.xqm`.", + "tags": [ + "odd" + ], + "operationId": "oapi:delete-odd", + "x-constraints": { + "groups": [ + "tei" + ] + }, + "parameters": [ + { + "name": "odd", + "in": "path", + "schema": { + "type": "string", + "example": "testodd.odd" + }, + "description": "Filename of the ODD including suffix (.odd)", + "required": true + } + ], + "responses": { + "410": { + "description": "ODD was deleted" + }, + "404": { + "description": "ODD not found" + } + } + }, + "post": { + "summary": "Create an ODD", + "description": "Create a new ODD using the file name given in the path", + "tags": [ + "odd" + ], + "operationId": "oapi:create-odd", + "x-constraints": { + "groups": [ + "tei" + ] + }, + "parameters": [ + { + "name": "odd", + "in": "path", + "schema": { + "type": "string" + }, + "description": "Filename of the ODD without suffix (.odd)", + "required": true + }, + { + "name": "title", + "in": "query", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "201": { + "description": "ODD was created", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "path": { + "type": "string" + } + } + } + } + } + }, + "401": { + "description": "Permission denied", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + }, + "put": { + "summary": "Save ODD", + "description": "Replace an ODD with the current version from the editor", + "tags": [ + "odd" + ], + "operationId": "oapi:save-odd", + "x-constraints": { + "groups": [ + "tei" + ] + }, + "parameters": [ + { + "name": "odd", + "in": "path", + "schema": { + "type": "string", + "example": "testodd.odd" + }, + "description": "Filename of the ODD with the suffix (.odd)", + "required": true + }, + { + "name": "root", + "in": "query", + "schema": { + "type": "string", + "example": "/db/apps/tei-publisher/odd" + }, + "description": "Collection into which the ODD should be written" + }, + { + "name": "output-root", + "in": "query", + "schema": { + "type": "string", + "example": "/db/apps/tei-publisher/transform" + }, + "description": "The collection into which generated code files will be written" + }, + { + "name": "output-prefix", + "in": "query", + "schema": { + "type": "string", + "example": "transform" + }, + "description": "Relative path (from app root) used for resolving connected CSS files" + } + ], + "requestBody": { + "content": { + "application/xml": { + "schema": { + "type": "string" + } + } + } + }, + "responses": { + "201": { + "description": "ODD was saved", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "report": { + "type": "string" + }, + "source": { + "type": "string" + } + } + } + } + } + }, + "401": { + "description": "Permission denied", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/odd": { + "get": { + "summary": "Get a list of ODDs available", + "operationId": "oapi:list-odds", + "tags": [ + "odd" + ], + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "label": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + }, + "path": { + "type": "string" + }, + "canWrite": { + "type": "boolean" + } + } + } + } + } + } + } + } + }, + "post": { + "summary": "Recompile ODDs", + "description": "Recompile one or more ODDs after they were changed", + "operationId": "oapi:recompile", + "tags": [ + "odd" + ], + "x-constraints": { + "groups": [ + "tei" + ] + }, + "parameters": [ + { + "name": "odd", + "in": "query", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "check", + "in": "query", + "schema": { + "type": "boolean", + "default": false + }, + "description": "Run additional check to ensure the generated code is valid and compiles" + } + ], + "responses": { + "200": { + "description": "ODDs were recompiled. The result of the compilation is returned as HTML.", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/lint": { + "post": { + "summary": "Check an XPath/XQuery snippet", + "description": "Check an XPath/XQuery snippet used in an ODD for syntactical correctness (called by ODD editor)", + "operationId": "oapi:lint", + "tags": [ + "odd" + ], + "parameters": [ + { + "name": "code", + "in": "query", + "schema": { + "type": "string", + "example": "starts-with(., 'f')" + }, + "description": "Code snippet", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/templates": { + "get": { + "summary": "List available HTML templates", + "description": "Lists all page layout templates available for the document view. Used by `pb-select-templates`.", + "tags": [ + "view" + ], + "operationId": "iapi:list-templates", + "responses": { + "200": { + "description": "Array of templates", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "title": { + "type": "string", + "nullable": true + } + } + } + } + } + } + } + } + } + }, + "/api/search": { + "get": { + "summary": "Run a search on all TEI Publisher collections", + "operationId": "sapi:search", + "tags": [ + "search" + ], + "parameters": [ + { + "name": "query", + "in": "query", + "description": "Query string", + "schema": { + "type": "string" + } + }, + { + "name": "field", + "in": "query", + "description": "The field to query", + "schema": { + "type": "string", + "default": "text" + } + }, + { + "name": "start", + "in": "query", + "description": "Start offset of the first item to show from the result set", + "schema": { + "type": "integer", + "default": 1 + } + }, + { + "name": "per-page", + "in": "query", + "description": "Number of items to show on one page", + "schema": { + "type": "integer", + "default": 10 + } + }, + { + "name": "doc", + "in": "query", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "nullable": true + } + } + ], + "responses": { + "200": { + "description": "Search results returned", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/search/facets": { + "get": { + "summary": "List facets", + "description": "Return a list of facet counts for current search results", + "operationId": "sapi:facets", + "tags": [ + "search" + ], + "responses": { + "200": { + "description": "Facets returned", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/search/facets/{type}": { + "get": { + "summary": "List facet values occurring in current search result set", + "operationId": "sapi:list-facets", + "tags": [ + "search" + ], + "parameters": [ + { + "name": "query", + "in": "query", + "description": "Query string to filter facets by", + "schema": { + "type": "string" + } + }, + { + "name": "language", + "in": "query", + "schema": { + "type": "string", + "default": "en" + } + }, + { + "name": "type", + "in": "path", + "description": "The facet type, e.g. 'place' or 'person'", + "required": true, + "schema": { + "type": "string", + "example": "place" + } + } + ], + "responses": { + "200": { + "description": "Facets returned", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object" + } + } + } + } + } + } + } + }, + "/api/search/autocomplete": { + "get": { + "summary": "List possible completions", + "description": "Return a list of possible completions for the given search term", + "operationId": "sapi:autocomplete", + "tags": [ + "search" + ], + "parameters": [ + { + "name": "query", + "in": "query", + "description": "The prefix to expand", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "field", + "in": "query", + "description": "The field to query", + "schema": { + "title": "string", + "default": "text" + } + } + ], + "responses": { + "200": { + "description": "List of possible completions", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "/api/convert": { + "post": { + "summary": "Convert a Word document to TEI/XML", + "tags": [ + "transform" + ], + "operationId": "dapi:convert-docx", + "parameters": [ + { + "name": "odd", + "in": "query", + "schema": { + "type": "string", + "default": "docx.odd" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/xml": { + "schema": { + "type": "string" + } + } + } + }, + "responses": { + "200": { + "description": "Resulting TEI/XML output", + "content": { + "application/xml": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/preview": { + "post": { + "summary": "Post an XML document and get a preview rendered via ODD", + "tags": [ + "transform" + ], + "operationId": "dapi:preview", + "parameters": [ + { + "name": "odd", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "base", + "description": "Base URI to use for the HTML document", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "wc", + "description": "Include TEI Publisher webcomponents", + "in": "query", + "schema": { + "type": "boolean", + "default": true + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/xml": { + "schema": { + "type": "string" + } + } + } + }, + "responses": { + "200": { + "description": "Resulting HTML output", + "content": { + "text/html": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/login": { + "post": { + "summary": "Login the user", + "description": "Login the given user", + "tags": [ + "user" + ], + "operationId": "auth:login", + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "nullable": true, + "properties": { + "user": { + "description": "Name of the user", + "type": "string" + }, + "password": { + "type": "string", + "format": "password" + } + } + } + }, + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "nullable": true, + "properties": { + "user": { + "description": "Name of the user", + "type": "string" + }, + "password": { + "type": "string", + "format": "password" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "user": { + "type": "string" + }, + "groups": { + "type": "array", + "items": { + "type": "string" + } + }, + "dba": { + "type": "boolean" + }, + "domain": { + "type": "string" + } + } + } + } + } + }, + "401": { + "description": "Wrong user or password" + } + } + } + }, + "/api/apps/download": { + "get": { + "summary": "Package and download app", + "description": "Package up this application and return it as a `.xar`.", + "tags": [ + "apps" + ], + "operationId": "deploy:download-app", + "responses": { + "200": { + "description": "xar package (zip format) containing the app code", + "content": { + "application/zip": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + } + } + } + }, + "/api/apps/generate": { + "post": { + "summary": "Generate a TEI-Publisher stand-alone application", + "description": "Generate a stand-alone application based on an ODD, template and other settings", + "tags": [ + "apps" + ], + "operationId": "deploy:generate", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "odd": { + "type": "array", + "description": "One or more ODDs to include in the app", + "items": { + "type": "string" + } + }, + "uri": { + "type": "string" + }, + "abbrev": { + "type": "string" + }, + "title": { + "type": "string" + }, + "data-collection": { + "type": "string", + "nullable": true + }, + "template": { + "type": "string" + }, + "default-view": { + "type": "string", + "enum": [ + "div", + "page" + ] + }, + "index": { + "type": "string", + "enum": [ + "tei:div", + "tei:text" + ] + }, + "owner": { + "type": "string" + }, + "password": { + "type": "string", + "format": "password" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "App generated", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "target": { + "type": "string" + } + } + } + } + } + }, + "400": { + "description": "App already exists" + }, + "500": { + "description": "Generation failed", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "details": { + "type": "object", + "nullable": true + } + } + } + } + } + } + } + } + }, + "/api/dts": { + "get": { + "summary": "Base API endpoint", + "description": "Returns the base path for the 3 endpoints: collection, navigation and documents", + "operationId": "dts:base-endpoint", + "tags": [ + "dts" + ], + "responses": { + "200": { + "description": "Server configuration information", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "@context": { + "type": "string", + "nullable": false + }, + "@id": { + "type": "string", + "nullable": false + }, + "@type": { + "type": "string", + "nullable": false + }, + "collection": { + "type": "string", + "nullable": false + }, + "documents": { + "type": "string", + "nullable": false + }, + "navigation": { + "type": "string", + "nullable": false + } + } + } + } + } + } + } + } + }, + "/api/dts/collection": { + "get": { + "summary": "Navigate collection", + "description": "The collections endpoint is used for navigating collections. A collection contains metadata for the collection itself and an array of members. Each member is either a collection or the metadata for a document.", + "operationId": "dts:collection", + "tags": [ + "dts" + ], + "parameters": [ + { + "name": "id", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "in": "query", + "schema": { + "type": "integer", + "default": 1 + } + }, + { + "name": "per-page", + "in": "query", + "schema": { + "type": "integer" + } + }, + { + "name": "nav", + "in": "query", + "schema": { + "type": "string", + "enum": [ + "parents", + "children" + ], + "default": "children" + } + } + ], + "responses": { + "200": { + "description": "Collection metadata", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/dts/document": { + "get": { + "summary": "Document endpoint", + "description": "The Document endpoint is used to access and modify the content of document, as opposed to metadata (which is found in collections).", + "operationId": "dts:documents", + "tags": [ + "dts" + ], + "parameters": [ + { + "name": "id", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "TEI/XML of the document", + "content": { + "application/xml": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/dts/import": { + "get": { + "summary": "Import a remote resource into local database", + "description": "Helper operation to import a remote resource, optionally into a temporary collection", + "tags": [ + "dts" + ], + "operationId": "dts:import", + "x-constraints": { + "groups": [ + "tei" + ] + }, + "parameters": [ + { + "name": "uri", + "in": "query", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "temp", + "in": "query", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "201": { + "description": "Content was successfully imported", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "path": { + "type": "string", + "nullable": false + } + } + } + } + } + } + } + } + }, + "/api/annotations/occurrences": { + "post": { + "summary": "For each ID passed in, return the number of already marked up occurrences in TEI texts", + "tags": [ + "annotations" + ], + "operationId": "anno:find-references", + "parameters": [ + { + "name": "id", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "register", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "an object mapping IDs to number of occurrences", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/annotations/merge": { + "put": { + "summary": "Merge a set of annotations on multiple documents into their source TEI and store the resulting data", + "tags": [ + "annotations" + ], + "operationId": "anno:save", + "x-constraints": { + "groups": [ + "tei" + ] + }, + "requestBody": { + "description": "An object mapping document paths to annotation arrays", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Properties map document paths to annotations", + "additionalProperties": { + "type": "array", + "items": { + "type": "object", + "properties": { + "context": { + "type": "string" + }, + "start": { + "type": "number" + }, + "end": { + "type": "number" + }, + "type": { + "type": "string" + }, + "text": { + "type": "string" + }, + "properties": { + "type": "object" + } + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns the merged TEI XML", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/annotations/merge/{path}": { + "post": { + "summary": "Merge annotations into source TEI", + "tags": [ + "annotations" + ], + "operationId": "anno:save", + "requestBody": { + "description": "An array of annotations to be applied", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "context": { + "type": "string" + }, + "start": { + "type": "number" + }, + "end": { + "type": "number" + }, + "type": { + "type": "string" + }, + "text": { + "type": "string" + }, + "properties": { + "type": "object" + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "path", + "in": "path", + "description": "Relative path to the TEI document to be changed", + "schema": { + "type": "string", + "example": "annotate/graves20.xml" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Returns the merged TEI XML", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + }, + "put": { + "summary": "Merge annotations into source TEI and store the resulting document", + "tags": [ + "annotations" + ], + "operationId": "anno:save", + "x-constraints": { + "groups": [ + "tei" + ] + }, + "requestBody": { + "description": "An array of annotations to be applied", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "context": { + "type": "string" + }, + "start": { + "type": "number" + }, + "end": { + "type": "number" + }, + "type": { + "type": "string" + }, + "text": { + "type": "string" + }, + "properties": { + "type": "object" + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "path", + "in": "path", + "description": "Relative path to the TEI document to be changed", + "schema": { + "type": "string", + "example": "annotate/graves20.xml" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Returns the merged TEI XML", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/nlp/entities/{id}": { + "get": { + "summary": "Call entity extraction on a document or collection of documents", + "operationId": "nlp:entity-recognition", + "tags": [ + "nlp" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Relative path to collection or single document", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "model", + "in": "query", + "schema": { + "type": "string", + "example": "en_core_web_sm" + }, + "required": true + }, + { + "name": "debug", + "in": "query", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "200": { + "description": "JSON structure listing the entities found", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + }, + "/api/nlp/patterns/{id}": { + "get": { + "summary": "Apply rule-based pattern matching", + "description": "Use rule-based pattern matching to find entities in a document", + "operationId": "nlp:pattern-recognition", + "tags": [ + "nlp" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "lang", + "in": "query", + "schema": { + "type": "string", + "default": "en" + } + }, + { + "name": "debug", + "in": "query", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "200": { + "description": "JSON structure listing the entities found", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/nlp/strings/{id}": { + "get": { + "summary": "Find occurrences of the given string in other documents in the collection", + "operationId": "nlp:strings", + "tags": [ + "nlp" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Relative path to collection", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "format", + "in": "query", + "description": "Format of the JSON structure to return", + "schema": { + "type": "string", + "enum": [ + "offsets", + "annotations" + ], + "default": "annotations" + } + }, + { + "name": "string", + "in": "query", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "type", + "in": "query", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "properties", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "exclude", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "JSON structure listing the entities found", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + }, + "/api/nlp/strings": { + "post": { + "summary": "Find occurrences of the given string in other documents in the collection", + "operationId": "nlp:matches-to-annotations", + "tags": [ + "nlp" + ], + "requestBody": { + "description": "List of matches as returned by a GET with format=offsets", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "JSON structure listing the entities found", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + }, + "/api/nlp/text/{id}": { + "get": { + "summary": "Retrieve plain text of a document", + "description": "Get the plain text of the given document fragment to be fed into entity recognition", + "operationId": "nlp:plain-text", + "tags": [ + "nlp" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "Plain text of the document fragment", + "content": { + "text/text": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/nlp/status": { + "get": { + "summary": "Return status information about NER", + "description": "Return status information about NER, including installed pipelines", + "tags": [ + "nlp" + ], + "operationId": "nlp:status", + "responses": { + "200": { + "description": "JSON object describing status", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/nlp/status/models": { + "get": { + "summary": "Return list of available models", + "tags": [ + "nlp" + ], + "operationId": "nlp:models", + "responses": { + "200": { + "description": "JSON array listing models", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + }, + "/api/nlp/train/{id}": { + "get": { + "summary": "Train an NER model", + "description": "Train an NER model based on training data, which will be generated from a given document or collection", + "tags": [ + "nlp" + ], + "operationId": "nlp:train-model", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Relative path to document or collection", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "name", + "in": "query", + "description": "Name of the model to create", + "schema": { + "type": "string" + }, + "required": true + }, + { + "name": "base", + "in": "query", + "description": "Base model to extend", + "schema": { + "type": "string" + } + }, + { + "name": "lang", + "in": "query", + "description": "Language to create the model for", + "schema": { + "type": "string" + } + }, + { + "name": "copy_vectors", + "in": "query", + "description": "Base model to copy vector layer from", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Process ID of the running training", + "content": { + "application/json": { + "schema": { + "type": "integer" + } + } + } + } + } + } + }, + "/api/nlp/log/{pid}": { + "get": { + "summary": "Return log messages for an ongoing training", + "tags": [ + "nlp" + ], + "operationId": "nlp:log", + "parameters": [ + { + "name": "pid", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Training completed", + "content": { + "text/text": { + "schema": { + "type": "string" + } + } + } + }, + "202": { + "description": "Training in progress", + "content": { + "text/text": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/nlp/data/{id}": { + "get": { + "summary": "Download training data for NER", + "description": "Generate training data for NER from a given document or collection", + "tags": [ + "nlp" + ], + "operationId": "nlp:train", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Relative path to document or collection", + "schema": { + "type": "string" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "JSON array with training data", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + }, + "/api/forms/template/{id}": { + "get": { + "summary": "Retrieve XML template document to be used as a form instance", + "description": "Retrieve whole document as XML", + "tags": [ + "annotations" + ], + "operationId": "rapi:form-template", + "x-constraints": { + "group": "tei" + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "example": "person-template" + } + } + ], + "responses": { + "200": { + "description": "Returns the entire form instance template as XML", + "content": { + "application/xml": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "Document not found", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/register/search/{type}": { + "get": { + "summary": "Search for a register entry", + "operationId": "rapi:query-register", + "tags": [ + "register" + ], + "parameters": [ + { + "name": "type", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "example": "place" + }, + { + "name": "query", + "in": "query", + "schema": { + "type": "string" + }, + "required": true, + "example": "Deya" + } + ], + "responses": { + "200": { + "description": "Results from the local register", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + }, + "/api/register/{type}/{id}": { + "post": { + "summary": "Create a copy of an authority record in the local register", + "description": "Create a copy of an authority record in the local register based on the passed JSON structure. Used by the custom authority connector.", + "tags": [ + "register" + ], + "operationId": "rapi:save-local-copy", + "requestBody": { + "description": "JSON record providing base information for the entry", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "parameters": [ + { + "name": "type", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "example": "place" + }, + { + "name": "id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "example": "Deia" + } + ], + "responses": { + "200": { + "description": "Results from the local register", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + }, + "get": { + "summary": "Retrieve JSON-formatted authority record from the local register", + "description": "Used by the custom authority connector.", + "operationId": "rapi:register-entry", + "tags": [ + "register" + ], + "parameters": [ + { + "name": "type", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "example": "place" + }, + { + "name": "id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "example": "Deia" + }, + { + "name": "format", + "in": "query", + "schema": { + "type": "string", + "default": "json" + } + } + ], + "responses": { + "200": { + "description": "Results from the local register", + "content": { + "application/json": { + "schema": { + "type": "object" + } + }, + "application/xml": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/register": { + "put": { + "summary": "Save a new register entry", + "description": "The type is determined by the passed TEI element", + "tags": [ + "register" + ], + "operationId": "rapi:save", + "x-constraints": { + "group": [ + "tei" + ] + }, + "requestBody": { + "content": { + "application/xml": { + "schema": { + "type": "string" + } + } + } + }, + "responses": { + "201": { + "description": "Entry was saved", + "content": { + "application/xml": { + "schema": { + "type": "string" + } + } + } + }, + "401": { + "description": "Permission denied", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/register/{id}": { + "get": { + "summary": "Retrieve XML for a given register entry", + "description": "Get the XML fragment for a given register entry. Used by the registry forms in the annotation editor.", + "tags": [ + "register" + ], + "operationId": "rapi:entry", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "example": "gnd-139890289" + } + }, + { + "name": "type", + "in": "query", + "required": false, + "schema": { + "type": "string", + "example": "place", + "default": "person" + } + } + ], + "responses": { + "200": { + "description": "Returns the entire entry as XML", + "content": { + "application/xml": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "Entry id not found", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + }, + "delete": { + "summary": "Delete an entry from the register", + "tags": [ + "register" + ], + "operationId": "rapi:delete", + "x-constraints": { + "group": [ + "tei" + ] + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "type", + "in": "query", + "required": true, + "schema": { + "type": "string", + "default": "person" + } + } + ], + "responses": { + "410": { + "description": "Entry deleted" + } + } + }, + "put": { + "summary": "Save a register entry", + "description": "Replace an entry with the current version from the editor", + "tags": [ + "register" + ], + "operationId": "rapi:save", + "x-constraints": { + "group": [ + "tei" + ] + }, + "requestBody": { + "content": { + "application/xml": { + "schema": { + "type": "string" + } + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "example": "gnd-0000001" + } + ], + "responses": { + "201": { + "description": "Entry was saved", + "content": { + "application/xml": { + "schema": { + "type": "string" + } + } + } + }, + "401": { + "description": "Permission denied", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/iiif/{path}": { + "get": { + "summary": "Retrieve IIIF presentation manifest for document", + "operationId": "iiif:manifest", + "tags": [ + "iiif" + ], + "parameters": [ + { + "name": "path", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "IIIF manifest", + "content": { + "application/ld+json": { + "schema": { + "type": "string" + } + } + } + } + } + } + } + }, + "security": [ + { + "cookieAuth": [] + }, + { + "basicAuth": [] + } + ] +} \ No newline at end of file diff --git a/src/main/xar-resources/xqsuite/testrunner.xq b/src/main/xar-resources/xqsuite/testrunner.xq index f8c546b..9ef5e3c 100644 --- a/src/main/xar-resources/xqsuite/testrunner.xq +++ b/src/main/xar-resources/xqsuite/testrunner.xq @@ -2,10 +2,10 @@ xquery version "3.1"; import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; -import module namespace tests="//eeditiones.org/ns/oad/tests" - at "./oad-test.xqm"; +(: import module namespace tests="//eeditiones.org/ns/oad/tests" + at "xmldb:///db/system/repo/oad-1.0.7-SNAPSHOT/xqsuite/oad-test.xqm"; :) -declare variable $path := "./oad-test.xqm"; +declare variable $path := "xmldb:///db/system/repo/oad-1.0.7-SNAPSHOT/xqsuite/oad-test.xqm"; let $test-result := test:suite(inspect:module-functions(xs:anyURI($path)))/node() diff --git a/xar-assembly.xml b/xar-assembly.xml deleted file mode 100644 index 0a9313c..0000000 --- a/xar-assembly.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - ${package-title} - eeditiones.org - ${project.url} - GNU Lesser General Public License, version 3.0 - true - - - library - - - beta - - ${project.artifactId} - library - Libraries - - - - - - - ${basedir} - - README.md - LICENSE - - - - ${basedir}/src/main/xar-resources - - - - - - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - io.swagger.parser.v3 - swagger-parser - ${swagger.version} - - - - - io.swagger.core.v3 - swagger-core - 2.2.19 - - - io.swagger.core.v3 - swagger-models - 2.2.19 - - - io.swagger.parser.v3 - swagger-parser-v3 - ${swagger.version} - - - io.swagger.parser.v3 - swagger-parser-core - ${swagger.version} - - - io.swagger.parser.v3 - swagger-parser-safe-url-resolver - ${swagger.version} - - - com.fasterxml.jackson.core - jackson-core - 2.14.2 - - - com.fasterxml.jackson.core - jackson-databind - 2.15.3 - - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - 2.15.3 - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - 2.15.2 - - - org.yaml - snakeyaml - 2.2 - - - - - - - - ${module.namespace} - urn:java:class:org.eeditiones.oad.${module.java.classname} - - - - diff --git a/xquery-license-style.xml b/xquery-license-style.xml deleted file mode 100644 index a1484e1..0000000 --- a/xquery-license-style.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - (: - : - :) - (\s|\t)*\(:.*$ - .*:\)(\s|\t)*$ - false - true - false - - \ No newline at end of file