Skip to content

Commit

Permalink
Type safe method to add validation to a Schema (#716)
Browse files Browse the repository at this point in the history
  • Loading branch information
987Nabil committed Aug 30, 2024
1 parent ce8cca1 commit 416aaf1
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 @@ -151,6 +151,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 416aaf1

Please sign in to comment.