-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[JAXRS] use contextPath variable for @ApplicationPath in RestApplication #850
Conversation
@wing328 Any more comments? |
@michbeck100: reviewing PRs take some time. This PR is also on my list... To ease test: can you remind me how to create different values for |
Exactly, but in the first case you will get |
@michbeck100 can you please manual remove |
@wing328 This behavior exists not just for jars-resteasy. The |
@michbeck100: For standard usage of the generator, splitting the files into a folder that is regenerated each time For usages with our |
I found an other case: |
The change looks good so we decided to merge it now in order to be in the One question: One finding: The trailing
Creates @ApplicationPath("/") And servers:
- url: 'http://localhost:9999/api/v3/' Creates @ApplicationPath("/api/v3/") I am not sure this can be added in |
For JAXRS it's not a problem. I personally like the trailing |
Glad to hear this. Please if you can me an hint on how to test the a project generated with |
A given openapi yaml like this: servers:
- url: http://localhost:8080/v2
paths:
/pet: would generate @ApplicationPath("/v2") Once you start the server, the url to |
@michbeck100 : yes I have checked the generated code. The part I am missing is: "Once you start the server" (this is probably a dummy Java/JackartaEE question, but what is the quickest way to start a server like a jetty with a JaxRS implementation. I have no JavaEE App server installed). |
You could start a sample server with $ mvn package org.apache.tomee.maven:tomee-embedded-maven-plugin:7.0.5:run in the root dir of the sample where the |
What about adding that to an auto-generated README? |
@wing328 already on my list. |
PR #920 |
…ion (OpenAPITools#850) * Use contextPath variable for RestApplication templates * Update generated RestApplication.java files, as they are skipped by default otherwise * Update Petstore sample for jaxrs so that CIs can verify the change
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.master
,3.3.x
,4.0.x
. Default:master
.Description of the PR
The mustache templates for the JAXRS application define
/
in the@ApplicationPath
annotation. This PR replaces this with{{{contextPath}}}
, which contains the path of the server url. If no additional path is given and the server url contains no trailing / the value is an empty string. This will be replaced again with / by JAXRS.