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

Trouble with NewLazyDocument and map[string]interface{} #532

Closed
mgomes opened this issue Aug 16, 2024 · 1 comment
Closed

Trouble with NewLazyDocument and map[string]interface{} #532

mgomes opened this issue Aug 16, 2024 · 1 comment

Comments

@mgomes
Copy link

mgomes commented Aug 16, 2024

Here is a minimally reproducible example of the issue I am running into:

package main

import (
	"fmt"
	"log"

	"github.com/aws/aws-sdk-go-v2/service/bedrockruntime/document"
)

func main() {
	doc := document.NewLazyDocument(map[string]interface{}{
		"param1": "value1",
	})

	var result map[string]interface{}
	err := doc.UnmarshalSmithyDocument(&result)
	if err != nil {
		log.Fatalf("Error unmarshalling Smithy document: %v", err)
	}

	fmt.Printf("Unmarshalled result: %+v\n", result)
}

Running this code produces the error: Error unmarshalling Smithy document: unsupported json type, *map[string]interface {}

Is NewLazyDocument storing the map as a pointer internally somehow and so it isn't getting recognized? It seems like it should work when looking at the decoder: https://github.com/aws/smithy-go/blob/main/document/json/decoder.go#L71.

@mgomes
Copy link
Author

mgomes commented Aug 16, 2024

Closing this, I opened up the issue in the aws-sdk instead: aws/aws-sdk-go-v2#2751

@mgomes mgomes closed this as completed Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant