Skip to content

Commit

Permalink
Type safe method to add validation to a Schema (#716) (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
987Nabil authored Sep 3, 2024
1 parent fc1b601 commit c741f6b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions zio-schema/shared/src/main/scala/zio/schema/Schema.scala
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ sealed trait Schema[A] {

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

def validation(validation: Validation[A]): Schema[A] = annotate(zio.schema.annotation.validate(validation))

/**
* Returns a new schema that combines this schema and the specified schema together, modeling
* their tuple composition.
Expand Down

0 comments on commit c741f6b

Please sign in to comment.