From 4986552e76c331a99770428bd2be77ad76068c08 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Sat, 9 Jan 2021 19:27:00 -0800 Subject: [PATCH] Update validation.md Add a bit of documentation on the new validation helpers. --- documentation/validation.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/documentation/validation.md b/documentation/validation.md index 5d21887e2..9595cf052 100644 --- a/documentation/validation.md +++ b/documentation/validation.md @@ -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, 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, 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(...) let passwordValid2 = Validation(...)