0a45f8d3ab
When computing the type name for a field of an object type, we must ensure that we do not generate invalid recursive struct types. A struct type T contains invalid recursion if the closure of its fields and its struct-typed fields' fields includes a field of type T. A few examples: Directly invalid: type T struct { Invalid T } Indirectly invalid: type T struct { Invalid S } type S struct { Invalid T } In order to avoid generating invalid struct types, we replace all references to types involved in a cyclical definition with *T. The examples above therefore become: (1) type T struct { Valid *T } (2) type T struct { Valid *S } type S struct { Valid *T } We do this using a rewriter that turns all fields involved in reference cycles into optional fields. These changes also include an enhancement to the SDK codegen test driver in the interest of making iterating and debugging more convenient: if the -sdk.no-checks flag is passed, the driver will not run post-generation checks. |
||
---|---|---|
.. | ||
docs | ||
dotnet | ||
go | ||
nodejs | ||
python | ||
schema.yaml |