Class: EasyTalk::ValidationAdapters::NoneAdapter

Inherits:
Base
  • Object
show all
Defined in:
lib/easy_talk/validation_adapters/none_adapter.rb

Overview

No-op validation adapter.

This adapter does not apply any validations. Use it when you want schema generation without any validation side effects.

Examples:

Disabling validations for a model

class ApiContract
  include EasyTalk::Model

  define_schema(validations: :none) do
    property :name, String, min_length: 5
  end
end

contract = ApiContract.new(name: 'X')
contract.valid? # => true (no validations applied)

Using globally

EasyTalk.configure do |config|
  config.validation_adapter = :none
end

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from EasyTalk::ValidationAdapters::Base

Class Method Details

.build_schema_validations(klass, schema)

This method returns an undefined value.

Build no schema-level validations (no-op).

Parameters:

  • klass (Class)

    The model class (unused)

  • schema (Hash)

    The schema hash (unused)



33
34
35
# File 'lib/easy_talk/validation_adapters/none_adapter.rb', line 33

def self.build_schema_validations(klass, schema)
  # Intentionally empty - no validations applied
end

Instance Method Details

#apply_validations

This method returns an undefined value.

Apply no validations (no-op).



40
41
42
# File 'lib/easy_talk/validation_adapters/none_adapter.rb', line 40

def apply_validations
  # Intentionally empty - no validations applied
end