Add subject field to all *OptionDiscovered events#347
Merged
yevhenii-nadtochii merged 7 commits intomasterfrom Apr 15, 2025
Merged
Add subject field to all *OptionDiscovered events#347yevhenii-nadtochii merged 7 commits intomasterfrom
subject field to all *OptionDiscovered events#347yevhenii-nadtochii merged 7 commits intomasterfrom
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #347 +/- ##
============================================
+ Coverage 74.81% 74.82% +0.01%
Complexity 615 615
============================================
Files 196 196
Lines 4256 4254 -2
Branches 396 396
============================================
- Hits 3184 3183 -1
+ Misses 939 938 -1
Partials 133 133 🚀 New features to boost your workflow:
|
Contributor
Author
armiol
approved these changes
Apr 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds
subjectfield to all*OptionDiscoveredevents.Having this field instead of just
FieldName,TypeNameand so on, helps to validate the option right inPolicyupon the*OptionDiscoveredevent. Otherwise, we have to collect the required data in a view and only then validate. And the view doesn't know whether a member is marked with the option in advance.Currently, we already have
subjectforFieldOptionDiscoveredandOneofOptionDiscoveredevents. This change set suggests propagating this property to all similar events:TypeOptionDiscovered(replacetype: TypeName→subject: MessageType)EnumOptionDiscovered(replacetype: TypeName→subject: EnumType)EnumConstantOptionDiscovered(replacetype: TypeName,constant: ConstantName→subject: EnumConstant)ServiceOptionDiscovered(replaceservice: ServiceName→subject: Service)RpcOptionDiscovered(replaceservice: ServiceName,rpc: RpcName→subject: Rpc)The only exception is
FileOptionDiscovered, which will continue to have justfile: Filefor the following reasons:file: Fileproperty is requested byFileAwareinterface, which is implemented by everyastevent.subject: Filehas no sense.Additionally, I suggest renaming of
TypeOptionDiscoveredtoMessageOptionDiscovered. Atypecan be a message or enum, but we already haveEnumOptionDiscoveredevent for that.