diff --git a/.github/actions/git-commit-changed/action.yml b/.github/actions/git-commit-changed/action.yml
new file mode 100644
index 00000000..85ee7990
--- /dev/null
+++ b/.github/actions/git-commit-changed/action.yml
@@ -0,0 +1,26 @@
+name: Git Commit Changed Files
+
+inputs:
+ message:
+ required: true
+ description: The commit message
+ push:
+ required: false
+ default: false
+ description: If the commit should be pushed
+
+runs:
+ using: composite
+ steps:
+ - name: print_status
+ shell: bash
+ run: git status --porcelain
+ - name: commit_changed_files
+ shell: bash
+ run: |
+ git add -u
+ git commit -m "${{ inputs.message }}"
+ - name: push
+ if: ${{ inputs.push == 'true' }}
+ shell: bash
+ run: git push
diff --git a/.github/actions/git-config/action.yml b/.github/actions/git-config/action.yml
new file mode 100644
index 00000000..11355bf8
--- /dev/null
+++ b/.github/actions/git-config/action.yml
@@ -0,0 +1,10 @@
+name: Git Config
+
+runs:
+ using: composite
+ steps:
+ - name: configure_git
+ shell: bash
+ run: |
+ git config --global user.email github-actions@radiantlogic.com
+ git config --global user.name github-actions
\ No newline at end of file
diff --git a/.github/actions/git-tag/action.yml b/.github/actions/git-tag/action.yml
new file mode 100644
index 00000000..cedcd8c0
--- /dev/null
+++ b/.github/actions/git-tag/action.yml
@@ -0,0 +1,15 @@
+name: Git Apply Tag
+
+inputs:
+ tag:
+ required: true
+ description: The git tag to apply
+
+runs:
+ using: composite
+ steps:
+ - name: apply_tag
+ shell: bash
+ run: |
+ git tag "${{ inputs.tag }}"
+ git push --tags
\ No newline at end of file
diff --git a/.github/actions/increment-version-next-snapshot/action.yml b/.github/actions/increment-version-next-snapshot/action.yml
new file mode 100644
index 00000000..8a616a45
--- /dev/null
+++ b/.github/actions/increment-version-next-snapshot/action.yml
@@ -0,0 +1,28 @@
+name: Increment Version to Next Snapshot
+
+inputs:
+ major_version:
+ description: The major version number
+ required: true
+ minor_version:
+ description: The minor version number
+ required: true
+ patch_version:
+ description: The patch version number
+ required: true
+outputs:
+ next_snapshot_version:
+ description: The next snapshot version calculated by this action
+ value: ${{ steps.increment_snapshot_version.outputs.next_snapshot_version }}
+
+runs:
+ using: composite
+ steps:
+ - name: increment_snapshot_version
+ id: increment_snapshot_version
+ shell: bash
+ run: |
+ ${{ github.action_path }}/increment-snapshot.sh \
+ "${{ inputs.major_version }}" \
+ "${{ inputs.minor_version }}" \
+ "${{ inputs.patch_version }}"
\ No newline at end of file
diff --git a/.github/actions/increment-version-next-snapshot/increment-snapshot.sh b/.github/actions/increment-version-next-snapshot/increment-snapshot.sh
new file mode 100755
index 00000000..fa0d3b1f
--- /dev/null
+++ b/.github/actions/increment-version-next-snapshot/increment-snapshot.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+major_version="$1"
+minor_version="$2"
+patch_version="$3"
+
+if [ -z "$major_version" ] || [ -z "$minor_version" ] || [ -z "$patch_version" ]; then
+ echo "Missing required input values" >&2
+ echo "major_version=$major_version" >&2
+ echo "minor_version=$minor_version" >&2
+ echo "patch_version=$patch_version" >&2
+ exit 1
+fi
+
+echo "Incrementing to new snapshot version"
+next_snapshot_version="${major_version}.${minor_version}.$(( "$patch_version" + 1 ))-SNAPSHOT"
+echo "next_snapshot_version=$next_snapshot_version" | tee -a $GITHUB_OUTPUT
\ No newline at end of file
diff --git a/.github/actions/maven-project-info/action.yml b/.github/actions/maven-project-info/action.yml
new file mode 100644
index 00000000..4c74ced3
--- /dev/null
+++ b/.github/actions/maven-project-info/action.yml
@@ -0,0 +1,17 @@
+name: Maven Project Info
+
+outputs:
+ project_name:
+ description: The name of the project
+ value: openapi-java-client-codegen
+ project_version:
+ description: The version of the project
+ value: ${{ steps.get_project_info.outputs.version }}
+
+runs:
+ using: composite
+ steps:
+ - name: Get Project Info
+ id: get_project_info
+ shell: bash
+ run: ${{ github.action_path }}/get-project-info.sh
\ No newline at end of file
diff --git a/.github/actions/maven-project-info/get-project-info.sh b/.github/actions/maven-project-info/get-project-info.sh
new file mode 100755
index 00000000..ddb80c1d
--- /dev/null
+++ b/.github/actions/maven-project-info/get-project-info.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
+echo "version=$version" | tee -a $GITHUB_OUTPUT
\ No newline at end of file
diff --git a/.github/actions/maven-set-version/action.yml b/.github/actions/maven-set-version/action.yml
new file mode 100644
index 00000000..2028d38d
--- /dev/null
+++ b/.github/actions/maven-set-version/action.yml
@@ -0,0 +1,19 @@
+name: Maven Set Version
+
+inputs:
+ version:
+ required: true
+ description: The version to set
+
+runs:
+ using: composite
+ steps:
+ - name: Set Project Version
+ shell: bash
+ run: |
+ version="${{ inputs.version }}"
+ if [ -z "$version" ]; then
+ echo "No version input provided, cannot proceed" >&2
+ exit 1
+ fi
+ mvn versions:set-property -Dproperty=revision -DnewVersion="$version" -DgenerateBackupPoms=false
\ No newline at end of file
diff --git a/.github/actions/parse-release-version/action.yml b/.github/actions/parse-release-version/action.yml
new file mode 100644
index 00000000..5972289c
--- /dev/null
+++ b/.github/actions/parse-release-version/action.yml
@@ -0,0 +1,32 @@
+name: Parse Release Version
+inputs:
+ release_version:
+ required: true
+ description: The version number for the release. Must be a valid semver number.
+outputs:
+ major_version:
+ description: The major version number.
+ value: ${{ steps.parse_version.outputs.major_version }}
+ minor_version:
+ description: The minor version number.
+ value: ${{ steps.parse_version.outputs.minor_version }}
+ patch_version:
+ description: The patch version number.
+ value: ${{ steps.parse_version.outputs.patch_version }}
+ qualifier_name:
+ description: The qualifier name, if present.
+ value: ${{ steps.parse_version.outputs.qualifier_name }}
+ qualifier_version:
+ description: The qualifier version, if present.
+ value: ${{ steps.parse_version.outputs.qualifier_version }}
+
+runs:
+ using: composite
+ steps:
+ - name: Print Version
+ shell: bash
+ run: echo "${{ inputs.release_version }}"
+ - name: Parse Version
+ id: parse_version
+ shell: bash
+ run: ${{ github.action_path }}/parse-version.sh "${{ inputs.release_version }}"
\ No newline at end of file
diff --git a/.github/actions/parse-release-version/parse-version.sh b/.github/actions/parse-release-version/parse-version.sh
new file mode 100755
index 00000000..c004526d
--- /dev/null
+++ b/.github/actions/parse-release-version/parse-version.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+version="$1"
+
+pattern='^([0-9]+)\.([0-9]+)\.([0-9]+)(-(alpha|beta|rc)\.([0-9]+))?$'
+echo "Comparing $version to regex $pattern"
+if [[ ! "$version" =~ $pattern ]]; then
+ echo "Release version '$version' does not match semver pattern, aborting" >&2
+ exit 1
+fi
+
+major_version="${BASH_REMATCH[1]}"
+minor_version="${BASH_REMATCH[2]}"
+patch_version="${BASH_REMATCH[3]}"
+qualifier_name="${BASH_REMATCH[5]-$""}"
+qualifier_version="${BASH_REMATCH[6]-$""}"
+
+echo "major_version=$major_version" | tee -a $GITHUB_OUTPUT
+echo "minor_version=$minor_version" | tee -a $GITHUB_OUTPUT
+echo "patch_version=$patch_version" | tee -a $GITHUB_OUTPUT
+echo "qualifier_name=$qualifier_name" | tee -a $GITHUB_OUTPUT
+echo "qualifier_version=$qualifier_version" | tee -a $GITHUB_OUTPUT
+
+if [ -n "$qualifier_name" ] || [ -n "$qualifier_version" ]; then
+ echo "This pipeline does not currently support releasing with semver qualifiers. Auto-versioning will not work. Please stick to major/minor/patch versions or upgrade the pipeline." >&2
+ exit 1
+fi
\ No newline at end of file
diff --git a/.github/actions/setup-java/action.yml b/.github/actions/setup-java/action.yml
new file mode 100644
index 00000000..7f161008
--- /dev/null
+++ b/.github/actions/setup-java/action.yml
@@ -0,0 +1,35 @@
+name: Setup Java
+
+inputs:
+ pom_artifact_name:
+ required: false
+ description: >-
+ If this is being called as part of a workflow where the pom.xml has been
+ modified (ie, releases), the name of the artifact should be defined here
+ and it will be downloaded.
+ default: ""
+
+runs:
+ using: composite
+ steps:
+ - name: Download Pom Artifact
+ if: ${{ inputs.pom_artifact_name != '' }}
+ uses: actions/download-artifact@v4
+ with:
+ name: ${{ inputs.pom_artifact_name }}
+ path: .
+ - name: Write Run ID For Cache Key
+ shell: bash
+ run: echo "run_id=${{ github.run_id }}" | tee run_id.txt
+ - name: Setup Java
+ uses: actions/setup-java@v4
+ with:
+ java-version: 24
+ distribution: temurin
+ cache: maven
+ cache-dependency-path: run_id.txt
+ - name: Resolve Dependencies To Populate Cache
+ shell: bash
+ run: |
+ mvn dependency:go-offline
+ mvn test-compile
\ No newline at end of file
diff --git a/.github/workflows/core-docker-build.yml b/.github/workflows/core-docker-build.yml
new file mode 100644
index 00000000..903fdd10
--- /dev/null
+++ b/.github/workflows/core-docker-build.yml
@@ -0,0 +1,40 @@
+name: Docker Build
+
+on:
+ workflow_call:
+ inputs:
+ image_name:
+ type: string
+ required: true
+ image_tag:
+ type: string
+ required: true
+ secrets:
+ DOCKERHUB_PASSWORD:
+ required: true
+
+jobs:
+ build_docker_image:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/download-artifact@v4
+ with:
+ name: project_artifacts
+ path: .
+ - name: Login to DockerHub
+ uses: docker/login-action@v3
+ with:
+ username: ${{ vars.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_PASSWORD }}
+ - name: Setup QEMU
+ uses: docker/setup-qemu-action@v3
+ - name: Setup Docker Buildx
+ uses: docker/setup-buildx-action@v3
+ - name: Build and Push
+ uses: docker/build-push-action@v6
+ with:
+ push: true
+ tags: rlidev/${{ inputs.image_name }}:${{ inputs.image_tag }}
+ context: .
+ platforms: linux/amd64,linux/arm64
\ No newline at end of file
diff --git a/.github/workflows/core-maven-build.yml b/.github/workflows/core-maven-build.yml
new file mode 100644
index 00000000..7247f230
--- /dev/null
+++ b/.github/workflows/core-maven-build.yml
@@ -0,0 +1,119 @@
+name: Maven Build
+
+on:
+ workflow_call:
+ inputs:
+ is_release:
+ required: false
+ type: boolean
+ default: false
+ description: If this is being called as part of a release
+ outputs:
+ project_name:
+ description: The name of the project
+ value: ${{ jobs.project_info.outputs.project_name }}
+ project_version:
+ description: The version of the project
+ value: ${{ jobs.project_info.outputs.project_version }}
+
+jobs:
+ project_info:
+ runs-on: ubuntu-latest
+ outputs:
+ project_version: ${{ steps.maven_project_info.outputs.project_version }}
+ project_name: ${{ steps.maven_project_info.outputs.project_name }}
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup Java
+ uses: ./.github/actions/setup-java
+ with:
+ pom_artifact_name: ${{ inputs.is_release && 'release_pom_xml' || '' }}
+ - id: maven_project_info
+ name: Get Project Info
+ uses: ./.github/actions/maven-project-info
+
+ build_artifact:
+ runs-on: ubuntu-latest
+ needs: ['project_info']
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup Java
+ uses: ./.github/actions/setup-java
+ with:
+ pom_artifact_name: ${{ inputs.is_release && 'release_pom_xml' || '' }}
+ - name: Build Artifact
+ run: mvn test-compile package -DskipTests
+ - uses: actions/upload-artifact@v4
+ with:
+ name: project_artifacts
+ path: ./codegen-modules/openapi-java-client-codegen/target/*.jar
+
+ run_unit_tests:
+ runs-on: ubuntu-latest
+ needs: ['build_artifact']
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup Java
+ uses: ./.github/actions/setup-java
+ with:
+ pom_artifact_name: ${{ inputs.is_release && 'release_pom_xml' || '' }}
+ - name: Run Unit Tests
+ run: mvn test
+
+ run_pmd:
+ runs-on: ubuntu-latest
+ needs: ['build_artifact']
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup Java
+ uses: ./.github/actions/setup-java
+ with:
+ pom_artifact_name: ${{ inputs.is_release && 'release_pom_xml' || '' }}
+ - name: Run PMD
+ run: mvn pmd:check
+
+ run_spotless:
+ runs-on: ubuntu-latest
+ needs: ['build_artifact']
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup Java
+ uses: ./.github/actions/setup-java
+ with:
+ pom_artifact_name: ${{ inputs.is_release && 'release_pom_xml' || '' }}
+ - name: Run Spotless
+ run: mvn spotless:check
+
+ run_integration_tests:
+ runs-on: ubuntu-latest
+ needs: ['build_artifact']
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup Java
+ uses: ./.github/actions/setup-java
+ with:
+ pom_artifact_name: ${{ inputs.is_release && 'release_pom_xml' || '' }}
+ - name: Run Integration Tests
+ run: mvn integration-test -Dskip.surefire.tests
+ - name: Upload Integration Test Artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: integration_test_artifacts
+ path: ~/.m2/repository/com/radiantlogic/openapi/generated/**/*
+
+ run_usage_tests:
+ runs-on: ubuntu-latest
+ needs: ['run_integration_tests']
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup Java
+ uses: ./.github/actions/setup-java
+ with:
+ pom_artifact_name: ${{ inputs.is_release && 'release_pom_xml' || '' }}
+ - name: Download Integration Test Artifacts
+ uses: actions/download-artifact@v4
+ with:
+ name: integration_test_artifacts
+ path: ~/.m2/repository/com/radiantlogic/openapi/generated
+ - name: Run Usage Tests
+ run: mvn -P usage test
\ No newline at end of file
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 00000000..edbecec5
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,25 @@
+name: Main Branch
+
+on:
+ push:
+ branches: ['main']
+ workflow_dispatch:
+
+concurrency:
+ cancel-in-progress: true
+ group: ${{ github.workflow }}-${{ github.ref }}
+
+jobs:
+ run_maven_build:
+ uses: ./.github/workflows/core-maven-build.yml
+ with:
+ is_release: false
+
+ run_docker_build:
+ uses: ./.github/workflows/core-docker-build.yml
+ needs: ['run_maven_build']
+ with:
+ image_name: ${{ needs.run_maven_build.outputs.project_name }}
+ image_tag: ${{ needs.run_maven_build.outputs.project_version }}
+ secrets:
+ DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
\ No newline at end of file
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
new file mode 100644
index 00000000..914ffeaa
--- /dev/null
+++ b/.github/workflows/pr.yml
@@ -0,0 +1,15 @@
+name: Pull Request
+
+on:
+ pull_request:
+ branches: [ 'main' ]
+
+concurrency:
+ cancel-in-progress: true
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
+
+jobs:
+ run_maven_build:
+ uses: ./.github/workflows/core-maven-build.yml
+ with:
+ is_release: false
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000..ec0c9704
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,99 @@
+name: Release
+on:
+ workflow_dispatch:
+ inputs:
+ release_version:
+ type: string
+ required: true
+ description: The version number for the release. Must be a valid semver number.
+
+concurrency:
+ cancel-in-progress: true
+ group: ${{ github.workflow }}
+
+permissions:
+ contents: write
+
+jobs:
+ parse_release_version:
+ runs-on: ubuntu-latest
+ outputs:
+ major_version: ${{ steps.parse_version.outputs.major_version }}
+ minor_version: ${{ steps.parse_version.outputs.minor_version }}
+ patch_version: ${{ steps.parse_version.outputs.patch_version }}
+ steps:
+ - uses: actions/checkout@v4
+ - name: parse_version
+ id: parse_version
+ uses: ./.github/actions/parse-release-version
+ with:
+ release_version: ${{ inputs.release_version }}
+
+ set_project_release_version:
+ runs-on: ubuntu-latest
+ needs: ['parse_release_version']
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup Java
+ uses: ./.github/actions/setup-java
+ - uses: ./.github/actions/maven-set-version
+ with:
+ version: ${{ inputs.release_version }}
+ - uses: actions/upload-artifact@v4
+ with:
+ name: release_pom_xml
+ path: pom.xml
+
+ run_maven_build:
+ uses: ./.github/workflows/core-maven-build.yml
+ with:
+ is_release: true
+ needs: ['set_project_release_version']
+
+ run_docker_build:
+ uses: ./.github/workflows/core-docker-build.yml
+ needs: [ 'run_maven_build' ]
+ with:
+ image_name: ${{ needs.run_maven_build.outputs.project_name }}
+ image_tag: ${{ inputs.release_version }}
+ secrets:
+ DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
+
+ apply_git_tag:
+ runs-on: ubuntu-latest
+ needs: ['run_docker_build']
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/download-artifact@v4
+ with:
+ name: release_pom_xml
+ path: .
+ - uses: ./.github/actions/git-config
+ - uses: ./.github/actions/git-commit-changed
+ with:
+ message: Updating project version to ${{ inputs.release_version }}
+ push: false
+ - uses: ./.github/actions/git-tag
+ with:
+ tag: v${{ inputs.release_version }}
+
+ increment_project_snapshot_version:
+ runs-on: ubuntu-latest
+ needs: ['run_docker_build', 'parse_release_version']
+ steps:
+ - uses: actions/checkout@v4
+ - name: increment_version
+ id: increment_version
+ uses: ./.github/actions/increment-version-next-snapshot
+ with:
+ major_version: ${{ needs.parse_release_version.outputs.major_version }}
+ minor_version: ${{ needs.parse_release_version.outputs.minor_version }}
+ patch_version: ${{ needs.parse_release_version.outputs.patch_version }}
+ - uses: ./.github/actions/maven-set-version
+ with:
+ version: ${{ steps.increment_version.outputs.next_snapshot_version }}
+ - uses: ./.github/actions/git-config
+ - uses: ./.github/actions/git-commit-changed
+ with:
+ message: Updating project version to ${{ steps.increment_version.outputs.next_snapshot_version }}
+ push: true
diff --git a/CICD.txt b/CICD.txt
new file mode 100644
index 00000000..b870a128
--- /dev/null
+++ b/CICD.txt
@@ -0,0 +1,20 @@
+CI/CD Plan
+
+Validations
+- Run codegen unit tests
+- Run codegen integration tests
+- Run usage unit tests
+- Run spotless check
+- Run PMD check
+
+PRs
+- Build the codegen artifact
+- Perform Validations
+
+Main Build
+- Build the codegen artifact
+- Perform Validations
+- Build docker image, with pom version.
+- Push docker image
+
+DO GITHUB ACTIONS CONTAIN INPUTS FOR RELEASE VERSIONING LIKE GITLAB?
\ No newline at end of file
diff --git a/README.md b/README.md
index e7b8a11b..7daf7888 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,10 @@ The primary use for the generated code is to support building custom connectors
- The quality of the generated code is directly correlated to the quality of the OpenAPI specification.
- Only OpenAPI 3 is supported.
+## Using the Codegen
+
+TBD
+
## Development
### Modules
@@ -77,4 +81,9 @@ A robust set of end-to-end tests have been constructed to validate the behavior
First is the `integration.com.radiantlogic.openapi.codegen.javaclient.CodegenIT` class in `codegen-modules/openapi-java-client-codegen`. This test suite executes the code generation against a wide range of official OpenAPI specs from a variety of companies. It generates, compiles, and installs the maven artifacts from those specs.
-Next is the full test suite in `usage-modules/openapi-java-client-usage`. Once all tests from `CodegenIT` complete successfully, all the artifacts will be available in the local `.m2` directory. At that point the test suite in this project can be run to execute a variety of java client operations against a mock server. This validates that the generated code performs as-expected.
\ No newline at end of file
+Next is the full test suite in `usage-modules/openapi-java-client-usage`. Once all tests from `CodegenIT` complete successfully, all the artifacts will be available in the local `.m2` directory. At that point the test suite in this project can be run to execute a variety of java client operations against a mock server. This validates that the generated code performs as-expected.
+
+## CI/CD
+
+TBD
+Don't forget about the username & password variables in docs
\ No newline at end of file
diff --git a/codegen-modules/openapi-java-client-codegen/src/main/java/com/radiantlogic/openapi/codegen/javaclient/args/ArgsParser.java b/codegen-modules/openapi-java-client-codegen/src/main/java/com/radiantlogic/openapi/codegen/javaclient/args/ArgsParser.java
index c0d0f928..cce77a90 100644
--- a/codegen-modules/openapi-java-client-codegen/src/main/java/com/radiantlogic/openapi/codegen/javaclient/args/ArgsParser.java
+++ b/codegen-modules/openapi-java-client-codegen/src/main/java/com/radiantlogic/openapi/codegen/javaclient/args/ArgsParser.java
@@ -98,7 +98,7 @@ public Args parse(@NonNull final String[] args) {
private URL parseOpenapiPath(@NonNull final String openapiPath) {
try {
return new URI(openapiPath).toURL();
- } catch (final MalformedURLException | URISyntaxException ex) {
+ } catch (final MalformedURLException | URISyntaxException | IllegalArgumentException ex) {
try {
final Path absoluteFilePath = Paths.get(openapiPath);
if (Files.exists(absoluteFilePath)) {
diff --git a/codegen-modules/openapi-java-client-codegen/src/main/java/com/radiantlogic/openapi/codegen/javaclient/generate/CodeGeneratorExecutor.java b/codegen-modules/openapi-java-client-codegen/src/main/java/com/radiantlogic/openapi/codegen/javaclient/generate/CodeGeneratorExecutor.java
index c8827efd..4795a865 100644
--- a/codegen-modules/openapi-java-client-codegen/src/main/java/com/radiantlogic/openapi/codegen/javaclient/generate/CodeGeneratorExecutor.java
+++ b/codegen-modules/openapi-java-client-codegen/src/main/java/com/radiantlogic/openapi/codegen/javaclient/generate/CodeGeneratorExecutor.java
@@ -28,6 +28,7 @@ public void generate(final OpenAPI openAPI) {
generator.setGeneratorPropertyDefault(CodegenConstants.SKIP_FORM_MODEL, "false");
generator.opts(new ClientOptInput().config(codegen).openAPI(openAPI)).generate();
+ log.info("Code generation complete");
}
private void prepareOutputDirectory(
diff --git a/codegen-modules/openapi-java-client-codegen/src/test/java/com/radiantlogic/openapi/codegen/javaclient/integration/CodegenIT.java b/codegen-modules/openapi-java-client-codegen/src/test/java/com/radiantlogic/openapi/codegen/javaclient/integration/CodegenIT.java
index ea62cda0..25783539 100644
--- a/codegen-modules/openapi-java-client-codegen/src/test/java/com/radiantlogic/openapi/codegen/javaclient/integration/CodegenIT.java
+++ b/codegen-modules/openapi-java-client-codegen/src/test/java/com/radiantlogic/openapi/codegen/javaclient/integration/CodegenIT.java
@@ -3,13 +3,17 @@
import static org.assertj.core.api.Assertions.assertThat;
import com.radiantlogic.openapi.codegen.javaclient.Runner;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Duration;
+import java.util.concurrent.TimeUnit;
import lombok.NonNull;
import lombok.SneakyThrows;
import org.apache.commons.io.FileUtils;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@@ -23,6 +27,32 @@ public class CodegenIT {
private static final Path OUTPUT_DIR = Paths.get(System.getProperty("user.dir"), "output");
private static final Duration WAIT_FOR_BUILD = Duration.ofMinutes(2);
+ private static long peakMemory = 0;
+
+ /**
+ * This prints the memory being used on an ongoing basis. This is useful information due to the
+ * sheer absurd size of some of the specs.
+ */
+ @BeforeAll
+ static void beforeAll() {
+ new Thread(
+ () -> {
+ while (true) {
+ final long amount =
+ Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
+ if (amount > peakMemory) {
+ peakMemory = amount;
+ }
+ System.out.printf("Memory Current: %,d Peak: %,d%n", amount, peakMemory);
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ }
+ }
+ })
+ .start();
+ }
+
@Test
void oktaIdpMinimal() {
generateAndBuild("okta-idp-minimal-2025.01.1.yaml", "MyAccount-Management/2025.01.1");
@@ -152,24 +182,39 @@ void brokenDiscriminatorTest() {
private void generateAndBuild(
@NonNull final String yamlFilename, @NonNull final String relativeOutputPath) {
final Path outputPath = OUTPUT_DIR.resolve(relativeOutputPath);
+ System.out.printf("Cleaning output directory %s%n", outputPath);
FileUtils.deleteDirectory(outputPath.toFile());
final URL url = getClass().getClassLoader().getResource("openapi/%s".formatted(yamlFilename));
final Path yamlPath = Paths.get(url.toURI());
+ System.out.printf("Running codegen for spec file %s%n", yamlPath);
final Runner runner = new Runner();
final String[] args = new String[] {"-p=%s".formatted(yamlPath.toString())};
runner.run(args);
+ System.out.printf("Codegen complete. Building generated code at %s%n", outputPath);
+
+ final int exitValue = runProcess("mvn clean install -DskipTests", outputPath);
+
+ assertThat(exitValue).isEqualTo(0);
+ System.out.println("Build of generated code completed successfully.");
+ }
+
+ @SneakyThrows
+ private int runProcess(@NonNull final String command, @NonNull final Path directory) {
final Process process =
- new ProcessBuilder("mvn", "clean", "install", "-DskipTests")
- .directory(outputPath.toFile())
- .inheritIO()
+ new ProcessBuilder(command.split(" "))
+ .directory(directory.toFile())
+ .redirectErrorStream(true)
.start();
- final boolean waitSuccess = process.waitFor(WAIT_FOR_BUILD);
- assertThat(waitSuccess).withFailMessage("Wait for build of generated code timed out.").isTrue();
+ try (BufferedReader reader =
+ new BufferedReader(new InputStreamReader(process.getInputStream()))) {
+ reader.lines().forEach(System.out::println);
+ }
- final int exitValue = process.exitValue();
- assertThat(exitValue).isEqualTo(0);
+ final boolean waitSuccess = process.waitFor(WAIT_FOR_BUILD.toMillis(), TimeUnit.MILLISECONDS);
+ assertThat(waitSuccess).withFailMessage("Wait for build of generated code timed out.").isTrue();
+ return process.exitValue();
}
}
diff --git a/pom.xml b/pom.xml
index 3d5f6867..adcb0c45 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
- 1.0.0-SNAPSHOT
+ 0.0.1-SNAPSHOT
1.18.38
UTF-8
7.12.0
@@ -43,6 +43,7 @@
1.6.3
./codegen-modules/openapi-java-client-codegen
./usage-modules/openapi-java-client-usage
+ ${skipTests}
@@ -50,7 +51,7 @@
com.fasterxml.jackson
jackson-bom
- 2.19.0
+ 2.19.1
pom
import
@@ -106,7 +107,7 @@
org.openapitools
openapi-generator
- 7.13.0
+ 7.14.0
org.wiremock
@@ -228,11 +229,28 @@
org.apache.maven.plugins
maven-surefire-plugin
3.5.3
+
+ ${skip.surefire.tests}
+
org.apache.maven.plugins
maven-failsafe-plugin
3.5.3
+
+
+
+ integration-test
+ verify
+
+ integration-test
+
+
+
+ false
+ false
+ -Xmx8000m
+