From 4c8f5af55603eff8c8e8411d2b40dca3984ef302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20Ayd=C4=B1n?= Date: Thu, 24 Sep 2026 21:43:28 +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 rather than whatever sits at /bin/bash. Harden `curl` to refuse redirects that leave https and to bound connect and transfer time, so a stalled download cannot hang CI or a local run. Document `./scripts/sync.sh` and `./scripts/generate.sh` instead of invoking them through `sh`. Related-Task: INTER-2472 --- contributing.md | 4 ++-- scripts/sync.sh | 26 ++++++++++++++------------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/contributing.md b/contributing.md index 67b8e2c7e..014a5c914 100644 --- a/contributing.md +++ b/contributing.md @@ -13,9 +13,9 @@ Most files in the project are autogenerated by [openapi-generator](https://opena You need `openapi-generator` to run code generation. There are many ways described in the [readme](https://github.com/OpenAPITools/openapi-generator). In the project we use Docker image `openapitools/openapi-generator-cli` for code generation. -You can just run `sh ./scripts/generate.sh` script and it will do all the work. +You can just run `./scripts/generate.sh` script and it will do all the work. -To download fresh OpenAPI schema run `sh ./scripts/sync.sh` +To download fresh OpenAPI schema run `./scripts/sync.sh` ### Auto-generated test files and FILES manifest The generation script cleans fully managed output (`src`, `docs`, `README.md`, and `composer.json`) before running `openapi-generator`. It intentionally preserves `test`, because PHP test files generated by OpenAPI Generator are scaffolding: they are created when missing, but existing test files are not overwritten on later generation runs. diff --git a/scripts/sync.sh b/scripts/sync.sh index 1240424c3..bd8483276 100755 --- a/scripts/sync.sh +++ b/scripts/sync.sh @@ -1,22 +1,25 @@ -#!/bin/bash +#!/usr/bin/env bash source "$(dirname "${BASH_SOURCE[0]}")/common.sh" -defaultBaseUrl="https://fingerprintjs.github.io/fingerprint-pro-server-api-openapi" +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) +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")" + require_cmd curl -echo "Downloading \`$schemaUrl\`..." -curl "${CURL_OPTS[@]}" -o ./res/fingerprint-server-api.yaml "$schemaUrl" +echo "Downloading $schemaUrl to $schemaDestination" +curl "${CURL_OPTS[@]}" -o "$schemaDestination" "$schemaUrl" examples=( 'events/get_event_200.json' @@ -40,16 +43,15 @@ examples=( 'errors/500_internal_server_error.json' ) -baseDestination="./test/mocks" - 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\`..." + echo "Downloading $exampleUrl to $destinationPath" curl "${CURL_OPTS[@]}" -o "$destinationPath" "$exampleUrl" done +echo "All OpenAPI schema downloads complete." + ./scripts/generate.sh From d47f01068ea0524c73ffa7c14a4f316ce10adc2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20Ayd=C4=B1n?= Date: Thu, 24 Sep 2026 22:06:14 +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 bd8483276..bad48ecb9 100755 --- a/scripts/sync.sh +++ b/scripts/sync.sh @@ -12,7 +12,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")" @@ -44,7 +44,7 @@ examples=( ) for example in "${examples[@]}"; do - destinationPath="$baseDestination/$example" + destinationPath="$exampleBaseDestination/$example" mkdir -p "$(dirname "$destinationPath")" exampleUrl="$examplesBaseUrl/$example"