From 32e05b40584b6955feddaa603181068904ecb3ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20Ayd=C4=B1n?= Date: Thu, 24 Sep 2026 21:27:53 +0300 Subject: [PATCH 1/2] chore: update schema URL and harden sync script Update the OpenAPI schema URL. Use an `env bash` shebang so the script picks up bash from PATH. Resolve paths relative to the repository root. Collect the curl flags into `CURL_OPTS`, gated on `TRACE` and `ACTIONS_STEP_DEBUG` so runs can be made verbose, and harden them: refuse redirects that leave https, and bound connect and transfer time so a stalled download cannot hang CI or a local run. Log the schema download, which was previously silent. Related-Task: INTER-2472 --- sync.sh | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/sync.sh b/sync.sh index 32ce5705..358630aa 100755 --- a/sync.sh +++ b/sync.sh @@ -1,13 +1,26 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail -defaultBaseUrl="https://fingerprintjs.github.io/fingerprint-pro-server-api-openapi" +# Resolve paths relative to the repository root, so the script can be run from +# any working directory. +cd "$(dirname "${BASH_SOURCE[0]}")" + +defaultBaseUrl="https://fingerprintjs.github.io/openapi" schemaUrl="${1:-$defaultBaseUrl/schemas/fingerprint-server-api-v4.yaml}" examplesBaseUrl="${2:-$defaultBaseUrl/examples}" -mkdir -p ./res +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="./test/mocks" + +mkdir -p "$(dirname "$schemaDestination")" -curl -fSL --retry 3 -o ./res/fingerprint-server-api.yaml "$schemaUrl" +echo "Downloading $schemaUrl to $schemaDestination" +curl "${CURL_OPTS[@]}" -o "$schemaDestination" "$schemaUrl" examples=( 'events/search/get_event_search_200.json' @@ -27,17 +40,15 @@ examples=( 'errors/429_too_many_requests.json' ) -baseDestination="./test/mocks" -mkdir -p "$baseDestination" - for example in "${examples[@]}"; do destinationPath="$baseDestination/$example" - destinationDir="$(dirname "$destinationPath")" - mkdir -p "$destinationDir" + mkdir -p "$(dirname "$destinationPath")" exampleUrl="$examplesBaseUrl/$example" echo "Downloading $exampleUrl to $destinationPath" - curl -fSL --retry 3 -o "$destinationPath" "$exampleUrl" + curl "${CURL_OPTS[@]}" -o "$destinationPath" "$exampleUrl" done +echo "All OpenAPI schema downloads complete." + ./generate.sh From 4cacae7e424edc514fa93ef087bb48d1eb992616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20Ayd=C4=B1n?= Date: Thu, 24 Sep 2026 22:05:39 +0300 Subject: [PATCH 2/2] chore: rename baseDestination to exampleBaseDestination --- sync.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sync.sh b/sync.sh index 358630aa..f4c2efe5 100755 --- a/sync.sh +++ b/sync.sh @@ -15,7 +15,7 @@ if [[ "${TRACE:-}" != "true" && "${ACTIONS_STEP_DEBUG:-}" != "true" ]]; then fi schemaDestination="./res/fingerprint-server-api.yaml" -baseDestination="./test/mocks" +exampleBaseDestination="./test/mocks" mkdir -p "$(dirname "$schemaDestination")" @@ -41,7 +41,7 @@ examples=( ) for example in "${examples[@]}"; do - destinationPath="$baseDestination/$example" + destinationPath="$exampleBaseDestination/$example" mkdir -p "$(dirname "$destinationPath")" exampleUrl="$examplesBaseUrl/$example"