-
Notifications
You must be signed in to change notification settings - Fork 197
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
Representing a list at the root of the output #2270
Comments
Looks like you're using
|
output := {
@httpPayload
content: UserList
} do this instead, get rid of |
oh, I didn't know about that part. So yeah, my advice won't help 😓 I suppose it'll just fail validation due to targetting a list shape. |
While it's not as straightforward (and not exactly what you're desiring), if you adjust your model as @kubukoz said, you can try modifying your server to return a payload like |
Thanks for reaching out @haydenbaker @kubukoz. Is it possible to achieve the desired result using some other protocol? If yes, could you suggest me one? One other question:
My smithy-build.json file looks like this:
but when I run smithy build I got the following warning in the terminal: [WARNING] Unable to find a protocol generator for pdapi#PlantDemandService: The pdapi#PlantDemandService service supports the following unsupported protocols [alloy#simpleRestJson]. The following protocol generators were found on the class path: [aws.protocols#restXml, aws.protocols#ec2Query, aws.protocols#awsJson1_1, aws.protocols#awsQuery, aws.protocols#awsJson1_0, aws.protocols#restJson1] When I open one of generated typescript commands, the serializer and deserializer methods don't have any implementation, just throws an error:
Do you have any idea why this happens? |
I think |
You can try the other JSON protocols given in the error message. However, your best bet is to change the server response. |
Closing due to inactivity and having proposed solutions. Please reopen if you need additional assistance. |
I am encountering an issue with representing a list at the root of the output. I have an API endpoint that returns an array of users like this:
[{ id: 1, name: 'A' }, { id: 2, name: 'B' }]
I am trying to build a model to handle this scenario
I have the following model:
When I try to call getUsersList operation I get the following error:
TypeError: Expected object, got array
How can I solve this?
The text was updated successfully, but these errors were encountered: