aws / aws/aws-sdk-java-v2

DynamoDB Enhanced: Support schema mixins

Aperta
#5,375 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
dynamodb-enhanced feature-request p3
Lingua principale
Java
Stelle
2.6k
Fork
1k
Merge medio
2g 9h
PR unite (30g)
51

Descrizione

### Describe the feature

For classes that for whatever reason cannot carry Jackson annotations directly, Jackson supports defining a "mixin" interface that mirrors the properties of the class and has the desired annotations. It would be helpful if the Enhanced client had a similar capability.

### Use Case

I have a number of data classes that are defined in client or API dependencies (for example, for message-driven microservices that communicate over SNS/SQS). In particular, I have one domain value class that is a nested property on a top-level record class. If I want to use `TableSchema.fromClass(RecordClass)`, then `NestedClass` also has to carry the `@DynamoDbBean` annotation, but then I have to add otherwise-unnecessary DynamoDB dependencies the client library (even if `optional`).

### Proposed Solution

Add annotation `@DynamoDbMixin(value = Class)` with target `TYPE`. Extend `TableSchema.fromClass(Class)` to also accept `Class mixins...`, where if a type whose schema is being created has a provided mixin, the mixin is introspected to determine the properties to be mapped. The mixin should be checked only for property enumeration and should not require the presence of setters.

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### AWS Java SDK version used

2.21.25

### JDK version used

openjdk version "11.0.11" 2021-04-20

### Operating System and version

Gentoo Linux

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Partire dal punto di ingresso TableSchema.fromClass(Class) di DynamoDB Enhanced Client e analizzare come vengono attualmente introspezionate le annotazioni e le proprietà. Definire l’annotazione @DynamoDbMixin e l’API varargs, quindi verificare che i mixin forniti enumerino le proprietà mappate senza richiedere setter e che gli schemi nidificati utilizzino il mixin appropriato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
aws, java
Ambito
databases
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.