Module: JSI::Schema::Application::InplaceApplication

Included in:
Draft04, Draft06, Draft07
Defined in:
lib/jsi/schema/application/inplace_application.rb

Defined Under Namespace

Modules: Dependencies, Draft04, Draft06, Draft07, IfThenElse, Ref, SomeOf

Instance Method Summary collapse

Instance Method Details

#each_inplace_applicator_schema(instance, visited_refs: []) {|JSI::Schema| ... } ⇒ nil, Enumerator

yields each inplace applicator schema which applies to the given instance.

Parameters:

  • visited_refs (Enumerable<JSI::Schema::Ref>) (defaults to: [])
  • instance (Object)

    the instance to check any applicators against

Yields:

Returns:

  • (nil, Enumerator)

    an Enumerator if invoked without a block; otherwise nil



31
32
33
34
35
36
37
38
39
# File 'lib/jsi/schema/application/inplace_application.rb', line 31

def each_inplace_applicator_schema(instance, visited_refs: [], &block)
  return to_enum(__method__, instance, visited_refs: visited_refs) unless block

  catch(:jsi_application_done) do
    internal_inplace_applicate_keywords(instance, visited_refs, &block)
  end

  nil
end

#inplace_applicator_schemas(instance) ⇒ JSI::SchemaSet

a set of inplace applicator schemas of this schema (from $ref, allOf, etc.) which apply to the given instance.

the returned set will contain this schema itself, unless this schema contains a $ref keyword.

Parameters:

  • instance (Object)

    the instance to check any applicators against

Returns:



21
22
23
# File 'lib/jsi/schema/application/inplace_application.rb', line 21

def inplace_applicator_schemas(instance)
  SchemaSet.new(each_inplace_applicator_schema(instance))
end