Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration option for a custom template directory #801

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

FelixScherzinger
Copy link
Contributor

Currently the location for template files is fixed and cannot be altered to personal needs. With this PR template locations can be customized in a way like changing the opanpi file location via input-base-dir is already implemented

@FelixScherzinger FelixScherzinger requested a review from a team as a code owner September 18, 2024 13:45
return getBaseDirRelativeToModule(config, getGlobalConfigName(INPUT_BASE_DIR), sourceDir);
}

private Optional<String> getTemplateBaseDirRelativeToModule(final Path sourceDir, final Config config) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template base directory must be relative to src/main/resources.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The input base dir is also not relative to the resources folder. Shouldn't template and input base dir be handled in a similar way?

Copy link
Member

@ricardozanini ricardozanini Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, baseDir is not meant to be used by the templates but by the openapi folder on the src/main.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just generalized the method for getting a base dir for a certain config value for simplicity reasons.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but in this case, we should evaluate if the templates will be distributed with your application.

  1. If the templates are distributed, they must be under src/main/resources.
  2. If not, under src/main.

In both cases, the relative directory to the templates must not be under baseDir. So we should handle this directory you are introducing to this PR differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants