From bdd09e2491f72695c2693c50dd03446511f50c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20Ayd=C4=B1n?= Date: Thu, 24 Sep 2026 21:05:06 +0300 Subject: [PATCH 1/2] chore: update schema URL and harden sync script Update OpenAPI schema URL in the sync script. Extract the base URL into `defaultBaseUrl` with positional overrides. Use `env bash` shebang, so the script picks up bash from the correct environment. Resolve paths relative to the repository root. Harden `curl` with retry transient failures, refuse redirects that leave https and bound connect and transfer time so a stalled download cannot hand CI or local. Rename `examplesList` to `examples`, log the full URL being fetched rather than just the example path, so it is clear which base URL a run actually used. Update the OpenAPI repository link in the `contributing.md` file. Related-Task: INTER-2472 --- contributing.md | 2 +- scripts/sync.sh | 37 +++++++++++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/contributing.md b/contributing.md index 638a482..fea23ca 100644 --- a/contributing.md +++ b/contributing.md @@ -26,7 +26,7 @@ Use the Gradle build to invoke `openapi-generator` and generate the code and doc ./gradlew build ``` -To download the latest OpenAPI schema from [fingerprintjs/fingerprint-pro-server-api-openapi](https://github.com/fingerprintjs/fingerprint-pro-server-api-openapi), run `./scripts/sync.sh` +To download the latest OpenAPI schema from [fingerprintjs/openapi](https://github.com/fingerprintjs/openapi), run `./scripts/sync.sh` ### Updating the codegen engine and templates diff --git a/scripts/sync.sh b/scripts/sync.sh index ec9d795..e103f0b 100755 --- a/scripts/sync.sh +++ b/scripts/sync.sh @@ -1,10 +1,28 @@ #!/usr/bin/env bash +set -euo pipefail -set -ex +# Resolve paths relative to the repository root, so the script can be run from +# any working directory. +cd "$(dirname "${BASH_SOURCE[0]}")/.." -curl -fsSL -o ./res/fingerprint-server-api.yaml https://fingerprintjs.github.io/fingerprint-pro-server-api-openapi/schemas/fingerprint-server-api-v4.yaml +defaultBaseUrl="https://fingerprintjs.github.io/openapi" +schemaUrl="${1:-$defaultBaseUrl/schemas/fingerprint-server-api-v4.yaml}" +examplesBaseUrl="${2:-$defaultBaseUrl/examples}" -examplesList=( +CURL_OPTS=(-fSL --retry 3 --proto-redir '=https' --connect-timeout 10 --max-time 300) +if [[ "${TRACE:-}" != "true" && "${ACTIONS_STEP_DEBUG:-}" != "true" ]]; then + CURL_OPTS+=(-s) +fi + +schemaDestination="./res/fingerprint-server-api.yaml" +baseDestination="./sdk/src/test/resources/mocks" + +mkdir -p "$(dirname "$schemaDestination")" + +echo "Downloading $schemaUrl to $schemaDestination" +curl "${CURL_OPTS[@]}" -o "$schemaDestination" "$schemaUrl" + +examples=( 'webhook/webhook_event.json' 'events/get_event_200.json' 'events/get_event_ruleset_200.json' @@ -36,6 +54,13 @@ examplesList=( 'errors/500_internal_server_error.json' ) -for example in "${examplesList[@]}"; do - curl --create-dirs -fsSL -o ./sdk/src/test/resources/mocks/"$example" https://fingerprintjs.github.io/fingerprint-pro-server-api-openapi/examples/"$example" -done \ No newline at end of file +for example in "${examples[@]}"; do + destinationPath="$baseDestination/$example" + mkdir -p "$(dirname "$destinationPath")" + + exampleUrl="$examplesBaseUrl/$example" + echo "Downloading $exampleUrl to $destinationPath" + curl "${CURL_OPTS[@]}" -o "$destinationPath" "$exampleUrl" +done + +echo "All OpenAPI schema downloads complete." From e509c6db7dfabaceef1f1a1af6cfbeeb123398ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20Ayd=C4=B1n?= Date: Thu, 24 Sep 2026 22:36:02 +0300 Subject: [PATCH 2/2] chore: rename baseDestination to exampleBaseDestination --- scripts/sync.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/sync.sh b/scripts/sync.sh index e103f0b..02e92b6 100755 --- a/scripts/sync.sh +++ b/scripts/sync.sh @@ -15,7 +15,7 @@ if [[ "${TRACE:-}" != "true" && "${ACTIONS_STEP_DEBUG:-}" != "true" ]]; then fi schemaDestination="./res/fingerprint-server-api.yaml" -baseDestination="./sdk/src/test/resources/mocks" +exampleBaseDestination="./sdk/src/test/resources/mocks" mkdir -p "$(dirname "$schemaDestination")" @@ -55,7 +55,7 @@ examples=( ) for example in "${examples[@]}"; do - destinationPath="$baseDestination/$example" + destinationPath="$exampleBaseDestination/$example" mkdir -p "$(dirname "$destinationPath")" exampleUrl="$examplesBaseUrl/$example"