OpenAPITools / OpenAPITools/openapi-generator

[REQ] Add path of moustache file used to generated source file

Open
#12,060 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Is your feature request related to a problem? Please describe.

I am new to OpeAPITools but have quite a bit of Java experience. I am looking into how the spring boot Api files have their sample return values generated. It has taken a very long time to find out that it came from "api.moustache" and then again additional time to find out which one to use. The folder "JavaSpring" is only intuitive if you know already.

If the relative path of api.moustace had been in a comment in the top of the file, that would have helped a lot.

Describe the solution you'd like

A comment in each source file saying "Generated from ..../../../api.moustache"

Alternatively the text output for each when the maven plugin runs would state which template had been used for generating that file.

Describe alternatives you've considered

So far I had to identify that each source file is written by TemplateManager.writeToFile and set a conditional break point using filename.endsWith and then navigate up the stack to look into variables to find the name of the directory used.

Additional context

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 at TemplateManager.writeToFile and trace how the JavaSpring api.moustache template is selected and how generated source files are written. Compare the two proposed approaches: adding the template path to generated-file comments or reporting it when the Maven plugin runs. Done means the template used for each generated file is discoverable without debugger-based stack inspection.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.