Class: Committee::SchemaValidator::HyperSchema::ResponseGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/committee/schema_validator/hyper_schema/response_generator.rb

Instance Method Summary collapse

Instance Method Details

#call(link) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/committee/schema_validator/hyper_schema/response_generator.rb', line 7

def call(link)
  schema = target_schema(link)
  data = generate_properties(link, schema)

  # List is a special case; wrap data in an array.
  #
  # This is poor form that's here so as not to introduce breaking behavior.
  # The "instances" value of "rel" is a Heroku-ism and was originally
  # introduced before we understood how to use "targetSchema". It's not
  # meaningful with the context of the hyper-schema specification and
  # should be eventually be removed.
  if legacy_hyper_schema_rel?(link)
    data = [data]
  end

  [data, schema]
end