OpenAPITools / OpenAPITools/openapi-generator

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.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

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.

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.