smithy-lang / smithy

Smithy is a protocol-agnostic interface definition language and set of tools for generating clients, servers, and documentation for any programming language.
https://smithy.io
Apache License 2.0
1.7k stars 201 forks source link

Add support for default trait on members #2267

Closed hpmellema closed 2 months ago

hpmellema commented 2 months ago

Background

Adds support for defaults on trait member values.

Applying the @default trait to a member will cause it to be treated as non-nullable and will set the value as the initial value for the member within the shape's builder.

Testing

A new set of integration tests were added to ensure the defaults for all types of members are set on a structure shape with no value for those default members.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.