Skip to content

Add processor to detect shared events + customization to duplicate. #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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

alextwoods
Copy link

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:

  1. A new customization config (duplicateAndRenameSharedEvents)
  2. A new processor (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

  • Bug fix (non-breaking change which fixes an issue)
  • [ x ] New feature (non-breaking change which adds functionality)

Checklist

  • [ x] I have read the CONTRIBUTING document
  • [ x] Local run of mvn install succeeds
  • [ x] My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • [ x] I have added tests to cover my changes
  • [ x] All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • [x ] I confirm that this pull request can be released under the Apache 2 license

},
"InputEventTwo": {
"shape": "InputEventTwo"
}
},
"eventstream": true
},
"InputEventOne": {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a number of existing test models which have shared events like this - They don't cause issues in the current test because they aren't used to generate/build a full SDK.

We have a few options, we can:

  1. Modify the test model to duplicate the shape (as is done here).
  2. Add the new customization flag to customization.config for each model to do the rename.
  3. Disable the new processor for these cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant