Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ In the project we use local jar file `bin/generator.jar`.

You can just run `sh ./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`

### Testing the local source code of the SDK

Expand Down
21 changes: 18 additions & 3 deletions scripts/sync.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
#!/bin/bash
#!/usr/bin/env bash
set -euo pipefail
Comment thread
erayaydin marked this conversation as resolved.

set -ex
# Resolve paths relative to the repository root, so the script can be run from
# any working directory.
cd "$(dirname "${BASH_SOURCE[0]}")/.."

schemaUrl="${1:-https://fingerprintjs.github.io/openapi/schemas/fingerprint-server-api-compact.yaml}"

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

# Download latest schema. Examples are no longer published at the upstream URL
# (fingerprintjs.github.io/.../examples/ returns 404). Mock files in
# sdk/src/test/resources/mocks/ are maintained locally.
curl -fsSL -o ./res/fingerprint-server-api.yaml https://fingerprintjs.github.io/fingerprint-pro-server-api-openapi/schemas/fingerprint-server-api-compact.yaml
echo "Downloading $schemaUrl"
curl "${CURL_OPTS[@]}" -o ./res/fingerprint-server-api.yaml "$schemaUrl"

echo "OpenAPI schema download complete."

./scripts/generate.sh
Loading