From 49020f1c79812da05d0ffd4a18637f4fdc5d95a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20Ayd=C4=B1n?= Date: Thu, 24 Sep 2026 22:56:08 +0300 Subject: [PATCH] chore: update schema URL and harden sync script Update the OpenAPI schema URL. Use an `env bash` shebang and 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. Log the download. Inline the base URL into `schemaUrl`. Document `./scripts/sync.sh` and `./scripts/generate.sh` instead of invoking them through `sh`. Related-Task: INTER-2472 --- contributing.md | 4 ++-- scripts/sync.sh | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/contributing.md b/contributing.md index 6a1c64438..04ff762ce 100644 --- a/contributing.md +++ b/contributing.md @@ -13,9 +13,9 @@ Most files in the project are autogenerated by [swagger-codegen](https://swagger You need `swagger-codegen` to run code generation. There are many ways described in the [readme](https://github.com/swagger-api/swagger-codegen). In the project we use Docker image `swaggerapi/swagger-codegen-cli-v3` 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` ## Creating Coverage Report (Markdown and HTML) diff --git a/scripts/sync.sh b/scripts/sync.sh index 773c22978..616c1a64d 100755 --- a/scripts/sync.sh +++ b/scripts/sync.sh @@ -1,22 +1,23 @@ -#!/bin/bash +#!/usr/bin/env bash source "$(dirname "${BASH_SOURCE[0]}")/common.sh" -defaultBaseUrl="https://fingerprintjs.github.io/fingerprint-pro-server-api-openapi" -schemaUrl="${1:-$defaultBaseUrl/schemas/fingerprint-server-api-compact.yaml}" +schemaUrl="${1:-https://fingerprintjs.github.io/openapi/schemas/fingerprint-server-api-compact.yaml}" -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 +mkdir -p ./res + require_cmd curl -echo "Downloading \`$schemaUrl\`..." +echo "Downloading $schemaUrl" curl "${CURL_OPTS[@]}" -o ./res/fingerprint-server-api.yaml "$schemaUrl" +echo "OpenAPI schema download complete." + # Add `deprecated: true` for component schemas echo "Adding deprecation for component schemas..." docker run --rm -v "${PWD}:/work" python:3-alpine sh -c \