class Schai::JsArray

Attributes

description[RW]
example[RW]
items[RW]
optional[RW]

Public Class Methods

new(params) click to toggle source
# File lib/schai/json_schema/js_array.rb, line 9
def initialize params
  @items = JsProperty.parse params['items']
  @description = params["description"]
  @example = params["example"]
  @optional = params["optional"]
end
parse(params) click to toggle source
# File lib/schai/json_schema/js_array.rb, line 5
def self.parse params
  self.new params
end

Public Instance Methods

to_schema() click to toggle source
# File lib/schai/json_schema/js_array.rb, line 16
def to_schema
  schema = {
    type: :array,
  }
  schema[:description] = @description if @description
  schema[:items] = @items.to_schema
  schema[:example] = @example if @example
  schema
end