Julia template: `eval` of `parse` anti-pattern

Open Beginner friendly
#23,941 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Quiet
Tech stack
julia
Domain
tooling

Research direction

Start with modules/openapi-generator/src/main/resources/julia-server/partial_model_oneof.mustache and julia-client/partial_model_oneof.mustache at the referenced resolver lines. Confirm that the model-name substitutions are valid Julia identifiers and preserve the generated resolver behavior. Done means both templates use direct model references without eval or Meta.parse.

Written by the indexing model from the issue text.

Description

The julia-server and julia-client generators emit the OpenAPI.property_type discriminator resolver using eval(Base.Meta.parse("ModelName")). The model types are already in scope in the generated module, so straight ModelName works: ~30× faster on the resolver call and pre-compilation friendly, while keeping the behavior the same.

Relevant template pieces: lines 16, 18 here and here: simply replace with return {{modelName}} and return {{.}}.

Worth confirming {{modelName}} is always a valid Julia identifier (true for normal model names) before merging.

Dominant language
Java
Stars
26.8k
Forks
7.7k
Avg merge
1d 10h
Merged PRs (30d)
103

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenAPITools/openapi-generator

All issues in OpenAPITools/openapi-generator

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.