Update REST API classes to remove extraneous wrapper classes
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Refactoring
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- java, spring-boot
Direzione di ricerca
Inizia con le classi del modello della REST API, incluse Webhook e Product, e confronta il modo in cui le annotazioni wrapper di Jackson gestiscono gli oggetti singoli rispetto alle collezioni. Riproduci le forme di risposta documentate di Product e products, quindi determina se è possibile rimuovere i wrapper Root preservando entrambe le forme di deserializzazione; l’issue non identifica file o test specifici.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Much of the REST API model has "Root" classes which are just wrappers to handle the name of a JSON node.
I think we can get rid of all of those, by defining the actual model classes with a couple JSON annotations. An example is the Webhook class:
@JsonTypeName(value = "webhook")
@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)
Update:
This is trickier than expected. The main approach works fine for single item use, but causes issues when there's an array of items being mapped to a collection.
For example, for a single Product call, Shopify returns something like:
{
"product": {
"id": 632910392,
"title": "IPod Nano - 8GB",
"body_html": "
It's the small iPod......
Which is why we need the Product class to have the As.WRAPPER_OBJECT annotation (or the wrapper class).
However, when getting an array of products, Shopify sends in something like this:
{
"products": [
{
"id": 632910392,
"title": "IPod Nano - 8GB",
"body_html": "
It's the small iPo
Note the lack of "product" level nodes. That's what breaks here. So basically we want Product to wrap itself with a "product" node if it's a single Product, but to NOT wrap itself when its an array or collection. I can't find any easy way to do this. A custom de-serializer is an option, but I'm not sure that's a lot better/cleaner than these wrapper classes....
- Lingua principale
- Java
- Stelle
- 55
- Fork
- 18
- Merge medio
- 7h 14m
- PR unite (30g)
- 4
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di devondragon/SpringShopifyAppFramework
-
documentation enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
devondragon/SpringShopifyAppFramework#32 · 10 commenti ·
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 35/100
-
enhancement
devondragon/SpringShopifyAppFramework#24 · 1 commento · 1 assegnatario ·
-
devondragon/SpringShopifyAppFramework#12 · 5 commenti · 1 assegnatario ·
Tutte le issue di devondragon/SpringShopifyAppFramework
Issue simili
-
area-deployment area-integrations triage:bot-seen
Difficoltà 2/5 Mezza giornata Idoneità per principianti 86/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/flink-agents#1156 ·
-
[source-shopify] FAILED bulk operation without partialDataUrl is silently treated as successful Apertaarea/connectors autoteam community connectors/source/shopify needs-triage team/use type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100