/otomi-clients

Factory to build and publish open API clients used in the otomi-tasks repo.

Primary LanguageShellApache License 2.0Apache-2.0

Otomi Clients

Part of Red Kubes' Otomi Container Platform.

Factory to build and publish openapi clients used in the redkubes/otomi-tasks repo.

Generate openapi clients for vendors

To build and publish new vendor clients, just download and inspect their openapi spec if it is suitable, then integrate it.

Steps:

  • put the api spec in src/vendors/openapi/*.json
  • add a line in bin/generate-all.sh to include your package
  • make sure the credentials used in .github/workflows/default.yaml have rights to publish that package

To create one the very first time to see if it all works:

bin/generate-client.sh $vendor $type

This will generate vendors/client/$vendor/$type, with $type being the intended environment the client will run in, i.e. node|axios (default node).

The above script uses openapi-generator tool for typescript. Read about more typescript options at: https://openapi-generator.tech/docs/generators/typescript-node

Publish as npm package

In order for others to use the generated client package, please commit the code and the github workflow will run tests and publish.

NPM: authentication and publication

To control npm access, like wiring up a private repo please follow these instructions:

Troubleshooting

Npm publish

npm ERR! Invalid version: "2.0"

Solution: Update version in api spec to make it conform to semver. E.g.: change version to 2.0.0 and then generate client once again.