Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
target/

*.iml
build/
.gradle/
.idea/
.vscode/
.tool-versions
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
java zulu-8.68.0.21
java zulu-21.40.17
48 changes: 29 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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-<version>.xar` file in the `target/` sub-folder.
will create a `oad-<version>.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
Expand All @@ -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

Expand Down
74 changes: 74 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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>("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>("wrapper") {
gradleVersion = "9.4.1"
distributionType = Wrapper.DistributionType.BIN
}
7 changes: 7 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.jvmargs=-Xmx2g

# Project properties
archivesBaseName=oad
version=1.0.8
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Loading