Slide 1

Slide 1 text

Krzysztof (Christopher) Wawer @wafcio about.me/kwawer

Slide 2

Slide 2 text

Our API • Roda • ROM (Ruby Object Mapper) • JSON API standard (http://jsonapi.org)

Slide 3

Slide 3 text

{ price: 1000 } => { price: '1000' } /\d+/

Slide 4

Slide 4 text

dry-validation Piotr Solnica Andy Holland http://dry-rb.org/gems/dry-validation/

Slide 5

Slide 5 text

Community • 17 contributors • very active Gitter channel https://gitter.im/dry-rb/chat • v0.10.1 • used in hanami-validations, reform

Slide 6

Slide 6 text

Strange and awesome things

Slide 7

Slide 7 text

Predicate Logic • and ( & ) • or ( | ) Dry::Validation.Schema do required(:age) { int? & gt?(18) } end

Slide 8

Slide 8 text

Optional Keys and Values { age: 30 } { name: nil, age: 30 }

Slide 9

Slide 9 text

Nested data { name: "John", address: { street: "Main Street" }, emails: ["[email protected]"] }

Slide 10

Slide 10 text

Shared schema Dry::Validation.Schema do required(:name).filled required(:address).schema(AddressSchema) end

Slide 11

Slide 11 text

dry-validation http://dry-rb.org/gems/dry-validation/

Slide 12

Slide 12 text

Thanks @wafcio about.me/kwawer