-
Notifications
You must be signed in to change notification settings - Fork 202
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
ENH: conditional required annotation for schema #5109
ENH: conditional required annotation for schema #5109
Conversation
Signed-off-by: George Chen <[email protected]>
Signed-off-by: George Chen <[email protected]>
Signed-off-by: George Chen <[email protected]>
Signed-off-by: George Chen <[email protected]>
Signed-off-by: George Chen <[email protected]>
@@ -20,6 +21,16 @@ | |||
import java.util.Locale; | |||
import java.time.format.DateTimeFormatter; | |||
|
|||
@ConditionalRequired(value = { | |||
@ConditionalRequired.IfThenElse( | |||
ifFulfilled = {@ConditionalRequired.SchemaProperty(field = "match", value = "null")}, |
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.
Nit: Having a static import for @ConditionalRequired.SchemaProperty
probably will make this statement more easy to read
@ConditionalRequired.IfThenElse( | ||
ifFulfilled = { | ||
@ConditionalRequired.SchemaProperty(field = "format", value = "null"), | ||
@ConditionalRequired.SchemaProperty(field = "value_expression", value = "null"), |
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.
Is there a way to express OR
releation when there are more than one condition grouped under ifFulfilled
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.
For OR relation we have to use separate IfThenElse annotation
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.
goit 👍
Signed-off-by: George Chen <[email protected]>
|
||
@ConditionalRequired(value = { | ||
@IfThenElse( |
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.
Do we need to add a test for this annotation.
import org.opensearch.dataprepper.model.event.EventKey; | ||
|
||
import java.util.List; | ||
|
||
@ConditionalRequired(value = { | ||
@IfThenElse( |
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.
Do we need to add a test for this annotation
Description
This PR
Issues Resolved
Resolves #[Issue number to be closed when this PR is merged]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.