Skip to content

Commit

Permalink
fix(sendgrid): missing notEmpty constraints for name and email (#2320)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksiivanov committed Apr 16, 2024
1 parent 9f1235c commit 8ad4890
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
"id" : "from.name",
"label" : "Name",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "sender",
"binding" : {
Expand All @@ -76,6 +79,9 @@
"id" : "from.email",
"label" : "Email address",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "sender",
"binding" : {
Expand All @@ -87,6 +93,9 @@
"id" : "to.name",
"label" : "Name",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "receiver",
"binding" : {
Expand All @@ -98,6 +107,9 @@
"id" : "to.email",
"label" : "Email address",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "receiver",
"binding" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
"id" : "from.name",
"label" : "Name",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "sender",
"binding" : {
Expand All @@ -71,6 +74,9 @@
"id" : "from.email",
"label" : "Email address",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "sender",
"binding" : {
Expand All @@ -82,6 +88,9 @@
"id" : "to.name",
"label" : "Name",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "receiver",
"binding" : {
Expand All @@ -93,6 +102,9 @@
"id" : "to.email",
"label" : "Email address",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "receiver",
"binding" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,30 @@ public class SendGridRequest {
private String apiKey;

public record Sender(
@TemplateProperty(group = "sender", label = "Name") String name,
@TemplateProperty(group = "sender", label = "Email address") String email) {}
@TemplateProperty(
group = "sender",
label = "Name",
constraints = @TemplateProperty.PropertyConstraints(notEmpty = true))
String name,
@TemplateProperty(
group = "sender",
label = "Email address",
constraints = @TemplateProperty.PropertyConstraints(notEmpty = true))
String email) {}

@Valid @NotNull private Sender from;

public record Recipient(
@TemplateProperty(group = "receiver", label = "Name") String name,
@TemplateProperty(group = "receiver", label = "Email address") String email) {}
@TemplateProperty(
group = "receiver",
label = "Name",
constraints = @TemplateProperty.PropertyConstraints(notEmpty = true))
String name,
@TemplateProperty(
group = "receiver",
label = "Email address",
constraints = @TemplateProperty.PropertyConstraints(notEmpty = true))
String email) {}

@Valid @NotNull private Recipient to;

Expand Down

0 comments on commit 8ad4890

Please sign in to comment.