module Croods::Resource::JsonSchema::Definitions

Public Class Methods

attributes(resource) click to toggle source
# File lib/croods/resource/json_schema/definitions.rb, line 12
def attributes(resource)
  attributes = {}

  resource.definitions.each_value do |attribute|
    attributes[attribute.name] = Definition.schema(attribute)
  end

  attributes
end
identity(resource) click to toggle source
# File lib/croods/resource/json_schema/definitions.rb, line 22
def identity(resource)
  resource.ref(resource.identifier)
end
schema(resource) click to toggle source
# File lib/croods/resource/json_schema/definitions.rb, line 8
def schema(resource)
  attributes(resource).merge(identity: identity(resource))
end