Skip to content

Commit

Permalink
Update validation.md
Browse files Browse the repository at this point in the history
Add a bit of documentation on the new validation helpers.
  • Loading branch information
mattpolzin authored Jan 10, 2021
1 parent 81995cf commit 4986552
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion documentation/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,9 @@ let contentMapValidator = Validation(
)
```

Lastly, OpenAPIKit offers the `all()` function that will combine any number of `Validations` in the current context (as opposed to `lift()` and `unwrap()` which take you from one context to another).
If you want to use a keypath to get from one context to another where there is potentially a JSON Reference between, it can be handy to use the `lookup()` function. The `lookup()` function takes a keypath that ends in an `Either<JSONReference<T>, T>` and lifts a validation context with a subject of `T` into any other validations you want to run. There is also an `unwrapAndLookup()` helper for keypaths that produce optional either references (`Either<JSONReference<T>, T>?`).

Lastly, OpenAPIKit offers the `all()` function that will combine any number of `Validations` in the current context (as opposed to `lift()`, `unwrap()`, and others which take you from one context to another).
```swift
let passwordValid1 = Validation<String>(...)
let passwordValid2 = Validation<String>(...)
Expand Down

0 comments on commit 4986552

Please sign in to comment.