cloudydeno / deno-aws_api

From-scratch Typescript client for accessing AWS APIs
https://deno.land/x/aws_api
59 stars 3 forks source link

fix(generation): Don't require all Lists on input structures #21

Closed danopia closed 2 years ago

danopia commented 2 years ago

This was originally intended as a convenience feature around output types, because our XML parser will always supply a value for lists and maps, even if it's empty. But sometimes the same interface is used as both an Input and Output, and requiring all lists for Inputs is effectively a bug.

The fix is to disable our output structure upgrade logic on any interface that is also used as an input in the specific API being generated. So you just need to do a null check when reading lists off those specific outputs, something the official SDK makes you do all the time.

Fixes #16

When using an action filter it's less likely that this kill-switch will kick in, but with whole modules it's actually pretty common.

backwards compat

codegens v0.1 and v0.2 are retaining old behavior as otherwise this would introduce typecheck errors in existing user code.