Class: Explicit::Type::Agreement

Inherits:
Explicit::Type show all
Defined in:
lib/explicit/type/agreement.rb

Constant Summary collapse

VALUES =
[true, "true", "on", "1", 1].freeze
OK =
[:ok, true].freeze

Instance Attribute Summary

Attributes inherited from Explicit::Type

#auth_type, #default, #description, #nilable, #param_location

Instance Method Summary collapse

Methods inherited from Explicit::Type

#auth_basic?, #auth_bearer?, build, #error_i18n, #mcp_schema, #merge_base_json_schema, #param_location_body?, #param_location_path?, #param_location_query?, #required?, #swagger_i18n, #swagger_schema

Instance Method Details

#json_schema(flavour) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/explicit/type/agreement.rb', line 29

def json_schema(flavour)
  {
    type: "boolean",
    description_topics: [
      swagger_i18n("agreement")
    ]
  }
end

#validate(value) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/explicit/type/agreement.rb', line 7

def validate(value)
  if VALUES.include?(value)
    OK
  else
    error_i18n("agreement")
  end
end