We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1aaeba3 commit a1926d5Copy full SHA for a1926d5
app/src/main/java/hexlet/code/schemas/BaseSchema.java
@@ -26,6 +26,15 @@ public final boolean isValid(T value) {
26
.allMatch(t -> t.test(value));
27
}
28
29
+ /**
30
+ * Marks the schema as required, ensuring that the value being validated is not null.
31
+ * <p>
32
+ * This method adds a "required" validation to the schema, which checks that the provided value
33
+ * is not {@code null}. If the validation fails, the schema will indicate an error.
34
+ * </p>
35
+ *
36
+ * @return the current {@code BaseSchema} instance for method chaining.
37
+ */
38
public BaseSchema required() {
39
addValidation("required", Objects::nonNull);
40
return this;
0 commit comments