Skip to content

Releases: hasura/ndc-open-api-lambda

v1.0.0

07 Nov 18:04
61c3fd7
Compare
Choose a tag to compare

v0.2.0

26 Sep 16:43
fa033ba
Compare
Choose a tag to compare

v0.1.5

23 Sep 16:46
934491f
Compare
Choose a tag to compare

v0.1.4

12 Sep 09:02
95b64da
Compare
Choose a tag to compare

v0.1.3

09 Sep 13:10
Compare
Choose a tag to compare

v0.1.2

02 Sep 14:20
Compare
Choose a tag to compare

v0.1.1

05 Jun 16:41
Compare
Choose a tag to compare

v0.1.0

03 Jun 14:50
Compare
Choose a tag to compare

v0.0.2-alpha

19 Apr 20:16
Compare
Choose a tag to compare

v0.0.1-alpha

10 Apr 15:01
Compare
Choose a tag to compare

v0.0.1-alpha

Initial release of the NDC Open API Connector.

Docker Image

ghcr.io/hasura/ndc-open-api-lambda:v0.0.1-alpha

Readme

https://github.com/hasura/ndc-open-api-lambda/tree/release/v0.0.1-alpha?tab=readme-ov-file#openapi-lambda-connector

Changelog

  • Generate Typescript API from an Open API document/swagger file
  • Generate wrapper functions that become the data source for TS Lambda Connector on the generated Typescript API

Usage

You can use the connector via the published Docker Image. The Docker Image expects the following environment variables:

  1. NDC_OAS_DOCUMENT_URI: The URI to your Open API Document. If you're using a file instead of a HTTP link, please ensure that it is named swagger.json and is present in the root directory of the volume being mounted to /etc/connector. This env var is nullable.
  2. NDC_OAS_BASE_URL: The base URL of your API. This env var is nullable.
  3. NDC_OAS_HEADERS: Headers to be added to your API calls. The expected syntax is key1=value1&key2=value2&key3=value3..... This env var is nullable.
  4. NDC_OAS_FILE_OVERWRITE: Boolean flag to allow previously generated files to be over-written. Defaults to false. Please note that the codegen will fail with an error if this is set to false and the files that the codegen would create already exist.
  5. HASURA_PLUGIN_LOG_LEVEL: The log level. Possible values: trace, debug, info, warn, error, fatal, panic. Defaults to info
  6. NDC_OAS_LAMBDA_PRETTY_LOGS: Boolean flag to print human readable logs instead of JSON

The Docker Image will output the generated files at /etc/connector. Please ensure that a volume mount is present at that directory in while using the docker run command

NOTE: The Docker Image uses the NDC Open API Lambda Connector CLI internally, so -h on any command will print the help for that command. Also, env vars can be substituted with CLI flags passed to the docker run command

Examples

# get command documentation/help
docker run --rm ghcr.io/hasura/ndc-open-api-lambda:v0.0.1-alpha update -h

# run the code generation (using env vars)
docker run --rm -v ./:/etc/connector/ -e NDC_OAS_DOCUMENT_URI=${url to open API document} ghcr.io/hasura/ndc-open-api-lambda:v0.0.1-alpha update

# run the code generation (using CLI flags)
docker run --rm -v ./:/etc/connector/ ghcr.io/hasura/ndc-open-api-lambda:v0.0.1-alpha update --open-api ${url to open API document}

# with headers (using env vars)
docker run --rm -v ./:/etc/connector/ -e NDC_OAS_DOCUMENT_URI=${url to open API document} -e NDC_OAS_HEADERS=${key1=value1&key2=value2&key3=value3...} ghcr.io/hasura/ndc-open-api-lambda:v0.0.1-alpha update

# with headers (using CLI flags)
docker run --rm -v ./:/etc/connector/ ghcr.io/hasura/ndc-open-api-lambda:v0.0.1-alpha update --open-api ${url to open API document} -H key1=value1 -H key2=value2 -H key3=value3

# with baseUrl (using env vars)
docker run --rm -v ./:/etc/connector/ -e NDC_OAS_DOCUMENT_URI=${url to open API document} -e NDC_OAS_BASE_URL=http://demoapi.com/ ghcr.io/hasura/ndc-open-api-lambda:v0.0.1-alpha update

# with baseUrl (using CLI flags)
docker run --rm -v ./:/etc/connector/ ghcr.io/hasura/ndc-open-api-lambda:v0.0.1-alpha update --open-api ${url to open API document} --base-url http://demoapi.com/

References