class SchemaTest::Collection
Public Class Methods
new(name, of_name, version: nil, description: nil)
click to toggle source
Calls superclass method
# File lib/schema_test/collection.rb, line 5 def initialize(name, of_name, version: nil, description: nil) super(name, version: version, description: description) @item_type = lookup_object(of_name, version) SchemaTest::Definition.register(self) end
Public Instance Methods
as_json_schema(domain: SchemaTest.configuration.domain)
click to toggle source
# File lib/schema_test/collection.rb, line 11 def as_json_schema(domain: SchemaTest.configuration.domain) id_part = version ? "v#{version}/#{name}" : name { '$schema' => SchemaTest::SCHEMA_VERSION, '$id' => "http://#{domain}/#{id_part}.json", 'title' => name.to_s, 'type' => 'array', 'items' => @item_type.as_json_schema(false), 'minItems' => 1 } end