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

Introduce custom formatter for json property names #335

Open
pk-work opened this issue May 7, 2021 · 0 comments
Open

Introduce custom formatter for json property names #335

pk-work opened this issue May 7, 2021 · 0 comments

Comments

@pk-work
Copy link
Contributor

pk-work commented May 7, 2021

Describe the feature

Introduce custom formatter for json property names

Use cases

I have a POJO which is annotated with @dataobject (vertx-codegen) to convert it into JSON and back. This POJO has an attribute called "endpointConfigs", but in the JSON I want to call it "endpoints". I saw that @dataobject has a property called "jsonPropertyNameFormatter", which I think is exactly what I need.

Contribution

I would try to implement this feature. @vietj gave me already some entry points in discord, which I will add to this description then we have everything on one page.

Place to choose the formatter [1].

Discord messages
  • ideally we should be able to support loading this class from a classloader
  • I think the most difficult issue is using the correct classloader for this
  • Introducing a new classloader and configure the classpath in codegen config is the wrong direction, because it adds more complexcity.
  • if you look at loadJsonMappers we do use getClass().getClassLoader() so perhaps it should simply work with this
  • you need two projects one jar with the Case one project that use it from compilation classpath (I hope I can solve it more elegant with just in time compilation)

[1] https://github.com/vert-x3/vertx-codegen/blob/730d4f707ef4eb8d6dca489614b9a5e9e0e3c182/src/main/java/io/vertx/codegen/generators/dataobjecthelper/DataObjectHelperGen.java#L349

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

No branches or pull requests

1 participant