Command line utility to split OpenAPI documents into smaller, self contained, service oriented documents and prepare StackQL provider interfaces Command line utility to help developers prepare and submit StackQL provider specs, see StackQL
openapisaurus is implemented in TypeScript and designed to be run using the deno runtime.
- Install Deno by following the instructions at deno.land.
- Clone the
openapisaurusrepository to your local machine:
git clone [email protected]:stackql/openapisaurus.git
- Make the
openapisaurusscript executable by running the following command:
chmod +x openapisaurus
Splits an OpenAPI spec into multiple service scoped documents.
Usage:
openapisaurus split <apiDoc> <flags>Arguments:
apiDoc[REQUIRED] OpenAPI specification to be split.Flags:
--providerName[REQUIRED] Name of the provider.
--svcDiscriminator[REQUIRED] JMESPath expression to extract the service name from the OpenAPI spec.
--exclude[OPTIONAL] JMESPath expression for paths to exclude from processing.
--outputDir[OPTIONAL] Directory to write the output OpenAPI documents to. (defaults tocwd)
--overwrite[OPTIONAL] Overwrite existing files. (defaults tofalse)
--verbose[OPTIONAL] Verbose output (defaults tofalse).
fivetran example:
./openapisaurus split \
ref/fivetran/swagger.json \
--providerName=fivetran \
--svcdiscriminator='["tags"][0]' \
--outputDir=dev \
--overwrite \
--verbose
digitalocean example:
./openapisaurus split \
ref/digitalocean/digitalocean-openapi-bundled.yaml \
--providerName=digitalocean \
--svcdiscriminator='["tags"][0]' \
--outputDir=dev \
--overwrite
Generate stackql provider development provider docs.
Usage:
openapisaurus dev <apiDocDir> <flags>Arguments:
apiDocDir[REQUIRED] Directory containing OpenAPI specifications used to create StackQL dev docs.Flags:
--providerName[REQUIRED] Name of the provider.
--resDiscriminator[REQUIRED] JMESPath used to identify stackql resources from an OpenAPI spec.
(defaults topath_tokens).
--providerConfig[OPTIONAL] Stringified JSON object, describing the config for a provider.
(defaults to{ "auth": { "type": "null_auth" }}).
--methodKey[OPTIONAL] JMESPath used to identify resource methods from a providers OpenAPI spec.
(defaults tooperationId).
--overwrite[OPTIONAL] Overwrite existing files. (defaults tofalse)
--verbose[OPTIONAL] Verbose output (defaults tofalse).
fivetran example:
./openapisaurus dev \
dev \
--providerName=fivetran \
--providerConfig='{ "auth": { "type": "basic", "credentialsenvvar": "FIVETRAN_CREDS" }}' \
--overwrite \
--verbose
digitalocean example:
./openapisaurus dev \
dev \
--providerName=digitalocean \
--providerConfig='{ "auth": { "type": "bearer", "credentialsenvvar": "DIGITALOCEAN_TOKEN" }}' \
--overwrite \
--verbose
Build deployable stackql provider docs.
Usage:
openapisaurus build <apiDocDir> <flags>Arguments:
apiDocDir[REQUIRED] Directory containing OpenAPI service specifications and StackQL dev docs.Flags:
--providerName[REQUIRED] Name of the provider.
--outputDir[REQUIRED] Output directory to write compiled docs to.
--servers[OPTIONAL] Stringified JSON array containing servers for the provider.
(overrides theserverslist in the original OpenAPI spec).
--overwrite[OPTIONAL] Overwrite existing files. (defaults tofalse)
--verbose[OPTIONAL] Verbose output (defaults tofalse).
fivetran example:
./openapisaurus build \
dev \
--providerName=fivetran \
--outputDir=src \
--overwrite \
--verbose
digitalocean example:
./openapisaurus build \
dev \
--providerName=digitalocean \
--outputDir=src \
--overwrite \
--verbose
to run tests locally you will need to download
stackql, to download the lateststackqlrelease for Linux you can use the following commands:
curl -L https://bit.ly/stackql-zip -O && unzip stackql-zip
To test providers using the local registry, you can use the following commands:
PROVIDER_REGISTRY_ROOT_DIR="$(pwd)"
REG_STR='{"url": "file://'${PROVIDER_REGISTRY_ROOT_DIR}'", "localDocRoot": "'${PROVIDER_REGISTRY_ROOT_DIR}'", "verifyConfig": {"nopVerify": true}}'
./stackql shell --registry="${REG_STR}"
To run directly without using the openapisaurus script, you can use the following command as an example:
deno run \
--allow-net \
--allow-read \
--allow-write \
app.ts split \
../../local-registry/ref/fivetran/swagger.json \
--providerName=fivetran \
--svcdiscriminator='["tags"][0]' \
--overwrite \
--verbose
If you have any issues with openapisaurus, please report them here.
This project is licensed under the MIT License.