module Croods::Resource::JsonSchema::Links::Create
Public Class Methods
link(resource)
click to toggle source
# File lib/croods/resource/json_schema/links/create.rb, line 9 def link(resource) { href: resource.collection_path, method: 'POST', rel: 'new', schema: schema(resource), targetSchema: target_schema(resource) } end
schema(resource)
click to toggle source
# File lib/croods/resource/json_schema/links/create.rb, line 19 def schema(resource) { additionalProperties: false, properties: Properties.schema(resource, request: true), required: Required.schema(resource, request: true), type: ['object'] } end
target_schema(resource)
click to toggle source
# File lib/croods/resource/json_schema/links/create.rb, line 28 def target_schema(resource) { anyOf: [ resource.ref, { '$ref': '#/definitions/error' } ] } end