-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(go): updates to RFC204 - golang bindings #292
Conversation
This updates RFC204 based on the latest developments for the implementation thereof. In particular, the following elements have been changed: - Updates to *jsii interfaces* (aka: behavioral interfaces) - Added a go struct for the concrete jsii proxy object - Updates to *jsii structs* (aka: datatype interfaces) - Replaced `Iface` suffix in go interface names with an `I` prefix - Added *Approach 3* for handling jsii struct inheritance - Updates to *jsii classes* - Removed `Iface` suffix from go interfaces generated for classes - Un-exported the go struct concrete type for the jsii proxy objects - Removed unused properties from concrete types for jsii proxy objects - Used mock jsii runtime calls to clarify activities that are proxied to the `@jsii/kernel` process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks much better from the DevX point of view. I am not sure I fully understand the convoluted setup around data types. I'll follow up face to face
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
} | ||
|
||
// Optional - we can reduce boilerplate for conversion of BaseServiceProps -> BaseServiceOptions: | ||
func (b BaseServiceProps) ToBaseServiceOptions() BaseServiceOptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice touch
As suggested in aws/aws-cdk-rfcs#292, using `_` to separate the constant name from the type name, and preserving the constant's casing results in an API that is slightly more readable, and less prone to namespace collisions.
As proposed in aws/aws-cdk-rfcs#292 (this is *Approach 4*), stop rendering go interfaces to represent jsii structs, and instead only emit a plain go struct with the flattened list of fields (own + all super interfaces). Made the necessary code changes to de-serialize structs returned by-reference by the `@jsii/kernel` by eagerly fecthing all properties. Also, implemented the option to offer convenience conversion functions to easily create a parent type from a child type.
As suggested in aws/aws-cdk-rfcs#292, using `_` to separate the constant name from the type name, and preserving the constant's casing results in an API that is slightly more readable, and less prone to namespace collisions.
As proposed in aws/aws-cdk-rfcs#292 (this is *Approach 4*), stop rendering go interfaces to represent jsii structs, and instead only emit a plain go struct with the flattened list of fields (own + all super interfaces). Made the necessary code changes to de-serialize structs returned by-reference by the `@jsii/kernel` by eagerly fecthing all properties. Also, implemented the option to offer convenience conversion functions to easily create a parent type from a child type.
This updates RFC204 based on the latest developments for the
implementation thereof. In particular, the following elements have been
changed:
Updates to jsii enums
_
Updates to jsii interfaces (aka: behavioral interfaces)
Updates to jsii structs (aka: datatype interfaces)
Iface
suffix in go interface names with anI
prefixUpdates to jsii classes
Iface
suffix from go interfaces generated for classesto the
@jsii/kernel
process_
to separate the type name & static method or property nameUpdates to properties:
structs
approaches 1, 2 and 3,removed the
Get
prefix from getters (keepingSet
prefix for setters), tomatch the recommendations of effective go
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache-2.0 license