From 6b4a5a89ad6549a884a023fbd86af8986a3aee95 Mon Sep 17 00:00:00 2001 From: Omar Aljarrah <50204418+OmarAlJarrah@users.noreply.github.com> Date: Thu, 1 Aug 2024 17:22:47 +0300 Subject: [PATCH 01/10] chore: add string to pascal case extension (#643) PR: https://github.com/ExpediaGroup/expediagroup-java-sdk/pull/643 --- .../sdk/generators/openapi/Extensions.kt | 22 +++++++++++++++++++ .../generators/openapi/OpenApiSdkGenerator.kt | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/Extensions.kt diff --git a/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/Extensions.kt b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/Extensions.kt new file mode 100644 index 000000000..7bcfd9411 --- /dev/null +++ b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/Extensions.kt @@ -0,0 +1,22 @@ +package com.expediagroup.sdk.generators.openapi + +/** + * This extension function converts a string to PascalCase. + * PascalCase is a type of identifier that consists of compound words or phrases such that each word or abbreviation begins with a capital letter. + * Non-alphabetic characters are ignored, and the next alphabetic character after them is capitalized. + * + * @receiver String The string to be converted to PascalCase. + * @return String The string converted to PascalCase. + */ +fun String.pascalCase(): String { + var capitalizeNext = true + val builder = StringBuilder() + forEach { char -> + when { + char.isLetterOrDigit().and(capitalizeNext) -> builder.append(char.uppercaseChar()) + char.isLetterOrDigit() -> builder.append(char) + } + capitalizeNext = char.isLetter().not().or(builder.isEmpty()) + } + return builder.toString() +} diff --git a/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt index 9eb6c6b87..c7fbf2c7e 100644 --- a/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt +++ b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt @@ -107,7 +107,7 @@ class OpenApiSdkGenerator { // Template specific properties addAdditionalProperty("shadePrefix", product.shadePrefix) addAdditionalProperty("namespace", product.namespace) - addAdditionalProperty("clientClassname", namespace.replaceFirstChar { it.uppercaseChar() }) + addAdditionalProperty("clientClassname", namespace.pascalCase()) addAdditionalProperty("language", product.programmingLanguage.id) addAdditionalProperty("isKotlin", ProgrammingLanguage.isKotlin(product.programmingLanguage)) addAdditionalProperty("isRapid", ProductFamily.isRapid(product.namespace)) From bae5bd494ad988aa5a43b6335f644266a9696eb2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 4 Aug 2024 11:35:57 +0300 Subject: [PATCH 02/10] build(deps): bump org.checkerframework:checker-qual from 3.45.0 to 3.46.0 (#646) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 40c64a53f..975ac783a 100644 --- a/pom.xml +++ b/pom.xml @@ -277,7 +277,7 @@ org.checkerframework checker-qual - 3.45.0 + 3.46.0 com.google.errorprone From 88fbbe956a23c4bfb4e20cdb32b0cb4c9401cafa Mon Sep 17 00:00:00 2001 From: Omar Aljarrah <50204418+OmarAlJarrah@users.noreply.github.com> Date: Sun, 4 Aug 2024 12:57:35 +0300 Subject: [PATCH 03/10] chore: add test run interface github action (#637) PR: https://github.com/ExpediaGroup/expediagroup-java-sdk/pull/637 --- .github/workflows/generator-generate.yaml | 6 ++ .github/workflows/generator-test-sdk.yaml | 65 +++++++++++++ .github/workflows/run-tests.yaml | 107 ++++++++++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 .github/workflows/generator-test-sdk.yaml create mode 100644 .github/workflows/run-tests.yaml diff --git a/.github/workflows/generator-generate.yaml b/.github/workflows/generator-generate.yaml index 2fdbb0f23..988eb4d25 100644 --- a/.github/workflows/generator-generate.yaml +++ b/.github/workflows/generator-generate.yaml @@ -41,6 +41,12 @@ jobs: path: | generator/openapi/target/sdk !generator/openapi/target/sdk/target + - uses: actions/upload-artifact@v4 + with: + name: jar + path: | + generator/openapi/target/sdk/target/*.jar + generator/openapi/target/sdk/target/maven-archiver/pom.properties - uses: actions/upload-artifact@v4 with: name: docs diff --git a/.github/workflows/generator-test-sdk.yaml b/.github/workflows/generator-test-sdk.yaml new file mode 100644 index 000000000..2e312aac1 --- /dev/null +++ b/.github/workflows/generator-test-sdk.yaml @@ -0,0 +1,65 @@ +name: Generate Test SDK +on: + workflow_call: + inputs: + version: + description: 'SDK version to generate test jar for' + required: true + type: string + namespace: + description: 'SDK to generate test jar for' + required: true + type: string + endpoint_prefix: + description: 'Endpoint to prepend specs paths with' + required: true + type: string + outputs: + artifactId: + value: ${{ jobs.sdk-metadata.outputs.artifactId }} + groupId: + value: ${{ jobs.sdk-metadata.outputs.groupId }} + version: + value: ${{ jobs.sdk-metadata.outputs.version }} + +jobs: + download-specs: + uses: ./.github/workflows/generator-download-specs.yaml + with: + url: ${{ inputs.specs_url }} + transform-specs: + needs: [ download-specs ] + uses: ./.github/workflows/generator-transform-specs.yaml + with: + configurations: -th -te ${{ inputs.endpoint_prefix }} --operationIdsToTags + generate-sdk: + needs: [ transform-specs ] + uses: ./.github/workflows/generator-generate.yaml + with: + name: ${{ inputs.namespace }} + version: ${{ inputs.version }} + sdk-metadata: + runs-on: ubuntu-latest + needs: [ generate-sdk ] + outputs: + artifactId: ${{ steps.parse-metadata.outputs.artifactId }} + groupId: ${{ steps.parse-metadata.outputs.groupId }} + version: ${{ steps.parse-metadata.outputs.version }} + steps: + - uses: actions/download-artifact@v4 + with: + name: jar + path: jar + - id: parse-metadata + working-directory: jar/maven-archiver + shell: python -u {0} + run: | + import os + + metadata: dict = dict() + with open("pom.properties") as properties: + metadata = dict(line.strip().split('=') for line in filter(bool, properties.readlines())) + + with open(os.getenv("GITHUB_OUTPUT"), "a") as GITHUB_OUTPUT: + for key, value in metadata.items(): + print(f"{key}={value}", file=GITHUB_OUTPUT) diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml new file mode 100644 index 000000000..3799d9efc --- /dev/null +++ b/.github/workflows/run-tests.yaml @@ -0,0 +1,107 @@ +name: Run Tests +on: + push: + workflow_dispatch: + inputs: + source: + description: 'Source of tests' + required: true + type: choice + options: + - 'specs' + - 'sdk' + default: 'sdk' + specs_url: + description: 'Run tests based on specs' + required: false + type: string + default: '' + sdk_version: + description: 'Run tests based on SDK' + required: false + type: string + default: 'LATEST' + sdk_namespace: + description: 'SDK to test' + required: true + type: string + default: 'rapid' + endpoint_prefix: + description: 'Endpoint to prepend specs paths with' + required: true + type: string + jdk: + description: 'JDK version to use' + required: true + type: choice + options: + - '21' + - '17' + - '11' + - '8' + default: '21' + workflow_call: + inputs: + source: + description: 'Source of tests' + required: true + type: string + default: 'sdk' + specs_url: + description: 'Run tests based on specs' + required: false + type: string + default: '' + sdk_version: + description: 'Run tests based on SDK' + required: false + type: string + default: 'LATEST' + sdk_namespace: + description: 'SDK to test' + required: true + type: string + default: 'rapid' + jdk: + description: 'JDK version to use' + required: true + type: string + default: '17' + endpoint_prefix: + description: 'Endpoint to prepend specs paths with' + required: true + type: string + +jobs: + inputs-validation: + runs-on: ubuntu-latest + steps: + - shell: python -u {0} + run: | + if 'specs' in '${{ github.event.inputs.source }}' and not('${{ github.event.inputs.specs_url }}'): + print('::error::Invalid specs URL: ${{ github.event.inputs.specs_url }}') + exit(1) + + if 'sdk' in '${{ github.event.inputs.source }}' and not('${{ github.event.inputs.sdk_version }}'): + print('::error::Invalid SDK version: ${{ github.event.inputs.sdk_version }}') + exit(1) + generate-test-sdk: + if: ${{ github.event.inputs.source == 'specs' }} + needs: [ inputs-validation ] + uses: ./.github/workflows/generator-test-sdk.yaml + with: + version: ${{ github.event.inputs.sdk_version }} + namespace: ${{ github.event.inputs.sdk_namespace }} + endpoint_prefix: ${{ github.event.inputs.endpoint_prefix }} + secrets: inherit + run-rapid-examples: + if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') + needs: [ generate-test-sdk ] + uses: "ExpediaGroup/rapid-java-sdk/.github/workflows/run-examples.yaml@main" + with: + sdk_version: ${{ needs.generate-test-sdk.outputs.version }} + jdk: ${{ github.event.inputs.jdk }} + sdk_generation_workflow_run_id: ${{ github.run_id }} + secrets: + KEY: ${{ secrets.RAPID_KEY }} + SECRET: ${{ secrets.RAPID_SECRET }} From d62b4607224039e107c644c85d94e4d601b3f5e6 Mon Sep 17 00:00:00 2001 From: Mohammad Noor Abu Khleif Date: Tue, 6 Aug 2024 14:15:11 +0300 Subject: [PATCH 04/10] feat: support self serve SDK generation (#647) --- .github/workflows/selfserve-generate.yaml | 65 +++++++++++++++++++ generator/openapi/pom.xml | 3 + .../generators/openapi/OpenApiSdkGenerator.kt | 5 +- 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/selfserve-generate.yaml diff --git a/.github/workflows/selfserve-generate.yaml b/.github/workflows/selfserve-generate.yaml new file mode 100644 index 000000000..c2ce61ad7 --- /dev/null +++ b/.github/workflows/selfserve-generate.yaml @@ -0,0 +1,65 @@ +name: Generate SDK + +on: + workflow_call: + inputs: + name: + description: 'SDK Name' + required: true + type: string + version: + description: 'SDK Version' + required: true + type: string + templates: + description: 'Path to the templates directory' + required: true + type: string + specs_key: + description: 'Key to the transformed and ready to use specs artifact and name (without extension, e.g. specs, the file is expected to have the extension .yaml)' + default: 'specs' + type: string + sdk_key: + description: 'Key to the generated SDK artifact' + default: 'sdk' + type: string + +jobs: + generate: + runs-on: ubuntu-latest + steps: + - name: Checkout EG SDK Repository + uses: actions/checkout@v4 + with: + repository: 'ExpediaGroup/expediagroup-java-sdk' + path: sdk-repo + + - name: Download Specs + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.specs_key }} + path: sdk-repo/generator/openapi + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + + - name: Generate Product SDK + working-directory: sdk-repo/generator/openapi + run: | + mvn clean install exec:java "-Dnamespace=${{ inputs.name }}" -DsdkVersion=${{ inputs.version }} "-Dspec=./${{ inputs.specs_key }}.yaml" -DtemplatesDir="${{ inputs.templates }}" + + - name: Install SDK + working-directory: sdk-repo/generator/openapi/target/sdk + run: | + mvn clean install + + - name: Persist SDK Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.sdk_key }} + path: | + sdk-repo/generator/openapi/target/sdk + !sdk-repo/generator/openapi/target/sdk/target diff --git a/generator/openapi/pom.xml b/generator/openapi/pom.xml index d119fd42f..a1a0204fa 100644 --- a/generator/openapi/pom.xml +++ b/generator/openapi/pom.xml @@ -65,6 +65,7 @@ example 0.0.1-SNAPSHOT java + templates/expediagroup-sdk 2.0.0 @@ -397,6 +398,8 @@ ${sdkVersion} --language ${language} + -t + ${templatesDir} diff --git a/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt index c7fbf2c7e..098ca7208 100644 --- a/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt +++ b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt @@ -74,13 +74,16 @@ class OpenApiSdkGenerator { @Option(name = ["-l", "--language"]) lateinit var programmingLanguage: String + @Option(name = ["-t", "--templates-dir"]) + lateinit var templateDir: String + fun run() { try { val product = Product(namespace, programmingLanguage) val config = CodegenConfigurator().apply { setGeneratorName("kotlin") - setTemplateDir("templates/expediagroup-sdk") + setTemplateDir(templateDir) setInputSpec(inputFile) setOutputDir(outputDirectory) setArtifactId(product.artifactId) From 1e0c4661a9eb0e2d71fc7ca8507490a491427375 Mon Sep 17 00:00:00 2001 From: Mohammad Noor Abu Khleif Date: Wed, 7 Aug 2024 15:12:58 +0300 Subject: [PATCH 05/10] feat: SDK-1404 update pom file to work with any generic product (#649) --- generator/openapi/pom.xml | 3 + .../sdk/generators/openapi/Extensions.kt | 15 + .../generators/openapi/OpenApiSdkGenerator.kt | 6 +- .../com/expediagroup/sdk/product/Product.kt | 4 +- .../templates/expediagroup-sdk/pom.mustache | 539 ++++++++++++++---- 5 files changed, 463 insertions(+), 104 deletions(-) diff --git a/generator/openapi/pom.xml b/generator/openapi/pom.xml index a1a0204fa..c68987da5 100644 --- a/generator/openapi/pom.xml +++ b/generator/openapi/pom.xml @@ -66,6 +66,7 @@ 0.0.1-SNAPSHOT java templates/expediagroup-sdk + test-sdk 2.0.0 @@ -400,6 +401,8 @@ ${language} -t ${templatesDir} + -r + ${repoName} diff --git a/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/Extensions.kt b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/Extensions.kt index 7bcfd9411..4eb56db94 100644 --- a/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/Extensions.kt +++ b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/Extensions.kt @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 Expedia, Inc. + * + * 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 + * + * http://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. + */ package com.expediagroup.sdk.generators.openapi /** diff --git a/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt index 098ca7208..7d58d96ee 100644 --- a/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt +++ b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/generators/openapi/OpenApiSdkGenerator.kt @@ -77,9 +77,12 @@ class OpenApiSdkGenerator { @Option(name = ["-t", "--templates-dir"]) lateinit var templateDir: String + @Option(name = ["-r", "--repo-name"]) + lateinit var repoName: String + fun run() { try { - val product = Product(namespace, programmingLanguage) + val product = Product(namespace, repoName, programmingLanguage) val config = CodegenConfigurator().apply { setGeneratorName("kotlin") @@ -112,6 +115,7 @@ class OpenApiSdkGenerator { addAdditionalProperty("namespace", product.namespace) addAdditionalProperty("clientClassname", namespace.pascalCase()) addAdditionalProperty("language", product.programmingLanguage.id) + addAdditionalProperty("repoName", product.repoName) addAdditionalProperty("isKotlin", ProgrammingLanguage.isKotlin(product.programmingLanguage)) addAdditionalProperty("isRapid", ProductFamily.isRapid(product.namespace)) addAdditionalProperty("isExpediaGroup", ProductFamily.isExpediaGroup(product.namespace)) diff --git a/generator/openapi/src/main/kotlin/com/expediagroup/sdk/product/Product.kt b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/product/Product.kt index 279c04888..72d389452 100644 --- a/generator/openapi/src/main/kotlin/com/expediagroup/sdk/product/Product.kt +++ b/generator/openapi/src/main/kotlin/com/expediagroup/sdk/product/Product.kt @@ -19,10 +19,12 @@ val NON_ALPHANUMERIC_REGEX = Regex("[^a-zA-Z0-9]") class Product( inputNamespace: String, + val repoName: String, val programmingLanguage: ProgrammingLanguage = ProgrammingLanguage.JAVA ) { - constructor(inputNamespace: String, programmingLanguage: String = "java") : this( + constructor(inputNamespace: String, repoName: String, programmingLanguage: String = "java") : this( inputNamespace, + repoName, ProgrammingLanguage.from(programmingLanguage) ) diff --git a/generator/openapi/src/main/resources/templates/expediagroup-sdk/pom.mustache b/generator/openapi/src/main/resources/templates/expediagroup-sdk/pom.mustache index ff1bcbb26..42737ed4c 100644 --- a/generator/openapi/src/main/resources/templates/expediagroup-sdk/pom.mustache +++ b/generator/openapi/src/main/resources/templates/expediagroup-sdk/pom.mustache @@ -3,34 +3,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - com.expediagroup - sdk-parent-pom - 1.0.0 - ../../../../pom.xml - - - jar - - {{#isRapid}} - EG Rapid SDK for Java - EG Rapid SDK v{{artifactVersion}} - {{/isRapid}} - {{#isExpediaGroup}} - EG SDK :: {{artifactId}} - EG SDK :: {{artifactId}} v{{artifactVersion}} - {{/isExpediaGroup}} - + com.expediagroup {{artifactId}} - ${revision} - {{#isRapid}} - https://github.com/ExpediaGroup/rapid-java-sdk - {{/isRapid}} - {{#isExpediaGroup}} - https://github.com/ExpediaGroup/fraud-prevention-java-sdk - {{/isExpediaGroup}} - + {{artifactVersion}} + EG {{artifactId}} for Java + EG {{artifactId}} v{{artifactVersion}} + https://github.com/ExpediaGroup/{{repoName}} 2022 + jar @@ -48,20 +28,11 @@ - {{#isRapid}} - - scm:git:git@github.com:ExpediaGroup/rapid-java-sdk.git - scm:git:git@github.com:ExpediaGroup/rapid-java-sdk.git - https://github.com/ExpediaGroup/rapid-java-sdk - - {{/isRapid}} - {{#isExpediaGroup}} - - scm:git:git@github.com:ExpediaGroup/fraud-prevention-java-sdk.git - scm:git:git@github.com:ExpediaGroup/fraud-prevention-java-sdk.git - https://github.com/ExpediaGroup/fraud-prevention-java-sdk - - {{/isExpediaGroup}} + + scm:git:git@github.com:ExpediaGroup/{{repoName}}.git + scm:git:git@github.com:ExpediaGroup/{{repoName}}.git + https://github.com/ExpediaGroup/{{repoName}}/ + @@ -77,14 +48,300 @@ + 1.8 + 8 + + UTF-8 + UTF-8 + + 3.8.0 + 1.8.0 + + 0.90 + com.expediagroup.sdk + ${project.version} ${project.artifactId} - {{artifactVersion}} - {{shadePrefix}} + + + 3.13.0 + 3.7.1 + 3.5.0 + 3.4.2 + 3.3.1 + 3.6.0 + 3.3.1 + 3.3.0 + 3.6.0 + 3.2.0 + 0.8.12 + 1.9.20 + + 1.2.1 + 4.5 + 1.6.0 + 2.0.0 + 1.8.1 + 2.3.12 + 0.25.0 + 2.0.13 + + + + + org.jetbrains.kotlin + kotlin-bom + ${kotlin.version} + pom + import + + + org.jetbrains.kotlinx + kotlinx-coroutines-bom + ${kotlinx.coroutines.version} + pom + import + + + io.ktor + ktor-bom + ${ktor.version} + pom + import + + + org.jetbrains.kotlinx + atomicfu-jvm + ${kotlin-atomic.version} + + + + + org.slf4j + slf4j-api + ${slf4j.version} + + + + + + com.fasterxml.jackson + jackson-bom + 2.17.2 + pom + import + + + com.squareup.okio + okio-jvm + 3.9.0 + + + org.jetbrains + annotations + 24.1.0 + + + org.hibernate.validator + hibernate-validator + 6.2.5.Final + + + com.fasterxml.jackson.core + jackson-annotations + 2.17.2 + + + + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + ${maven-enforcer-plugin.version} + + + enforce-pom-standards + validate + + enforce + + + + + + + + + ${minimum.jdk.version} + + + ${minimum.maven.version} + + + true + Snapshot dependencies must be resolved before releasing + + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + **/jacoco.exec + + + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco-plugin.version} + + ${project.build.directory}/jacoco.exec + ${project.build.directory}/jacoco + + + + instrument-coverage + initialize + + prepare-agent + + + + coverage-report + prepare-package + + report + + + + coverage-check + verify + + check + + + + + CLASS + + *Test + + + + INSTRUCTION + COVEREDRATIO + ${minimum.code.coverage} + + + BRANCH + COVEREDRATIO + ${minimum.code.coverage} + + + + + + + + + + + com.mycila + license-maven-plugin + ${maven.licence.plugin.version} + + + ${current.year} + Expedia, Inc. + + + +
./LICENSE-HEADER.txt
+ + **/*.kt + +
+
+
+ + + add-license-header + validate + + format + + + +
+
+
+ + + org.apache.maven.plugins + maven-resources-plugin + ${maven-resources-plugin.version} + + false + + @@ + + + + + include-domain-helpers + generate-sources + + copy-resources + + + ${basedir}/src/main/kotlin/com/expediagroup/sdk/domain/{{namespace}} + + + {{helpersPath}} + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + ${maven-dependency-plugin.version} + + + analyze + + analyze + + + true + true + + + + + org.codehaus.mojo flatten-maven-plugin @@ -136,12 +393,6 @@ - - org.codehaus.mojo - exec-maven-plugin - ${exec-maven-plugin.version} - - org.apache.maven.plugins maven-resources-plugin @@ -282,6 +533,16 @@ + + get-the-year + + timestamp-property + + + current.year + yyyy + + @@ -351,10 +612,16 @@ org.jetbrains.dokka - gfm-plugin + versioning-plugin ${dokka-plugin.version} + + + ${project.version} + ${dokka-old-versions.location} + + true @@ -382,31 +649,127 @@ compile check - - true - org.apache.maven.plugins - maven-antrun-plugin - - true - + maven-enforcer-plugin - - org.apache.maven.plugins - maven-dependency-plugin - - true - + org.jacoco + jacoco-maven-plugin + + + com.mycila + license-maven-plugin +
+ + + org.hibernate.validator + hibernate-validator + + + com.fasterxml.jackson.core + jackson-annotations + + + org.jetbrains + annotations + + + org.jetbrains.kotlin + kotlin-stdlib + + + io.ktor + ktor-serialization-jackson-jvm + + + com.fasterxml.jackson.core + jackson-databind + + + io.ktor + ktor-client-core-jvm + + + io.ktor + ktor-client-okhttp-jvm + + + io.ktor + ktor-client-auth-jvm + + + io.ktor + ktor-client-content-negotiation-jvm + + + io.ktor + ktor-http-jvm + + + io.ktor + ktor-utils-jvm + + + io.ktor + ktor-client-logging-jvm + + + org.jetbrains.kotlinx + kotlinx-coroutines-core-jvm + + + io.ktor + ktor-serialization-jvm + + + io.ktor + ktor-client-encoding-jvm + + + + org.slf4j + slf4j-api + + + + org.jetbrains.kotlinx + atomicfu-jvm + + + + org.apache.commons + commons-lang3 + 3.14.0 + + + + org.apache.commons + commons-text + 1.12.0 + + + + com.ebay.ejmask + ejmask-api + 1.0.3 + + + + com.ebay.ejmask + ejmask-extensions + 1.0.3 + + + release @@ -468,7 +831,7 @@ javadoc - ${project.parent.basedir}/target/site/apidocs + ${project.basedir}/target/site/apidocs **/* ${project.build.finalName} @@ -494,7 +857,18 @@ kotlin-as-java-plugin ${dokka-plugin.version} + + org.jetbrains.dokka + versioning-plugin + ${dokka-plugin.version} + + + + ${project.version} + ${dokka-old-versions.location} + + @@ -509,43 +883,4 @@ - - - - org.hibernate.validator - hibernate-validator - - - javax.validation - validation-api - - - com.fasterxml.jackson.core - jackson-annotations - - - org.jetbrains - annotations - - - org.jetbrains.kotlin - kotlin-stdlib - - - com.ebay.ejmask - ejmask-api - - - com.ebay.ejmask - ejmask-extensions - - - org.jetbrains.kotlin - kotlin-reflect - - - org.apache.commons - commons-text - - From 1baea6777b4cd5bbdfbab866cea341833553f825 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 18:37:47 +0300 Subject: [PATCH 06/10] build(deps): bump org.slf4j:slf4j-api from 2.0.13 to 2.0.14 (#651) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mohammad Noor Abu Khleif --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 975ac783a..1dd645abb 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,7 @@ 5.10.3 1.13.12 5.12.0 - 2.0.13 + 2.0.14 2.23.1 2.2.22 From d89077e9c22e0745fb83f4c5c0915e19c256974a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 18:38:18 +0300 Subject: [PATCH 07/10] build(deps): bump kotlin.version from 2.0.0 to 2.0.10 (#648) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mohammad Noor Abu Khleif --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1dd645abb..4c4f82375 100644 --- a/pom.xml +++ b/pom.xml @@ -90,7 +90,7 @@ 1.0.0 - 2.0.0 + 2.0.10 1.8.1 1.7.1 2.3.12 From 33dd42084a9ffcd53651781c33484691d822a97c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 18:39:21 +0300 Subject: [PATCH 08/10] build(deps): bump org.codehaus.mojo:exec-maven-plugin from 3.3.0 to 3.4.0 (#650) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mohammad Noor Abu Khleif --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4c4f82375..98a3d6446 100644 --- a/pom.xml +++ b/pom.xml @@ -77,7 +77,7 @@ 3.3.0 3.3.1 3.4.0 - 3.3.0 + 3.4.0 3.2.0 0.8.12 1.9.20 From b5450ec9a349d6a67c9cf8110c1135bef5a16974 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 14:38:33 +0300 Subject: [PATCH 09/10] build(deps): bump org.apache.commons:commons-lang3 from 3.15.0 to 3.16.0 (#654) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 98a3d6446..f071c5c5f 100644 --- a/pom.xml +++ b/pom.xml @@ -272,7 +272,7 @@ org.apache.commons commons-lang3 - 3.15.0 + 3.16.0 org.checkerframework From dfccfafda6a88afa14fea48d2ace6d350e592490 Mon Sep 17 00:00:00 2001 From: Omar Aljarrah <50204418+OmarAlJarrah@users.noreply.github.com> Date: Thu, 8 Aug 2024 09:22:47 -0700 Subject: [PATCH 10/10] chore: add separate pr tests check workflow (#652) PR: https://github.com/ExpediaGroup/expediagroup-java-sdk/pull/652 --- .github/workflows/core-upgrade.yaml | 1 + .../workflows/generator-download-specs.yaml | 1 + .github/workflows/generator-generate.yaml | 3 +++ .github/workflows/generator-test-sdk.yaml | 4 ++++ .../workflows/generator-transform-specs.yaml | 1 + .github/workflows/generator-verify.yaml | 1 + .github/workflows/pr-check-tests.yaml | 19 +++++++++++++++ .github/workflows/run-tests.yaml | 24 +++++++++---------- .github/workflows/selfserve-generate.yaml | 1 + 9 files changed, 43 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/pr-check-tests.yaml diff --git a/.github/workflows/core-upgrade.yaml b/.github/workflows/core-upgrade.yaml index 7a92efd8a..5833df994 100644 --- a/.github/workflows/core-upgrade.yaml +++ b/.github/workflows/core-upgrade.yaml @@ -93,6 +93,7 @@ jobs: with: name: branch-name path: branch_name.txt + overwrite: true - name: Publish Updated Version PR uses: peter-evans/create-pull-request@v6 diff --git a/.github/workflows/generator-download-specs.yaml b/.github/workflows/generator-download-specs.yaml index 9d8160171..ab5534cb2 100644 --- a/.github/workflows/generator-download-specs.yaml +++ b/.github/workflows/generator-download-specs.yaml @@ -18,3 +18,4 @@ jobs: with: name: raw-specs path: raw-specs.yaml + overwrite: true diff --git a/.github/workflows/generator-generate.yaml b/.github/workflows/generator-generate.yaml index 988eb4d25..cd1f1cd76 100644 --- a/.github/workflows/generator-generate.yaml +++ b/.github/workflows/generator-generate.yaml @@ -41,13 +41,16 @@ jobs: path: | generator/openapi/target/sdk !generator/openapi/target/sdk/target + overwrite: true - uses: actions/upload-artifact@v4 with: name: jar path: | generator/openapi/target/sdk/target/*.jar generator/openapi/target/sdk/target/maven-archiver/pom.properties + overwrite: true - uses: actions/upload-artifact@v4 with: name: docs path: generator/openapi/target/sdk/target/dokka + overwrite: true diff --git a/.github/workflows/generator-test-sdk.yaml b/.github/workflows/generator-test-sdk.yaml index 2e312aac1..81d739d2f 100644 --- a/.github/workflows/generator-test-sdk.yaml +++ b/.github/workflows/generator-test-sdk.yaml @@ -14,6 +14,10 @@ on: description: 'Endpoint to prepend specs paths with' required: true type: string + specs_url: + description: 'Run tests based on specs' + required: true + type: string outputs: artifactId: value: ${{ jobs.sdk-metadata.outputs.artifactId }} diff --git a/.github/workflows/generator-transform-specs.yaml b/.github/workflows/generator-transform-specs.yaml index 534613637..dd8c7a066 100644 --- a/.github/workflows/generator-transform-specs.yaml +++ b/.github/workflows/generator-transform-specs.yaml @@ -20,3 +20,4 @@ jobs: with: name: specs path: specs.yaml + overwrite: true diff --git a/.github/workflows/generator-verify.yaml b/.github/workflows/generator-verify.yaml index 87089d4f4..9edc6823e 100644 --- a/.github/workflows/generator-verify.yaml +++ b/.github/workflows/generator-verify.yaml @@ -27,6 +27,7 @@ jobs: with: name: sdk path: generator/openapi/target/sdk + overwrite: true verify-generated-sdk: runs-on: ubuntu-latest needs: generate-sdk diff --git a/.github/workflows/pr-check-tests.yaml b/.github/workflows/pr-check-tests.yaml new file mode 100644 index 000000000..ca66e1d53 --- /dev/null +++ b/.github/workflows/pr-check-tests.yaml @@ -0,0 +1,19 @@ +name: PR Check Tests Run +on: push + +jobs: + run-rapid-tests: + strategy: + matrix: + jdk: [8, 11, 17, 21] + fail-fast: true + max-parallel: 1 + uses: ./.github/workflows/run-tests.yaml + with: + source: 'specs' + specs_url: 'https://ewe-assets.s3.amazonaws.com/developer-tools/api/rapid/v3/specs.yaml' + sdk_version: 1.0.${{ github.run_id }} + sdk_namespace: 'rapid' + jdk: ${{ matrix.jdk }} + endpoint_prefix: '/v3' + secrets: inherit diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index 3799d9efc..903606739 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -1,6 +1,5 @@ name: Run Tests on: - push: workflow_dispatch: inputs: source: @@ -66,7 +65,7 @@ on: description: 'JDK version to use' required: true type: string - default: '17' + default: '21' endpoint_prefix: description: 'Endpoint to prepend specs paths with' required: true @@ -78,29 +77,30 @@ jobs: steps: - shell: python -u {0} run: | - if 'specs' in '${{ github.event.inputs.source }}' and not('${{ github.event.inputs.specs_url }}'): - print('::error::Invalid specs URL: ${{ github.event.inputs.specs_url }}') + if 'specs' in '${{ inputs.source }}' and not('${{ inputs.specs_url }}'): + print('::error::Invalid specs URL: ${{ inputs.specs_url }}') exit(1) - if 'sdk' in '${{ github.event.inputs.source }}' and not('${{ github.event.inputs.sdk_version }}'): - print('::error::Invalid SDK version: ${{ github.event.inputs.sdk_version }}') + if 'sdk' in '${{ inputs.source }}' and not('${{ inputs.sdk_version }}'): + print('::error::Invalid SDK version: ${{ inputs.sdk_version }}') exit(1) generate-test-sdk: - if: ${{ github.event.inputs.source == 'specs' }} + if: inputs.source == 'specs' needs: [ inputs-validation ] uses: ./.github/workflows/generator-test-sdk.yaml with: - version: ${{ github.event.inputs.sdk_version }} - namespace: ${{ github.event.inputs.sdk_namespace }} - endpoint_prefix: ${{ github.event.inputs.endpoint_prefix }} + version: ${{ inputs.sdk_version }} + namespace: ${{ inputs.sdk_namespace }} + endpoint_prefix: ${{ inputs.endpoint_prefix }} + specs_url: ${{ inputs.specs_url }} secrets: inherit run-rapid-examples: - if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') + if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && inputs.sdk_namespace == 'rapid' needs: [ generate-test-sdk ] uses: "ExpediaGroup/rapid-java-sdk/.github/workflows/run-examples.yaml@main" with: sdk_version: ${{ needs.generate-test-sdk.outputs.version }} - jdk: ${{ github.event.inputs.jdk }} + jdk: ${{ inputs.jdk }} sdk_generation_workflow_run_id: ${{ github.run_id }} secrets: KEY: ${{ secrets.RAPID_KEY }} diff --git a/.github/workflows/selfserve-generate.yaml b/.github/workflows/selfserve-generate.yaml index c2ce61ad7..d243453ca 100644 --- a/.github/workflows/selfserve-generate.yaml +++ b/.github/workflows/selfserve-generate.yaml @@ -63,3 +63,4 @@ jobs: path: | sdk-repo/generator/openapi/target/sdk !sdk-repo/generator/openapi/target/sdk/target + overwrite: true