Sha256: d4c6c04db5f9f2073b263a587bbef98f881daa8dbd1f7dc2129f0cdb98c21b24

Contents?: true

Size: 667 Bytes

Versions: 2

Compression:

Stored size: 667 Bytes

Contents

require 'dry/validation'
require 'dry/validation/schema'

module Locabulary
  # Responsible for providing a defined and clear schema for each of the locabulary items.
  Schema = Dry::Validation.Schema do
    key(:predicate_name).required(format?: /\A[a-z_]+\Z/)
    key(:values).each do
      key(:term_label).required(:str?)
      optional(:description).maybe(:str?)
      optional(:grouping).maybe(:str?)
      optional(:affiliation).maybe(:str?)
      optional(:default_presentation_sequence).maybe(:int?)
      key(:activated_on).required(format?: /\A\d{4}-\d{2}-\d{2}\Z/)
      optional(:deactivated_on).maybe(format?: /\A\d{4}-\d{2}-\d{2}\Z/)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
locabulary-0.3.1 lib/locabulary/schema.rb
locabulary-0.3.0 lib/locabulary/schema.rb