Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #13374
Closed
Open
Issue created Sep 07, 2022 by Administrator@rootContributor

[REQ] [jaxrs-spec] Make contextPath available as a string constant for use in @ApplicationPath(...)

Created by: shamus13

Hi guys,

I am trying to use the jaxrs-spec-interface server template creators to build a war application containing several independent REST services. I am using exception mappers etc specific to each service, so i am writing my own @ApplicationPath annotated classes for the services, but i find it a bit annoying, that i have to provide the base path aka 'contextPath' for the @ApplicationPath("/thePath") myself.

I would like the template creator to generate a string constant with the content of the 'contextPath', which i can use instead of a string litteral. F.x '@ApplicationPath(RootResource.ROOT)'

I have looked into custom templates etc, but i do not see a path to success going down that path. I am using the openapi generator gradle plugin, and i do not see support for custom templates in the plugin I am also constrained in my choice of template creators to JAXRS due to project requirements.

I have looked into the jaxrs-spec creator code and templates, and it is fairly easy to extend the creators to produce a class with the string constant, i am looking for. I will create a tiny PR for this.

Assignee
Assign to
Time tracking