-
Notifications
You must be signed in to change notification settings - Fork 932
Add duplicateAndRenameSharedEvents customization to support event shapes shared with multiple evenstreams #6031
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
base: master
Are you sure you want to change the base?
Conversation
|
...sdk/codegen/emitters/customizations/processors/uselegacyeventgenerationscheme/service-2.json
Show resolved
Hide resolved
+ "customization config duplicateAndRenameSharedEvents.%s", | ||
newShapeName, eventStreamName)); | ||
} | ||
serviceModel.getShapes().put(newShapeName, eventMemberShape); |
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.
I may be misunderstanding the intent here, but In this case, is the newShapeName and shapeToDuplicate refers to the same Shape object? Is this the intended behavior, or should we create a deep copy of the Shape object?
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.
Yea, good call out. I had originally done this to reduce memory but thinking about it more, I think we should deep copy here to prevent possible surprise if anything else is modifying the shapes. I've updated.
|
Add processor to detect shared events + customization to duplicate.
Motivation and Context
When an event shape is shared between multiple eventstreams, it causes SDK generation/compilation failures. The top level shape POJO implements the event stream interface for each stream and the return type of the
sdkEventType
method conflicts.Modifications
This PR adds two things:
duplicateAndRenameSharedEvents
)EventStreamSharedEventProcessor
) which applies the customization and raises helpful error messages if shared events are detected.Testing
Added new unit tests to cover processor/config. Manual testing of internal service model that raised this issue.
Screenshots (if appropriate)
N/A
Types of changes
Checklist
mvn install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License