Go: impossible to tell which fields are required in a struct #2536
Labels
bug
This issue is a bug.
effort/medium
Medium work item – a couple days of effort
language/go
Regarding GoLang bindings
p2
🐛 Bug Report
Affected Languages
Golang
TypeScript
orJavascript
Python
Java
C#
,F#
, ...)General Information
What is the problem?
When generating Go structs from jsii data types, there is currently no indication (let alone compile-type check) to tell users which fields in the struct are required and which are optional:
Go output:
What are our options in Go to address this? At the minimum, we should obviously generate some documentation that indicates which fields are required and what are the default values. Is there a way to get type-checking help?
Addendum:
This issue tracks adding doc comments indicating which fields are
required
vsoptional
to ensure that this is available during autocompletion. IE, when a user starts typing a property name, the documentation for that property will be displayed in their IDE telling them whether the field is optional or required.There is an additional ticket to panic at runtime when required fields are nil #2672
The text was updated successfully, but these errors were encountered: