From c05546e41ec398e011c045ede0cf8fb6790c4b80 Mon Sep 17 00:00:00 2001 From: Logan Wright Date: Tue, 2 Aug 2016 15:59:03 -0400 Subject: [PATCH] lowercase swift on code blocks --- guide/validation.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/guide/validation.md b/guide/validation.md index b266c204..e82464e5 100644 --- a/guide/validation.md +++ b/guide/validation.md @@ -12,7 +12,7 @@ Several useful convenience validators are included by default. You can use these Let's look at the most common way to validate data. -```Swift +```swift class Employee { var email: Valid var name: Valid @@ -30,7 +30,7 @@ To store something in a `Valid<>` property, you must use the `.validated()` meth `Email` is a real `validator` included with Vapor, but `Name` is not. Let's take a look at how you can create a Validator. -```Swift +```swift Valid Valid Valid> @@ -44,7 +44,7 @@ Valid> Validators, like Count or Contains can have multiple configurations. For example: -```Swift +```swift let name: Valid> = try "Vapor".validated(by: Count.max(5)) ``` @@ -56,7 +56,7 @@ Because of this, `Validators` themselves are not as type safe as some applicatio Here is how to create a custom `ValidationSuite`. -```Swift +```swift class Name: ValidationSuite { static func validate(input value: String) throws { let evaluation = OnlyAlphanumeric.self @@ -78,7 +78,7 @@ In the `Name` validator, you can see that `&&` is being used to combine validato You can also use `!` to invert the validator. -```Swift +```swift let symbols = input.validated(by: !OnlyAlphanumeric.self) ``` @@ -86,7 +86,7 @@ let symbols = input.validated(by: !OnlyAlphanumeric.self) While `validated() throw` is the most common method for validating, there are two others. -```Swift +```swift let passed = input.passes(Count.min(5)) let valid = try input.tested(Count.min(5)) ``` @@ -97,7 +97,7 @@ let valid = try input.tested(Count.min(5)) Vapor will automatically catch validation failures in the `ValidationMiddleware`. But you can catch them on your own, or customize responses for certain types of failures. -```Swift +```swift do { //validation here } catch let error as ValidationErrorProtocol {