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

[Java][jaxrs-spec] Make contextPath template parameter available as a string constant for use in @ApplicationPath #13377

Merged
merged 6 commits into from
Oct 3, 2022

Conversation

shamus13
Copy link
Contributor

@shamus13 shamus13 commented Sep 7, 2022

This PR extends the jaxrs-spec template creators to generate a class RestResourceRoot.java with a single string constant ROOT with the content of the template parameter `contextPath'. Secondly the existing generation of RestApplication.java has been updated to make use of this constant in its '@ApplicationPath' annotation. This PR relates to #13374

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (6.1.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608

shamus13 and others added 3 commits September 5, 2022 22:54
… resource root to be used in the @ApplicationPath annotation to make it easier for people, who want to write their own jax-rs Application class
package {{invokerPackage}};

public class RestResourceRoot {
public static final String ROOT = "{{{contextPath}}}";
Copy link
Member

Choose a reason for hiding this comment

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

thanks for the PR. one question from me is why do we need to store this ROOT separately in another class?

can you store it in RestApplication for example instead?

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 am using interface only, so that i can provide my own RestApplication class, where i add a bunch of exception mappers and such.

The variable could of course be defined in RestApplication, when that class is generated. In the interface only cases, i think, it would be odd to generate a RestApplication class without the @ApplicationPath annotation to hold this ROOT constant, that i am proposing. Btw perhaps APPLICATION_PATH would be a better name for this constant?

Copy link
Member

@wing328 wing328 Sep 20, 2022

Choose a reason for hiding this comment

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

Btw perhaps APPLICATION_PATH would be a better name for this constant?

yes, please rename it.

Copy link
Member

Choose a reason for hiding this comment

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

when ready, please PM me via slack for review and merged.

@shamus13
Copy link
Contributor Author

@wing328 I have updated my pull request with a simple renaming of the constant as suggested. Can't message you on Slack though, since i do not have it installed or even have an account.

@wing328 wing328 merged commit 2f48c59 into OpenAPITools:master Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants