- Removed references from original WIP project referrng to
dto_type
-
Tuple
type addedEmailTemplate = Scheming.object do attribute :id, Integer attribute :data, Tuple(String, Array(String)) end Scheming::Schema.json(EmailTemplate) # => { type: 'object', additionalProperties: false, required: %w[id data], properties: { id: { type: 'integer' }, data: { type: 'array', prefixItems: [ { type: 'string' }, { type: 'array', items: { type: 'string' } } ] } } }
-
Added
solorgraph
to the development process and added it's typecheck to the defaultrake
task. -
Reduced string allocations when generating required field names for objects with the JSON schema format.
- Incorrect type syntax corrected as reported by
solargraph
.
-
Union
type addedOrder = Scheming.object do attribute :id, Union(String, Integer) end Scheming::Schema.json(Order) # => { type: 'object', additionalProperties: false, required: %w[id], properties: { id: { oneOf: [ { type: 'string' }, { type: 'integer' } ] } } }
- Incorrect YARD comment tags and syntax.
-
Switch from
json-schema
tojson_schemer
TL;DR required object properties for the JSON schema are now strings instead of symbols
After doing to research I've found that
json_schemer
is more maintained than what was currently being used. It has a smaller footprint and is much faster at validation.As a consequence the
required
properties needed to be changed from symbols to strings in the generated JSON schema.
-
Support for
generic
definitionsPoint = Scheming.generic do |(type)| Object(x: type, y: type) end Scheming::Schema.json(Point) # => { type: 'object', additionalProperties: false, required: %i[x y], properties: { x: { type: 'number' }, y: { type: 'number' } } }
-
Opting for a
tag
system to work with attributes instead of a blanket lexical scope likeoptional
to work with attributes. The long term goal is to expand out the tagging system so that it can support much more than we can anticipate today.LineItem = Scheming.object do attribute :id, Integer attribute :name, String attribute :taxable, :bool attribute :price, Float tag(:optional) attribute :desc, Nullable(String) tag(:optional) attribute :item_type, Enum('entertainment', 'staple') end
-
JSON Schema for Float was
numeric
instead ofnumber
-
JSON Schema production of
Enum
must be an array
- Ensure all types produce valid JSON Schema
-
Support for
optional
fieldsLineItem = Scheming.object do attribute :id, Integer attribute :name, String attribute :taxable, :bool attribute :price, Float optional attribute :desc, Nullable(String) attribute :item_type, Enum('entertainment', 'staple') end
- Initial release