aws / aws/aws-sdk-java-v2

Support construction of Document from java POJOs

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

Descrizione

### Describe the feature

Document is a type supported in smithy which can be used to pass unstructured data like json - https://smithy.io/2.0/spec/simple-types.html#document This is an alternative to sending json strings.

However the java AWS SDK support for it requires json to be hand crafted into a document class.

Example Json:

{ "prompt" : "hello" }

needs to be converted as Document as shown below, before it can be passed to an API

Document.fromMap(ImmutableMap.of("prompt", Document.fromString("text"))

It would helpful if Document class provides a helper method `fromObject` where we can pass a Java POJO (similar to dynamo db enhanced client's bean schema)

### Use Case

It is frustrating for customers to create Document objects to send in a json unstructured data in an API request. For example; APIs like Bedrock's Converse takes in Document type which is cumbersome to do in Java. For other languages like python and javascript, you can send in the json object as is.

### Proposed Solution

_No response_

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

latest

### JDK version used

17

### Operating System and version

macOs

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start by inspecting the Java SDK's Document type and the DynamoDB enhanced client's bean schema, which the issue identifies as relevant examples. Determine the expected POJO-to-document behavior and API surface, then verify that a fromObject helper can represent the shown JSON use case without requiring manual Document construction.

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

Valutazione

Stack tecnologico
java
Ambito
api
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.