Skip to content

Commit c741f6b

Browse files
authored
Type safe method to add validation to a Schema (#716) (#734)
1 parent fc1b601 commit c741f6b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

zio-schema/shared/src/main/scala/zio/schema/Schema.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ sealed trait Schema[A] {
156156

157157
def validate(value: A)(implicit schema: Schema[A]): Chunk[ValidationError] = Schema.validate[A](value)
158158

159+
def validation(validation: Validation[A]): Schema[A] = annotate(zio.schema.annotation.validate(validation))
160+
159161
/**
160162
* Returns a new schema that combines this schema and the specified schema together, modeling
161163
* their tuple composition.

0 commit comments

Comments
 (0)