Skip to content

Commit

Permalink
Update docs and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dhoepelman committed Nov 13, 2024
1 parent 310c904 commit 59f5096
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ val validationResult = validateUser(invalidUser)
since the validation fails the `validationResult` will be of type `Invalid` and you can get a list of validation errors by indexed access:

```kotlin
validationResult[UserProfile::fullName]
validationResult.errors.messagesAtPath(UserProfile::fullName)
// yields listOf("must have at least 2 characters")

validationResult[UserProfile::age]
validationResult.errors.messagesAtPath(UserProfile::age)
// yields listOf("must be at least '0'")
```

Expand All @@ -80,8 +80,8 @@ or you can get all validation errors with details as a list:
```kotlin
validationResult.errors
// yields listOf(
// ValidationError(dataPath=.fullName, message=must have at least 2 characters),
// ValidationError(dataPath=.age, message=must be at least '0'
// ValidationError(path=ValidationPath(Prop(fullName)), message=must have at least 2 characters),
// ValidationError(path=ValidationPath(Prop(age)), message=must be at least '0')
// )
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.konform.validation

import io.konform.validation.jsonschema.const
import io.konform.validation.jsonschema.enum
import io.konform.validation.jsonschema.maxLength
import io.konform.validation.jsonschema.minItems
import io.konform.validation.jsonschema.minLength
import io.konform.validation.jsonschema.pattern
import io.konform.validation.constraints.const
import io.konform.validation.constraints.enum
import io.konform.validation.constraints.maxLength
import io.konform.validation.constraints.minItems
import io.konform.validation.constraints.minLength
import io.konform.validation.constraints.pattern
import io.konform.validation.path.PathSegment.Func
import io.konform.validation.path.PathSegment.MapKey
import io.konform.validation.path.ValidationPath
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.konform.validation

import io.konform.validation.jsonschema.maxLength
import io.konform.validation.jsonschema.minLength
import io.konform.validation.jsonschema.pattern
import io.konform.validation.constraints.maxLength
import io.konform.validation.constraints.minLength
import io.konform.validation.constraints.pattern
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.konform.validation

import io.konform.validation.jsonschema.minLength
import io.konform.validation.constraints.minLength
import io.kotest.assertions.konform.shouldContainExactlyErrors
import io.kotest.assertions.konform.shouldContainOnlyError
import io.kotest.matchers.shouldBe
Expand Down

0 comments on commit 59f5096

Please sign in to comment.