zclconf / go-cty

A type system for dynamic values in Go applications
MIT License
348 stars 71 forks source link

Add `optional` field tag option #120

Open NoF0rte opened 2 years ago

NoF0rte commented 2 years ago

Marking a field with cty:"name,optional" will set that field as an optional field

apparentlymart commented 2 years ago

Thanks for working on this, @NoF0rte!

I'm not planning to extend the experimental optional attributes mechanism anywhere else right now because experience with it has shown that it has various quirks and rough edges in practical applications, but if subsequent work leads to it still having a similar-ish shape to the current design then I'd love to use this PR as a basis for making it available to gocty too.

I'm going to leave this open for now and revisit once there's a clearer idea of what the future of this experimental feature looks like. Thanks again!