1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/frontend/scripts/generate-openapi.sh
olav 8f1900f32b feat: generate an OpenAPI client (2) (#875)
* 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
2022-04-26 10:53:46 +02:00

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"