class Dry::Doc::Schema

Constants

T

Attributes

klass[R]

Public Class Methods

new(klass) click to toggle source
# File lib/dry/doc/schema.rb, line 136
def initialize klass
  @klass, @properties = klass, {}
end

Public Instance Methods

as_json() click to toggle source
# File lib/dry/doc/schema.rb, line 146
def as_json
  { 
    type: :object,
    properties: @properties.transform_values(&:as_json)
  }
end
register(name, type, description: @properties[name] = Field.new \ type: type, description: description) click to toggle source
# File lib/dry/doc/schema.rb, line 140
def register name, type, description:
  @properties[name] = Field.new \
    type:        type,
    description: description
end