Skip to content

Conversation

matteomazza91
Copy link

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./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\.
  • Filed the PR against the correct branch: 3.0.0 branch for changes related to OpenAPI spec 3.0. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Short Description:
I moved the 'useAnnotatedBasePath' from the cxf codegen to the abstract jaxrs codegen.
This change enables the standard codegens to serve more situations without that (some) jaxrs users needs to write their custom generator.

Long Description:
Using the jaxrs server codegen (for jersey), I found some difficulties to generate code for my project.
As already said here, this generator seems to be used as a project skeleton. To generate only a REST interface, a custom codegen should be created.

This change lets the generator(s) be more elastic to adapt at user needs:
The 'useAnnotatedBasePath' can be used by all the implementation of the abstract jaxrs codegen. This way, it is possible to exploit .swagger-codegen-ignore to avoid generation of servlet filters and web.xml like files. Then, the 'useAnnotatedBasePath' options enables other loosly coupled software components to exploit the @Path annotation (now containing also the basePath)

As an example:
A custom webserver can inspect a rest package to discover through java introspection the jaxrs annotated class.
Thus, the webserver and the rest controllers are loosly coupled without rewriting a new custom codegen.

tests

I've not the full environment. I cannot test all the project.
I've run only the unit test through maven and I'm using this version as generator for my project

@matteomazza91 matteomazza91 force-pushed the jaxrs_use_annotated_base_path branch from c259b96 to 71e8361 Compare January 3, 2018 17:37
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.

3 participants