-
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
Improvements to the schema for the key_value processor. #5051
Improvements to the schema for the key_value processor. #5051
Conversation
This adds a none option to the whitespace enum while still supporting empty string. It includes default values to prevent fields from displaying that they are required. It also provides a solution for the schema generation which removes any property with a defaultValue from the list of required fields. Signed-off-by: David Venable <[email protected]>
protected boolean isRequired(final MemberScope<?, ?> member) { | ||
final JsonProperty jsonPropertyAnnotation = member.getAnnotationConsideringFieldAndGetter(JsonProperty.class); | ||
if(jsonPropertyAnnotation != null) { | ||
if(jsonPropertyAnnotation.defaultValue() != null && !jsonPropertyAnnotation.defaultValue().isEmpty()) { |
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 have any cases where null value is allowed but defaultValue is not 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.
Technically you cannot provide null
to the the annotation's defaultValue
field. So this should never be reached. I added the != null
as a defensive programming approach.
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 a more general point-of-view, anytime that a defaultValue
is provided, regardless of the value, then the field is not required.
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.
Sorry my misread. I thought this condition means required.
@@ -44,6 +45,8 @@ Function<String, String> getTransformFunction() { | |||
|
|||
@JsonCreator | |||
public static TransformOption fromTransformName(final String transformName) { | |||
if(Objects.equals(transformName, "")) |
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: space
Signed-off-by: David Venable <[email protected]>
…roject#5051) Signed-off-by: David Venable <[email protected]>
Description
This adds a none option to the whitespace enum while still supporting empty string. It includes default values to prevent fields from displaying that they are required. It also provides a solution for the schema generation which removes any property with a defaultValue from the list of required fields.
Issues Resolved
N/A
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.