Custom OpenAPI Generator templates for generating crystal client libraries.
OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (only 3.0 is supported).
OpenAPI Generator supports User-defined Templates.
crystal_client_generator
provides custom OpenAPI Generator templates for generating crystal client libraries.
This readme is for version 0.3.1
You need to have docker installed first with instructions from here.
Run script bin/generate.sh
from project root directory to generate the crystal client library.
bin/generate.sh
runs OpenAPI Generator from inside a docker container, and mounts project root directory to /gen
in the container, so you need to specify path arguments relative to project root.
You can place your OpenAPI specification file in folder local/
, and generate the output to a subfolder in out/
.
Files and folders under local/
and out/
are ignored by git.
Example command to generate google_drive library with api spec file example_api_specs/google-drive-api-v3-oas3.json
.
./bin/generate.sh \
-i example_api_specs/google-drive-api-v3-oas3.json \
-o out/google_drive \
--additional-properties=shardName=google_drive,moduleName=GoogleDrive,shardLicense=MIT,shardVersion=3.0.0,shardAuthors=cyangle,shardDescription=Google\ Drive\ V3\ API\ Client
The generated code would be written to out/google_drive
.