[Elixir] Fall back to embedded templates when a custom template directory is set
Passing -t to the Elixir generator changes the embedded template lookup directory as well as the custom template directory. A user who overrides one template must then copy the remaining templates and partials too.
To reproduce, copy only modules/openapi-generator/src/main/resources/elixir/model.mustache into a temporary directory and generate the petstore with -g elixir --additional-properties=library=req -t <temporary-directory>. Generation fails with TemplateNotFoundException: licenseInfo; generation without -t succeeds. Adding that partial exposes the same missing-template problem for API and supporting files.
The constructor initializes only templateDir. When -t replaces that value, DefaultCodegen.embeddedTemplateDir() also returns the custom directory. Initialize embeddedTemplateDir and templateDir to "elixir" together so missing custom templates can still be loaded from the embedded resources.
The new regression test generates a Req client with only model.mustache in a custom directory, checks both directory settings, and verifies that model, API, and README files are generated. It fails with the reported missing partial on upstream master and passes with this change. All six Elixir generator tests pass. Regenerating both Elixir samples changes no files, and exporting generator documentation changes no files.
PR checklist
- Read the contribution guidelines.
- Run the following to build the project and update samples. The scoped build and regeneration commands used for this fix were:
All changed files are committed. Sample files were preserved../mvnw -q -pl modules/openapi-generator-cli -am -DskipTests install ./mvnw -pl modules/openapi-generator -Dtest=ElixirClientCodegenTest -DfailIfNoTests=false test ./bin/generate-samples.sh bin/configs/elixir.yaml bin/configs/elixir-req.yaml ./bin/utils/export_docs_generators.sh - If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
Elixir technical committee: @mrmstn
Summary by cubic
Fixes the Elixir generator so custom template directories fall back to embedded templates, allowing users to override a single template without copying the rest.
Passing -t previously redirected embedded template lookups to the custom directory as well. Overriding just model.mustache then failed generation with TemplateNotFoundException for unchanged templates and partials. Now the embedded template directory is initialized separately, so missing custom templates load from the bundled resources.
Adds a regression test that generates a Req client with only model.mustache overridden, marks the custom template, and asserts the generated model uses it while API and README output come from the embedded templates.