dry-validations

 dry-validations

794f638b6f7f5132d5a13230e61c9db2?s=128

Krzysztof Wawer

September 23, 2016
Tweet

Transcript

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

  2. Our API • Roda • ROM (Ruby Object Mapper) •

    JSON API standard (http://jsonapi.org)
  3. { price: 1000 } => { price: '1000' } /\d+/

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

  5. Community • 17 contributors • very active Gitter channel https://gitter.im/dry-rb/chat

    • v0.10.1 • used in hanami-validations, reform
  6. Strange and awesome things

  7. Predicate Logic • and ( & ) • or (

    | ) Dry::Validation.Schema do required(:age) { int? & gt?(18) } end
  8. Optional Keys and Values { age: 30 } { name:

    nil, age: 30 }
  9. Nested data { name: "John", address: { street: "Main Street"

    }, emails: ["john@example.com"] }
  10. Shared schema Dry::Validation.Schema do required(:name).filled required(:address).schema(AddressSchema) end

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

  12. Thanks @wafcio about.me/kwawer