This directory contains scripts and custom templates for regenerating the DocuSign Elixir library from the OpenAPI specification.
Before running the scripts, ensure:
- You have the OpenAPI Generator installed (version 7.0.0 or later)
- Java runtime environment (required by OpenAPI Generator)
- A working Elixir development environment
The regeneration script handles everything automatically:
cd scripts/regen
./regenerate_library.shThis will:
- Download the latest OpenAPI specification from DocuSign's official repository
- Generate the client code using our custom Mustache templates
- Apply necessary post-processing (module naming, formatting)
- Run tests to verify everything works
The custom_templates/ directory contains our customized Mustache templates that produce:
- Proper Elixir module naming conventions
- Correct type specifications that pass Dialyzer
- Jason encoder/decoder integration (replacing Poison)
- Req.Response types instead of Tesla.Env
- Clean, formatted code that passes
mix format
Templates included:
api.mustache- API module generationmodel.mustache- Model struct generationrequest_builder.mustache- Request building logicdeserializer.mustache- Response deserialization
./regenerate_library.sh- Standard regeneration./regenerate_library.sh --download- Force download latest spec./regenerate_library.sh --clean- Clean all generated files first
The script regenerates:
lib/docusign/api/*.ex- All API endpoint moduleslib/docusign/model/*.ex- All model/struct modules- Updates to RequestBuilder and Deserializer modules
These files are NOT regenerated and contain our customizations:
lib/docusign/connection.ex- Connection management and retry logiclib/docusign/file_downloader.ex- File download functionalitylib/docusign/telemetry.ex- Telemetry integrationlib/docusign/webhook_plug.ex- Webhook handling- All test files
- All documentation
After generation, the script automatically:
- Fixes module naming (from OpenAPIDocusignEsignRestV21 to DocuSign)
- Ensures all files pass
mix format - Runs the test suite to verify compatibility
- The custom templates eliminate the need for ModelCleaner (Req handles nil values properly)
- Generated code requires minimal manual intervention
- Tests should pass immediately after regeneration
- The latest spec is downloaded from: https://github.com/docusign/OpenAPI-Specifications
If you encounter issues:
- Ensure OpenAPI Generator is installed:
openapi-generator-cli version - Check Java is available:
java -version - Review the generated files in
generated/before they're copied - Check test failures for specific compatibility issues