Skip to content

Commit

Permalink
Fix doc, add comment about recursive refs
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonpaulos committed May 28, 2024
1 parent bf8208f commit 5fd9cec
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion typescript_templates/model.vm
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ $unknown.type ## force a template failure with an unknown type
#end
#if ($param.arrayType && $param.arrayType != "")[]#end## Add array postfix to arrays...
#end
## Converts a parameter type into the SDK specific type.
## Gets the Schema object for a given type.
#macro ( toSchema $className $param )
#if ( $param.arrayType )
new ArraySchema(##
Expand Down Expand Up @@ -317,6 +317,8 @@ export class $def.name implements Encodable {
static get encodingSchema(): Schema {
if (!this.encodingSchemaValue) {
this.encodingSchemaValue = new NamedMapSchema([]);
## By assigning a value to this.encodingSchemaValue before getting the .encodingSchema fields of other types,
## we allow circular references to be handled properly.
(this.encodingSchemaValue as NamedMapSchema).entries.push(
#foreach( $prop in $props )
{ key: '$prop.propertyName', valueSchema: #toSchema($def.name, $prop), required: $prop.required, omitEmpty: true },
Expand Down

0 comments on commit 5fd9cec

Please sign in to comment.