Class: Dryer::Clients::ApiDescriptions::DescriptionSchema::ActionSchema

Inherits:
Dry::Validation::Contract
  • Object
show all
Defined in:
lib/dryer/clients/api_descriptions/description_schema.rb

Instance Method Summary collapse

Instance Method Details

#valid_contract?(value) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/dryer/clients/api_descriptions/description_schema.rb', line 50

def valid_contract?(value)
  case value
  when Class
    value <= Dry::Validation::Contract
  when String
    begin
      contract_class = Module.const_get(value)
      contract_class <= Dry::Validation::Contract
    rescue NameError => e
      false
    end
  else
      true
  end
end