mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
8f1900f32b
* feat: add a script that generates an OpenAPI client * feat: generate an OpenAPI client * feat: use the generated OpenAPI client * refactor: add an OpenAPI section to the readme * refactor: fix missing interface prefixes * refactor: regenerate OpenAPI client
25 lines
669 B
Bash
Executable File
25 lines
669 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Generate OpenAPI bindings for the Unleash API.
|
|
# https://openapi-generator.tech/docs/generators/typescript-fetch
|
|
|
|
set -feux
|
|
cd "$(dirname "$0")"
|
|
|
|
# URL to the generated open API spec.
|
|
# Set the UNLEASH_OPENAPI_URL environment variable to override.
|
|
UNLEASH_OPENAPI_URL="${UNLEASH_OPENAPI_URL:-http://localhost:4242/docs/openapi.json}"
|
|
|
|
rm -rf "../src/openapi"
|
|
mkdir "../src/openapi"
|
|
|
|
npx @openapitools/openapi-generator-cli generate \
|
|
-g "typescript-fetch" \
|
|
-i "$UNLEASH_OPENAPI_URL" \
|
|
-o "../src/openapi"
|
|
|
|
# Remove unused files.
|
|
rm "openapitools.json"
|
|
rm "../src/openapi/.openapi-generator-ignore"
|
|
rm -r "../src/openapi/.openapi-generator"
|