eclipse-vertx / eclipse-vertx/vertx-codegen

Introduce custom formatter for json property names

Ouverte
#335 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
enhancement
Langage dominant
Java
Étoiles
111
Forks
88
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

#### 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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez dans src/main/java/io/vertx/codegen/generators/dataobjecthelper/DataObjectHelperGen.java, autour du point référencé de sélection du formateur, puis examinez la gestion existante du classloader de loadJsonMappers. Définissez comment un formateur est chargé depuis le classpath de compilation et vérifiez le scénario à deux projets décrit dans l’issue. C’est terminé lorsqu’un @DataObject peut mapper endpointConfigs vers endpoints pour la conversion JSON dans les deux sens.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
devtools
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.