From 3c5d7a299f95ab522f744f64da3670ac86857271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20Ayd=C4=B1n?= Date: Thu, 24 Sep 2026 21:33:43 +0300 Subject: [PATCH 1/2] chore: update schema URL and harden sync script Update the OpenAPI schema URL for the repository rename to `openapi`. Use an `env bash` shebang so the script picks up bash from PATH rather than whatever sits at /bin/bash. Resolve paths relative to the repository root, so the script no longer writes into whatever directory it is invoked from. Collect the curl flags into `CURL_OPTS`, gated on `TRACE` and `ACTIONS_STEP_DEBUG` so runs can be made verbose, and harden them: retry transient failures, refuse redirects that leave https, and bound connect and transfer time so a stalled download cannot hang CI or a local run. Rename `examplesList` to `examples` and log the full URL being fetched rather than just the example path, so it is clear which base URL a run actually used. Log the schema download, which was previously silent. Mark the script executable. `contributing.md` documents `./sync.sh`, which failed with a permission error because the file was not executable. Related-Task: INTER-2472 --- sync.sh | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) mode change 100644 => 100755 sync.sh diff --git a/sync.sh b/sync.sh old mode 100644 new mode 100755 index 278a87fb..4b1fc757 --- a/sync.sh +++ b/sync.sh @@ -1,15 +1,28 @@ -#!/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="./src/Fingerprint.ServerSdk.Test/mocks" + +mkdir -p "$(dirname "$schemaDestination")" -curl -fSL -o ./res/fingerprint-server-api.yaml "$schemaUrl" +echo "Downloading $schemaUrl to $schemaDestination" +curl "${CURL_OPTS[@]}" -o "$schemaDestination" "$schemaUrl" -examplesList=( +examples=( 'errors/400_ip_address_invalid.json' 'errors/400_request_body_invalid.json' 'errors/403_feature_not_enabled.json' @@ -22,16 +35,13 @@ examplesList=( 'webhook/webhook_event.json' ) -baseDestination="./src/Fingerprint.ServerSdk.Test/mocks" - -for example in "${examplesList[@]}"; do +for example in "${examples[@]}"; do destinationPath="$baseDestination/$example" - destinationDir="$(dirname "$destinationPath")" - - mkdir -p "$destinationDir" + mkdir -p "$(dirname "$destinationPath")" - echo "Downloading $example to $destinationPath" - curl -fSL -o "$destinationPath" "$examplesBaseUrl/$example" + exampleUrl="$examplesBaseUrl/$example" + echo "Downloading $exampleUrl to $destinationPath" + curl "${CURL_OPTS[@]}" -o "$destinationPath" "$exampleUrl" done -echo "All OpenAPI documentation downloads complete." \ No newline at end of file +echo "All OpenAPI schema downloads complete." From fbb79e58863ffb25f0f566dd99da54a6db6f8b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20Ayd=C4=B1n?= Date: Thu, 24 Sep 2026 22:05:56 +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 4b1fc757..092e71f1 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="./src/Fingerprint.ServerSdk.Test/mocks" +exampleBaseDestination="./src/Fingerprint.ServerSdk.Test/mocks" mkdir -p "$(dirname "$schemaDestination")" @@ -36,7 +36,7 @@ examples=( ) for example in "${examples[@]}"; do - destinationPath="$baseDestination/$example" + destinationPath="$exampleBaseDestination/$example" mkdir -p "$(dirname "$destinationPath")" exampleUrl="$examplesBaseUrl/$example"