Class: RubyLLM::Schema::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_llm/schema/validator.rb

Constant Summary collapse

WHITE =

Node states for DFS-based topological sort

:white
GRAY =

No mark (unvisited)

:gray
BLACK =

Temporary mark (currently being processed)

:black

Instance Method Summary collapse

Constructor Details

#initialize(schema_class) ⇒ Validator

Permanent mark (completely processed)



11
12
13
# File 'lib/ruby_llm/schema/validator.rb', line 11

def initialize(schema_class)
  @schema_class = schema_class
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


20
21
22
23
24
25
# File 'lib/ruby_llm/schema/validator.rb', line 20

def valid?
  validate!
  true
rescue ValidationError
  false
end

#validate!Object



15
16
17
18
# File 'lib/ruby_llm/schema/validator.rb', line 15

def validate!
  validate_circular_references!
  # Future validations can be added here
end