Package Exports
- api-codegen
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (api-codegen) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Hasura API Code Generator
npm module to generate code for Hasura APIs in different languages/frameworks
Languages Covered
- Python
- JavaScript
- Node.js
- Swift
- Java
If you want to add support for a language or a library within a language, follow the steps below:
Getting started
- Build your library
- Run
yarn install(recommended) ornpm installto get the project's dependencies - Run
yarn buildornpm run buildto produce minified version of your library.
- Development mode
- Having all the dependencies installed run
yarn devornpm run dev. This command will generate an non-minified version of your library and will run a watcher so you get the compilation on file change.
Scripts
yarn buildornpm run build- produces production version of your library under thelibfolderyarn devornpm run dev- produces development version of your library and runs a watcheryarn testornpm run test- well ... it runs the tests :)yarn test:watchornpm run test:watch- same as above but in a watch mode
Testing
- Once the code generator for the new module has been written, it can be tested by:
sh test.sh '<MODULE_NAME>' <PATH_TO_DOCKERFILE>
Here the
- '
' comes from the CodeGenerator.TYPES - '
' should give the path of the Dockerfile written for this new module execution.
This shell script takes the module name, generates the Code Snippet based on the written function and saves the snippet file named as test in the given path. A docker image is built with the test file added. Docker container is run with the built image and is expected to only output the response of the sample http request.