jsi-dev 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -4
  3. data/CHANGELOG.md +19 -0
  4. data/LICENSE.md +2 -3
  5. data/README.md +87 -43
  6. data/docs/Glossary.md +313 -0
  7. data/jsi.gemspec +1 -1
  8. data/lib/jsi/base/mutability.rb +48 -0
  9. data/lib/jsi/base/node.rb +66 -52
  10. data/lib/jsi/base.rb +593 -176
  11. data/lib/jsi/jsi_coder.rb +4 -2
  12. data/lib/jsi/metaschema_node/bootstrap_schema.rb +118 -59
  13. data/lib/jsi/metaschema_node.rb +245 -154
  14. data/lib/jsi/ptr.rb +45 -17
  15. data/lib/jsi/ref.rb +197 -0
  16. data/lib/jsi/registry.rb +311 -0
  17. data/lib/jsi/schema/cxt/child_application.rb +35 -0
  18. data/lib/jsi/schema/cxt/inplace_application.rb +37 -0
  19. data/lib/jsi/schema/cxt.rb +80 -0
  20. data/lib/jsi/schema/dialect.rb +137 -0
  21. data/lib/jsi/schema/draft04.rb +113 -5
  22. data/lib/jsi/schema/draft06.rb +123 -5
  23. data/lib/jsi/schema/draft07.rb +157 -5
  24. data/lib/jsi/schema/draft202012.rb +303 -0
  25. data/lib/jsi/schema/dynamic_anchor_map.rb +63 -0
  26. data/lib/jsi/schema/element.rb +69 -0
  27. data/lib/jsi/schema/elements/anchor.rb +13 -0
  28. data/lib/jsi/schema/elements/array_validation.rb +82 -0
  29. data/lib/jsi/schema/elements/comment.rb +10 -0
  30. data/lib/jsi/schema/{validation → elements}/const.rb +11 -7
  31. data/lib/jsi/schema/elements/contains.rb +59 -0
  32. data/lib/jsi/schema/elements/contains_minmax.rb +91 -0
  33. data/lib/jsi/schema/elements/content_encoding.rb +10 -0
  34. data/lib/jsi/schema/elements/content_media_type.rb +10 -0
  35. data/lib/jsi/schema/elements/content_schema.rb +16 -0
  36. data/lib/jsi/schema/elements/default.rb +11 -0
  37. data/lib/jsi/schema/elements/definitions.rb +19 -0
  38. data/lib/jsi/schema/elements/dependencies.rb +99 -0
  39. data/lib/jsi/schema/elements/dependent_required.rb +49 -0
  40. data/lib/jsi/schema/elements/dependent_schemas.rb +69 -0
  41. data/lib/jsi/schema/elements/dynamic_ref.rb +69 -0
  42. data/lib/jsi/schema/elements/enum.rb +26 -0
  43. data/lib/jsi/schema/elements/examples.rb +10 -0
  44. data/lib/jsi/schema/elements/format.rb +10 -0
  45. data/lib/jsi/schema/elements/id.rb +30 -0
  46. data/lib/jsi/schema/elements/if_then_else.rb +82 -0
  47. data/lib/jsi/schema/elements/info_bool.rb +10 -0
  48. data/lib/jsi/schema/elements/info_string.rb +10 -0
  49. data/lib/jsi/schema/elements/items.rb +93 -0
  50. data/lib/jsi/schema/elements/items_prefixed.rb +96 -0
  51. data/lib/jsi/schema/elements/not.rb +31 -0
  52. data/lib/jsi/schema/elements/numeric.rb +137 -0
  53. data/lib/jsi/schema/elements/numeric_draft04.rb +77 -0
  54. data/lib/jsi/schema/elements/object_validation.rb +55 -0
  55. data/lib/jsi/schema/elements/pattern.rb +35 -0
  56. data/lib/jsi/schema/elements/properties.rb +145 -0
  57. data/lib/jsi/schema/elements/property_names.rb +48 -0
  58. data/lib/jsi/schema/elements/ref.rb +62 -0
  59. data/lib/jsi/schema/elements/required.rb +34 -0
  60. data/lib/jsi/schema/elements/self.rb +24 -0
  61. data/lib/jsi/schema/elements/some_of.rb +180 -0
  62. data/lib/jsi/schema/elements/string_validation.rb +57 -0
  63. data/lib/jsi/schema/elements/type.rb +43 -0
  64. data/lib/jsi/schema/elements/unevaluated_items.rb +54 -0
  65. data/lib/jsi/schema/elements/unevaluated_properties.rb +54 -0
  66. data/lib/jsi/schema/elements/xschema.rb +10 -0
  67. data/lib/jsi/schema/elements/xvocabulary.rb +10 -0
  68. data/lib/jsi/schema/elements.rb +101 -0
  69. data/lib/jsi/schema/issue.rb +3 -4
  70. data/lib/jsi/schema/schema_ancestor_node.rb +105 -52
  71. data/lib/jsi/schema/vocabulary.rb +36 -0
  72. data/lib/jsi/schema.rb +598 -383
  73. data/lib/jsi/schema_classes.rb +195 -141
  74. data/lib/jsi/schema_set.rb +85 -128
  75. data/lib/jsi/set.rb +23 -0
  76. data/lib/jsi/simple_wrap.rb +14 -17
  77. data/lib/jsi/struct.rb +57 -0
  78. data/lib/jsi/uri.rb +40 -0
  79. data/lib/jsi/util/private/memo_map.rb +9 -13
  80. data/lib/jsi/util/private.rb +59 -31
  81. data/lib/jsi/util/typelike.rb +19 -60
  82. data/lib/jsi/util.rb +53 -34
  83. data/lib/jsi/validation/error.rb +45 -2
  84. data/lib/jsi/validation/result.rb +121 -90
  85. data/lib/jsi/validation.rb +1 -6
  86. data/lib/jsi/version.rb +1 -1
  87. data/lib/jsi.rb +170 -36
  88. data/lib/schemas/json-schema.org/draft/2020-12/schema.rb +62 -0
  89. data/lib/schemas/json-schema.org/draft-04/schema.rb +60 -109
  90. data/lib/schemas/json-schema.org/draft-06/schema.rb +53 -108
  91. data/lib/schemas/json-schema.org/draft-07/schema.rb +63 -127
  92. data/readme.rb +4 -4
  93. data/{resources}/schemas/2020-12_strict.json +19 -0
  94. data/{resources}/schemas/json-schema.org/draft/2020-12/meta/applicator.json +48 -0
  95. data/{resources}/schemas/json-schema.org/draft/2020-12/meta/content.json +17 -0
  96. data/{resources}/schemas/json-schema.org/draft/2020-12/meta/core.json +51 -0
  97. data/{resources}/schemas/json-schema.org/draft/2020-12/meta/format-annotation.json +14 -0
  98. data/{resources}/schemas/json-schema.org/draft/2020-12/meta/format-assertion.json +14 -0
  99. data/{resources}/schemas/json-schema.org/draft/2020-12/meta/meta-data.json +37 -0
  100. data/{resources}/schemas/json-schema.org/draft/2020-12/meta/unevaluated.json +15 -0
  101. data/{resources}/schemas/json-schema.org/draft/2020-12/meta/validation.json +98 -0
  102. data/{resources}/schemas/json-schema.org/draft/2020-12/schema.json +58 -0
  103. metadata +73 -52
  104. data/docs/glossary.md +0 -281
  105. data/lib/jsi/metaschema.rb +0 -6
  106. data/lib/jsi/schema/application/child_application/contains.rb +0 -25
  107. data/lib/jsi/schema/application/child_application/draft04.rb +0 -21
  108. data/lib/jsi/schema/application/child_application/draft06.rb +0 -28
  109. data/lib/jsi/schema/application/child_application/draft07.rb +0 -28
  110. data/lib/jsi/schema/application/child_application/items.rb +0 -18
  111. data/lib/jsi/schema/application/child_application/properties.rb +0 -25
  112. data/lib/jsi/schema/application/child_application.rb +0 -13
  113. data/lib/jsi/schema/application/draft04.rb +0 -8
  114. data/lib/jsi/schema/application/draft06.rb +0 -8
  115. data/lib/jsi/schema/application/draft07.rb +0 -8
  116. data/lib/jsi/schema/application/inplace_application/dependencies.rb +0 -28
  117. data/lib/jsi/schema/application/inplace_application/draft04.rb +0 -25
  118. data/lib/jsi/schema/application/inplace_application/draft06.rb +0 -26
  119. data/lib/jsi/schema/application/inplace_application/draft07.rb +0 -32
  120. data/lib/jsi/schema/application/inplace_application/ifthenelse.rb +0 -20
  121. data/lib/jsi/schema/application/inplace_application/ref.rb +0 -18
  122. data/lib/jsi/schema/application/inplace_application/someof.rb +0 -44
  123. data/lib/jsi/schema/application/inplace_application.rb +0 -14
  124. data/lib/jsi/schema/application.rb +0 -12
  125. data/lib/jsi/schema/ref.rb +0 -183
  126. data/lib/jsi/schema/validation/array.rb +0 -69
  127. data/lib/jsi/schema/validation/contains.rb +0 -25
  128. data/lib/jsi/schema/validation/dependencies.rb +0 -49
  129. data/lib/jsi/schema/validation/draft04/minmax.rb +0 -91
  130. data/lib/jsi/schema/validation/draft04.rb +0 -110
  131. data/lib/jsi/schema/validation/draft06.rb +0 -120
  132. data/lib/jsi/schema/validation/draft07.rb +0 -157
  133. data/lib/jsi/schema/validation/enum.rb +0 -25
  134. data/lib/jsi/schema/validation/ifthenelse.rb +0 -46
  135. data/lib/jsi/schema/validation/items.rb +0 -54
  136. data/lib/jsi/schema/validation/not.rb +0 -20
  137. data/lib/jsi/schema/validation/numeric.rb +0 -121
  138. data/lib/jsi/schema/validation/object.rb +0 -45
  139. data/lib/jsi/schema/validation/pattern.rb +0 -34
  140. data/lib/jsi/schema/validation/properties.rb +0 -101
  141. data/lib/jsi/schema/validation/property_names.rb +0 -32
  142. data/lib/jsi/schema/validation/ref.rb +0 -40
  143. data/lib/jsi/schema/validation/required.rb +0 -27
  144. data/lib/jsi/schema/validation/someof.rb +0 -90
  145. data/lib/jsi/schema/validation/string.rb +0 -47
  146. data/lib/jsi/schema/validation/type.rb +0 -49
  147. data/lib/jsi/schema/validation.rb +0 -49
  148. data/lib/jsi/schema_registry.rb +0 -190
  149. data/lib/jsi/util/private/attr_struct.rb +0 -130
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d7ad6ce212930473a08a37e5da2684166c65e7655dd8f401583dc83b2095a50
4
- data.tar.gz: 0c8364cb1a94ace31cecbe2c0f7018ec5c3c4d5f0677f80fbc96de92830536c5
3
+ metadata.gz: 6d6f0d6e7ed165077aefd9716cbdf9dbc1e6fa9c62eaa809a9ce796d15ec367b
4
+ data.tar.gz: f463c64945fc7f666b39320717642188d7375650bb0ad681d0e6f6cadabc279a
5
5
  SHA512:
6
- metadata.gz: efed82db1002e5d0afc6b097271f492075813e944984bed20d02c1822c4df9d71bc1c1d29ed80c230ca5bdf9342158612a1b97e4f65c556b9fa5e2056144f7d9
7
- data.tar.gz: fc347ee67d8662c10a88197b21b1a2ace3d9ccc27f9b9c211fce1cc5e686d4a6894d349cd727119e41a79a896ba210913e0e42c73743fa140e8398237f63640e
6
+ metadata.gz: 335a86b944ca363b7f1da2d91df7f84a3ad31029bfbb70be082ac4c7865bdbab72c4cf283fd00da7bb09778d438793665b47b85bb9fb4c07a43ff719213503a6
7
+ data.tar.gz: 4c1c492253e10b2513a10781ea2617863d50591dcc4effa037d21bf15110c5167b533b24ecc3754c5a000c1a0ad46f56cf48dcdcf04f25dee143af36b57cc77c
data/.yardopts CHANGED
@@ -1,8 +1,7 @@
1
1
  --main README.md
2
2
  --markup=markdown
3
- --markup-provider=maruku
3
+ --markup-provider=redcarpet
4
4
  --no-private
5
5
  --hide-void-return
6
- -
7
- docs/**/*.md
8
- {lib}/**/*.rb
6
+ --files docs/**/*.md
7
+ lib/**/*.rb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ # v0.8.1
2
+
3
+ - JSIs are immutable by default
4
+
5
+ # v0.8.0
6
+
7
+ - Immutable JSIs with new_jsi param `mutable`
8
+ - JSIs are still mutable by default, but in the next release they will default to immutable
9
+ - Base#jsi_indicated_schemas
10
+ - Base::StringNode
11
+ - rename metaschema modules /JSONSchemaOrgDraft0X/JSONSchemaDraft0X/
12
+ - terminology: /Metaschema/Meta-Schema/ and /metaschema/meta-schema/ (where hyphen is allowed)
13
+ - Base::HashNode#jsi_each_propertyName
14
+ - new_schema and/or new_jsi params register, schema_registry, stringify_symbol_keys, to_immutable
15
+ - new_schema block param will module_exec on schema module
16
+ - Base#[] param use_default default false, overridable
17
+ - SchemaModule::Connects, SchemaModule::Connection
18
+ - rm Schema#jsi_schema_instance_modules
19
+
1
20
  # v0.7.0
2
21
 
3
22
  - JSI::Base instances include Array/Hash-like modules on subclasses rather than extending each instance; are only Enumerable when appropriate instead of always
data/LICENSE.md CHANGED
@@ -1,8 +1,7 @@
1
- Copright © [Ethan](https://github.com/notEthan/) <ethan.jsi@unth.net>
1
+ JSI Copyright © [Ethan](https://github.com/notEthan/) <ethan.jsi@unth.net>, licensed under the terms of the [GNU Affero General Public License version 3](https://www.gnu.org/licenses/agpl-3.0.html).
2
2
 
3
- [<img align="right" src="https://github.com/notEthan/jsi/raw/master/resources/icons/AGPL-3.0.png">](https://www.gnu.org/licenses/agpl-3.0.html)
3
+ [<img align="right" src="https://www.gnu.org/graphics/agplv3-155x51.png">](https://www.gnu.org/licenses/agpl-3.0.html)
4
4
 
5
- JSI is licensed under the terms of the [GNU Affero General Public License version 3](https://www.gnu.org/licenses/agpl-3.0.html).
6
5
 
7
6
  GNU Affero General Public License
8
7
  =================================
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # JSI: JSON Schema Instantiation
2
2
 
3
- ![Test CI Status](https://github.com/notEthan/jsi/actions/workflows/test.yml/badge.svg?branch=stable)
3
+ ![Test CI Status](https://github.com/notEthan/jsi/actions/workflows/test.yml/badge.svg?branch=main)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/notEthan/jsi/badge.svg)](https://coveralls.io/github/notEthan/jsi)
5
5
 
6
6
  JSI offers an Object-Oriented representation for JSON data using JSON Schemas. Given your JSON Schemas, JSI constructs Ruby modules and classes which are used to instantiate your JSON data. These modules let you use JSON with all the niceties of OOP such as property accessors and application-defined instance methods.
7
7
 
8
8
  To learn more about JSON Schema see <https://json-schema.org/>.
9
9
 
10
- JSI marries object-oriented programming with JSON Schemas by associating a module with each schema, and extending every instance described by a schema with that module. When an application adds methods to a schema module, those methods can be used on its instances.
10
+ JSI marries object-oriented programming with JSON Schemas by associating a module with each schema, and constructing every instance described by a schema to be an instance of that module. When an application adds methods to a schema module, those methods can be used on the schema's instances.
11
11
 
12
12
  A JSI instance aims to offer a fairly unobtrusive wrapper around its JSON data, which is usually a Hash (JSON Object) or Array described by one or more JSON Schemas. JSI instances have accessors for property names described by schemas, schema validation, and other nice things. Mostly though, you use a JSI as you would use its underlying data, calling the same methods (e.g. `#[]`, `#map`, `#repeated_permutation`) and passing it to anything that duck-types expecting `#to_ary` or `#to_hash`.
13
13
 
@@ -15,7 +15,9 @@ Note: The canonical location of this README is on [RubyDoc](http://rubydoc.info/
15
15
 
16
16
  ## Example
17
17
 
18
- Words are boring, let's code. Here's a schema in yaml:
18
+ Words are boring, let's code. You can follow along from the code blocks - install the gem (`gem install jsi`), load an irb (`irb -r jsi`), and copy/paste/hack.
19
+
20
+ Here's a schema in yaml:
19
21
 
20
22
  ```yaml
21
23
  $schema: "http://json-schema.org/draft-07/schema"
@@ -36,7 +38,8 @@ properties:
36
38
  We pass that to {JSI.new_schema} which will instantiate a JSI Schema which represents it:
37
39
 
38
40
  ```ruby
39
- # this would usually load YAML or JSON; the schema object is inlined for copypastability.
41
+ # this would usually load YAML or JSON; the schema content
42
+ # is inlined here for copypastability.
40
43
  contact_schema = JSI.new_schema({"$schema" => "http://json-schema.org/draft-07/schema", "description" => "A Contact", "type" => "object", "properties" => {"name" => {"type" => "string"}, "phone" => {"type" => "array", "items" => {"type" => "object", "properties" => {"location" => {"type" => "string"}, "number" => {"type" => "string"}}}}}})
41
44
  ```
42
45
 
@@ -61,8 +64,13 @@ nickname: big b
61
64
  So, if we construct an instance like:
62
65
 
63
66
  ```ruby
64
- # this would usually load YAML or JSON; the schema instance is inlined for copypastability.
65
- bill = Contact.new_jsi({"name" => "bill", "phone" => [{"location" => "home", "number" => "555"}], "nickname" => "big b"})
67
+ bill = Contact.new_jsi(
68
+ # this would usually load JSON or YAML; the instance content
69
+ # is inlined for copypastability.
70
+ {"name" => "bill", "phone" => [{"location" => "home", "number" => "555"}], "nickname" => "big b"},
71
+ # note: bill is mutable to demonstrate setters below; the default is immutable.
72
+ mutable: true
73
+ )
66
74
  # => #{<JSI (Contact)>
67
75
  # "name" => "bill",
68
76
  # "phone" => #[<JSI (Contact.properties["phone"])>
@@ -91,7 +99,7 @@ bill.phone.map(&:location)
91
99
  # => ["home"]
92
100
  ```
93
101
 
94
- We also get validations, as you'd expect given that's largely what json-schema exists to do:
102
+ We also get validations, as you'd expect given that's largely what JSON Schema exists to do:
95
103
 
96
104
  ```ruby
97
105
  bill.jsi_valid?
@@ -109,17 +117,28 @@ bad = Contact.new_jsi({'phone' => [{'number' => [5, 5, 5]}]})
109
117
  # }
110
118
  # ]
111
119
  # }
112
- bad.phone.jsi_validate
113
- # => #<JSI::Validation::FullResult
114
- # @validation_errors=
115
- # #<Set: {#<JSI::Validation::Error
116
- # message: "instance type does not match `type` value",
117
- # keyword: "type",
118
- # schema: #{<JSI (JSI::JSONSchemaDraft07) Schema> "type" => "string"},
119
- # instance_ptr: JSI::Ptr["phone", 0, "number"],
120
- # instance_document: {"phone"=>[{"number"=>[5, 5, 5]}]}
121
- # >,
122
- # ...
120
+ bad.phone[0].jsi_validate
121
+ # =>
122
+ # #<JSI::Validation::Result::Full (INVALID)
123
+ # validation errors: JSI::Set[
124
+ # #<JSI::Validation::Error
125
+ # message: "instance object properties are not all valid against corresponding `properties` schemas",
126
+ # instance: {"number" => [5, 5, 5]},
127
+ # instance_ptr: JSI::Ptr["phone", 0],
128
+ # keyword: "properties",
129
+ # schema uri: JSI::URI["#/properties/phone/items"],
130
+ # nested_errors: JSI::Set[
131
+ # #<JSI::Validation::Error
132
+ # message: "instance type does not match `type` value",
133
+ # instance: [5, 5, 5],
134
+ # instance_ptr: JSI::Ptr["phone", 0, "number"],
135
+ # keyword: "type",
136
+ # schema uri: JSI::URI["#/properties/phone/items/properties/number"],
137
+ # nested_errors: JSI::Set[]
138
+ # >
139
+ # ]
140
+ # >
141
+ # ]
123
142
  # >
124
143
  ```
125
144
 
@@ -140,9 +159,9 @@ There's plenty more JSI has to offer, but this should give you a pretty good ide
140
159
  ## Terminology and Concepts
141
160
 
142
161
  - `JSI::Base` is the base class for each JSI schema class representing instances of JSON Schemas.
143
- - a "JSI Schema" is a JSON Schema, instantiated as (usually) a JSI::Base described by a metaschema (see the sections on Metaschemas below). a JSI Schema is an instance of the module `JSI::Schema`.
144
- - a "JSI Schema Module" is a module which represents one schema, dynamically created by that Schema. Instances of that schema are extended with its JSI schema module. applications may reopen these modules to add functionality to JSI instances described by a given schema.
145
- - a "JSI schema class" is a subclass of `JSI::Base` representing one or more JSON schemas. Instances of such a class are described by all of the represented schemas. A JSI schema class includes the JSI schema module of each represented schema.
162
+ - a "JSI Schema" is a JSON Schema, instantiated as (usually) a JSI::Base described by a meta-schema (see the section on meta-schemas below). A JSI Schema is an instance of the module `JSI::Schema`.
163
+ - a "JSI Schema Module" is a module associated with one schema, dynamically created by that schema. Instances of that schema are ruby instances of its JSI schema module. Applications may reopen these modules to add functionality to JSI instances described by the schema.
164
+ - a "JSI schema class" is a subclass of `JSI::Base` representing any number of JSON schemas. Instances of such a class are described by all of the represented schemas. A JSI schema class includes the JSI schema module of each represented schema.
146
165
  - "instance" is a term that is significantly overloaded in this space, so documentation will attempt to be clear what kind of instance is meant:
147
166
  - a schema instance refers broadly to a data structure that is described by a JSON schema.
148
167
  - a JSI instance (or just "a JSI") is a ruby object instantiating a JSI schema class (subclass of `JSI::Base`). This wraps the content of the schema instance (see `JSI::Base#jsi_instance`), and ties it to the schemas which describe the instance (`JSI::Base#jsi_schemas`).
@@ -157,6 +176,15 @@ JSI supports these JSON Schema specification versions:
157
176
  | Draft 4 | `http://json-schema.org/draft-04/schema#` | {JSI::JSONSchemaDraft04} |
158
177
  | Draft 6 | `http://json-schema.org/draft-06/schema#` | {JSI::JSONSchemaDraft06} |
159
178
  | Draft 7 | `http://json-schema.org/draft-07/schema#` | {JSI::JSONSchemaDraft07} |
179
+ | Draft 2020-12 | `https://json-schema.org/draft/2020-12/schema` | {JSI::JSONSchemaDraft202012} |
180
+
181
+ Caveats:
182
+
183
+ - Regular expressions are interpreted by Ruby's Regexp class, whereas JSON Schema recommends interpreting these as ECMA 262 regular expressions. Certain expressions behave differently, particularly `^` and `$`.
184
+ - The `format` keyword does not perform validation. This may be implemented in the future.
185
+ - Draft 2020-12: `$schema` has no effect except at the document root ([#341](https://github.com/notEthan/jsi/issues/341))
186
+ - Draft 7: Keywords `contentMediaType` and `contentEncoding` do not perform validation.
187
+ - Draft 4: `$ref` is only used as a reference from schemas - it will not be followed when used on objects that are not schemas. This is consistent with specifications since Draft 4, but in Draft 4 the [JSON Reference](https://datatracker.ietf.org/doc/html/draft-pbryan-zyp-json-ref-03) specification would allow `$ref` to be used anywhere. JSI does not do this.
160
188
 
161
189
  ## JSI and Object Oriented Programming
162
190
 
@@ -190,9 +218,9 @@ bill['name']
190
218
 
191
219
  For `#name` and `#name=`, we're overriding existing accessor methods. note the use of `super` - this invokes the accessor methods defined by JSI which these override. You could alternatively use `self['name']` and `self['name']=` in these methods, with the same effect as `super`.
192
220
 
193
- Working with subschemas is just about as easy as with root schemas.
221
+ Working with subschemas to add methods is just about as easy as with root schemas.
194
222
 
195
- You can subscript or use property accessors on a JSI schema module to refer to the schema modules of its subschemas, e.g.:
223
+ You can use `#[]` or property accessors on a JSI schema module to refer to the schema modules of its subschemas, e.g.:
196
224
 
197
225
  ```ruby
198
226
  Contact.properties['phone'].items
@@ -211,8 +239,7 @@ bill.phone.first.number_with_dashes
211
239
  # => "5-5-5"
212
240
  ```
213
241
 
214
- A recommended convention for naming subschemas is to define them in the namespace of the module of their
215
- parent schema. The module can then be opened to add methods to the subschema's module.
242
+ A recommended convention for naming subschemas is to define them in the namespace of the module of their parent schema. The module can then be opened to add methods to the subschema's module.
216
243
 
217
244
  ```ruby
218
245
  module Contact
@@ -240,31 +267,31 @@ end
240
267
 
241
268
  The classes used to instantiate JSIs are dynamically generated subclasses of JSI::Base which include the JSI Schema Module of each schema describing the given instance. These are mostly intended to be ignored: applications aren't expected to instantiate these directly (rather, `#new_jsi` on a Schema or Schema Module is intended), and they are not intended for subclassing or method definition (applications should instead define methods on a schema's {JSI::Schema#jsi_schema_module}).
242
269
 
270
+ ## Mutability
271
+
272
+ JSI instances are immutable by default. Mutable JSIs may be instantiated using the `mutable` param of `new_jsi`. Immutable JSIs are much more performant, because mutation may change what schemas apply to nodes in a document, and checking for that is costly. It is not recommended to instantiate large documents as mutable; their JSI instances become unusably slow.
273
+
274
+ If you are parsing with JSON.parse or YAML.load, it is recommended to pass the `freeze: true` option to these, which lets JSI skip making a frozen copy.
275
+
243
276
  ## Registration
244
277
 
245
- In order for references across documents (generally from a `$ref` schema keyword) to resolve, JSI provides a registry (a {JSI::SchemaRegistry}) which associates URIs with schemas (or resources containing schemas). The default registry is accessible on {JSI.schema_registry}.
278
+ In order for references across documents (generally from a `$ref` schema keyword) to resolve, JSI provides a registry (a {JSI::Registry}) which associates URIs with schemas (or resources containing schemas). The default registry is accessible on {JSI.registry}.
246
279
 
247
- Schemas instantiated with `.new_schema`, and their subschemas, are by default registered with `JSI.schema_registry` if they are identified by an absolute URI. This can be controlled by params `register` and `schema_registry`.
280
+ Schemas instantiated with `.new_schema`, and their subschemas, are by default registered with `JSI.registry` if they are identified by an absolute URI. This can be controlled by the `register` param and `registry` configuration.
248
281
 
249
- Schemas can automatically be lazily loaded by registering a block which instantiates them with {JSI::SchemaRegistry#autoload_uri} (see its documentation).
282
+ Schemas can automatically be lazily loaded by registering a block which instantiates them with {JSI::Registry#autoload_uri} (see its documentation).
250
283
 
251
284
  ## Validation
252
285
 
253
286
  JSI implements all required features, and many optional features, for validation according to supported JSON Schema specifications. To validate instances, see methods {JSI::Base#jsi_validate}, {JSI::Base#jsi_valid?}, {JSI::Schema#instance_validate}, {JSI::Schema#instance_valid?}.
254
287
 
255
- The following optional features are not completely supported:
288
+ ## Meta-Schemas
256
289
 
257
- - The `format` keyword does not perform any validation.
258
- - Regular expressions are interpreted by Ruby's Regexp class, whereas JSON Schema recommends interpreting these as ECMA 262 regular expressions. Certain expressions behave differently, particularly `^` and `$`.
259
- - Keywords `contentMediaType` and `contentEncoding` do not perform validation.
260
-
261
- ## Metaschemas
290
+ A meta-schema is a schema that describes schemas. Likewise, a schema is an instance of a meta-schema.
262
291
 
263
- A metaschema is a schema which describes schemas. Likewise, a schema is an instance of a metaschema.
292
+ In JSI, a schema is generally a JSI::Base instance whose schemas include a meta-schema.
264
293
 
265
- In JSI, a schema is generally a JSI::Base instance whose schemas include a metaschema.
266
-
267
- A self-descriptive metaschema - most commonly one of the JSON schema draft metaschemas - is an object whose schemas include itself. This is instantiated in JSI as a JSI::MetaschemaNode, a special subclass of JSI::Base.
294
+ A self-descriptive meta-schema - most commonly one of the JSON schema draft meta-schemas - is an object whose schemas include itself. This is instantiated in JSI as a JSI::MetaSchemaNode, a special subclass of JSI::Base.
268
295
 
269
296
  ## ActiveRecord serialization
270
297
 
@@ -272,7 +299,7 @@ A really excellent place to use JSI is when dealing with serialized columns in A
272
299
 
273
300
  Let's say you're sticking to JSON types in the database - you have to do so if you're using JSON columns, or JSON serialization, and if you have dealt with arbitrary yaml- or marshal-serialized objects in ruby, you have probably found that approach has its shortcomings when the implementation of your classes changes.
274
301
 
275
- But if your database contains JSON, then your deserialized objects in ruby are likewise Hash / Array / basic types. You have to use subscripts instead of accessors, and you don't have any way to add methods to your data types.
302
+ But if your database contains JSON, then your deserialized objects in ruby are likewise Hash / Array / simple types. You have to use `#[]` instead of accessors, and you don't have any way to add methods to your data types.
276
303
 
277
304
  JSI gives you the best of both with {JSI::JSICoder}. This coder dumps objects which are simple JSON types, and loads instances of a specified JSON Schema. Here's an example, supposing a `users` table with a JSON column `contact_info` to be instantiated using the `Contact` schema module defined in the Example section above:
278
305
 
@@ -282,13 +309,30 @@ class User < ActiveRecord::Base
282
309
  end
283
310
  ```
284
311
 
285
- Now `user.contact_info` will be instantiated as a `Contact` JSI instance, from the JSON type in the database, with Contact's accessors, validations, and user-defined instance methods.
312
+ Now `user.contact_info` will be instantiated as a `Contact` JSI instance, from the JSON type in the database, with Contact's accessors, validations, and application-defined instance methods.
286
313
 
287
314
  See the gem [`arms`](https://github.com/notEthan/arms) if you wish to serialize the dumped JSON-compatible objects further as text.
288
315
 
289
- ## Keying Hashes (JSON Objects)
316
+ ## Hash keys (JSON Object property names)
317
+
318
+ For JSI instances containing Hashes, their keys should be strings. Hashes keyed with symbols are popular in Ruby, but this is not compatible with JSON.
319
+
320
+ JSI generally does not accommodate symbol keys. However, the syntax for Hash literals with symbol keys (`key: "value"` or `"key": "value"` rather than `"key" => "value"`) conveniently resembles JSON such that you can often paste JSON right into your Ruby (apart from Ruby's `nil` vs JSON's `null`). To enable this, JSI offers key conversion on instantiation: methods `new_jsi` and `new_schema` take a boolean param `stringify_symbol_keys` to recursively convert. This _only_ affects instantiation - no key conversion is done once the JSI has been initialized, e.g. by {JSI::Base#[]} or any methods of {JSI::Base::HashNode}.
321
+
322
+ ```ruby
323
+ # instantiate schema s and instance j, converting keys
324
+ s = JSI.new_schema(
325
+ # valid JSON
326
+ {
327
+ "$schema": "http://json-schema.org/draft-07/schema#",
328
+ "type": "array"
329
+ },
330
+ stringify_symbol_keys: true,
331
+ )
332
+ j = s.new_jsi([{"foo": "bar"}, {"foo": "baz"}], stringify_symbol_keys: true)
333
+ ```
290
334
 
291
- Unlike Ruby, JSON only supports string keys. It is recommended to use strings as hash keys for all JSI instances, but JSI does not enforce this, nor does it do any key conversion. You may also use [ActiveSupport::HashWithIndifferentAccess](https://api.rubyonrails.org/classes/ActiveSupport/HashWithIndifferentAccess.html) as the instance of a JSI in order to gain the benefits that offers over a plain hash. Note that activesupport is not a dependency of jsi and would be required separately for this.
335
+ Third party libraries such as [ActiveSupport::HashWithIndifferentAccess](https://api.rubyonrails.org/classes/ActiveSupport/HashWithIndifferentAccess.html) or [Hashie](https://github.com/hashie/hashie) with [IndifferentAccess](https://github.com/hashie/hashie#indifferentaccess) exist to make symbol keys interchangeable with string keys. A JSI can be instantiated with an indifferent Hash as its content, but there will be various inconsistencies when accessing values with a string vs a symbol, and this is not recommended or supported.
292
336
 
293
337
  ## Contributing
294
338
 
@@ -296,7 +340,7 @@ Issues and pull requests are welcome on GitHub at https://github.com/notEthan/js
296
340
 
297
341
  ## License
298
342
 
299
- [<img align="right" src="https://github.com/notEthan/jsi/raw/v0.3.0/resources/icons/AGPL-3.0.png">](https://www.gnu.org/licenses/agpl-3.0.html)
343
+ [<img align="right" src="https://www.gnu.org/graphics/agplv3-155x51.png">](https://www.gnu.org/licenses/agpl-3.0.html)
300
344
 
301
345
  JSI is licensed under the terms of the [GNU Affero General Public License version 3](https://www.gnu.org/licenses/agpl-3.0.html).
302
346
 
data/docs/Glossary.md ADDED
@@ -0,0 +1,313 @@
1
+ # Glossary
2
+
3
+
4
+ ## Background
5
+
6
+ The terminology JSI uses comes from a number of sources:
7
+
8
+ - [JSON Schema](https://json-schema.org/) and its [specifications](https://json-schema.org/specification-links.html)
9
+ - The [JSON Schema Glossary](https://json-schema.org/learn/glossary.html)
10
+ - [JSON](https://www.json.org/) and its specification
11
+ - Tree data structure ([Wikipedia](https://en.wikipedia.org/wiki/Tree_(data_structure)))
12
+ - Object-oriented programming ([Wikipedia](https://en.wikipedia.org/wiki/Object-oriented_programming))
13
+ - The Ruby programming language
14
+ - [JSON Pointer](https://www.rfc-editor.org/rfc/rfc6901)
15
+
16
+ The terminology from these can be contradictory, e.g. 'object' in JSON meaning what is a Hash in Ruby, but 'object' in Ruby meaning any object as in object-oriented programming. This glossary aims to clarify any ambiguity and introduce any terms which may not be familiar to the reader.
17
+
18
+
19
+ ## Terms
20
+
21
+
22
+ ### JSI
23
+
24
+ [JSI]: #jsi
25
+ [a JSI]: #jsi
26
+
27
+ JSI is the name of this library. As a [countable](https://en.wikipedia.org/wiki/Count_noun), "a JSI" refers to the library's instantiation of an instance described by a set of [schema]s. This is a Ruby instance of {JSI::Base}, and also an instance of the [schema module] belonging to each schema that describes it (its {JSI::Base#jsi_schemas}).
28
+
29
+
30
+ ### node
31
+
32
+ [node]: #node
33
+
34
+ A node is part of a [document] at a location identified by a [pointer].
35
+
36
+ In JSI a node generally means [a JSI] - a {JSI::Base} instance is often referred to just as "a JSI", but is referred to as a node in the context of its relationship to other nodes in its document.
37
+
38
+
39
+ ### node content
40
+
41
+ [content]: #node_content
42
+
43
+ The content of a [node] is the parsed JSON instance.
44
+ It is generally a Ruby Hash, Array, String, Integer, Float or BigDecimal, true, false, or nil.
45
+
46
+ This content is referred to as the 'instance' in relation to [schema]s that describe it.
47
+
48
+ See {JSI::Base#jsi_node_content} (also aliased as {JSI::Base#jsi_instance}.
49
+
50
+
51
+ ### document
52
+
53
+ [document]: #document
54
+
55
+ The document is the [content] of the [root] [node].
56
+
57
+ See {JSI::Base#jsi_document}.
58
+
59
+
60
+ ### root
61
+
62
+ [root]: #root
63
+
64
+ A [node] representing the whole of a [document].
65
+
66
+ Its [pointer] is empty (has zero [token]s).
67
+
68
+ See {JSI::Base#jsi_root_node}.
69
+
70
+
71
+ ### child
72
+
73
+ [child]: #child
74
+
75
+ A [node] immediately below another node, its [parent]. Identified by one [token] relative to the parent.
76
+
77
+ See {JSI::Base#[]} and {JSI::Base#jsi_child_node}.
78
+
79
+
80
+ ### parent
81
+
82
+ [parent]: #parent
83
+
84
+ A [node] immediately above some number of other nodes, its [child]ren. Only a [hash/object] or [array] can be a parent.
85
+
86
+ See {JSI::Base#jsi_parent_node}.
87
+
88
+
89
+ ### descendent
90
+
91
+ [descendent]: #descendent
92
+
93
+ A [node] anywhere below another node, its [ancestor]. Identified by a relative [pointer]. A node is considered to be a descendent of itself (at an empty relative pointer).
94
+
95
+ See {JSI::Base#jsi_descendent_node}, {JSI::Base#jsi_each_descendent_node}.
96
+
97
+
98
+ ### ancestor
99
+
100
+ [ancestor]: #ancestor
101
+
102
+ A [node] above any number of other nodes, its [descendent]s. A node is considered to be an ancestor of itself, and the [root] node is an ancestor of every node in the [document].
103
+
104
+ See {JSI::Base#jsi_ancestor_nodes}.
105
+
106
+
107
+ ### token
108
+
109
+ [token]: #token
110
+
111
+ An [array] [index] or [hash/object] [key/property name] that identifies a child node of its parent. Generally a String or non-negative Integer. [JSON Pointer](https://www.rfc-editor.org/rfc/rfc6901) calls this a "reference token".
112
+
113
+ A sequence of tokens comprises a [pointer].
114
+
115
+
116
+ ### pointer
117
+
118
+ [pointer]: #pointer
119
+
120
+ A sequence of [token]s which identifies a [descendent] of a [node], instantiated as a {JSI::Ptr}.
121
+
122
+ [JSON Pointers](https://www.rfc-editor.org/rfc/rfc6901) are parsed to JSI pointers.
123
+
124
+ A pointer may be referred to as 'absolute' when identifying a descendent of the root node (see {JSI::Base#jsi_ptr}), or 'relative' identifying a descendent of any ancestor node (such as the pointer passed to {JSI::Base#jsi_descendent_node}).
125
+
126
+
127
+ ### hash/object
128
+
129
+ [hash/object]: #hash_object
130
+
131
+ In JSON, an object; in Ruby, a Hash, or something [implicitly convertible](https://docs.ruby-lang.org/en/master/implicit_conversion_rdoc.html) with `#to_hash`.
132
+
133
+ In JSI, a [node] whose content is a Hash/`#to_hash`, and which is a {JSI::Base::HashNode}). These nodes are largely used as one would use a Hash, aiming to replicate Hash's API, as well being implicitly convertible with `#to_hash`.
134
+
135
+ A hash/object has [child] nodes on each [key/property name].
136
+
137
+
138
+ ### array
139
+
140
+ [array]: #array
141
+
142
+ In JSON, an array; in Ruby, an Array, or something [implicitly convertible](https://docs.ruby-lang.org/en/master/implicit_conversion_rdoc.html) with `#to_ary`.
143
+
144
+ In JSI, a [node] whose content is an Array/`#to_ary`, and which is a {JSI::Base::ArrayNode}). These nodes are largely used as one would use an Array, aiming to replicate Array's API, as well being implicitly convertible with `#to_ary`.
145
+
146
+ An array has [child] nodes on each [index].
147
+
148
+
149
+ ### key/property name
150
+
151
+ [key/property name]: #key_property_name
152
+
153
+ A [token] identifying a [child] of a [hash/object] [node]. In Ruby, a Hash key; in JSON Schema, an object property name. Property names are always strings in JSON. Note that symbols are not compatible and generally should not be used.
154
+
155
+ Property names can be described by schemas (using the `propertyNames` keyword), and can be JSI instances of those schemas. See {JSI::Base::HashNode#jsi_each_propertyName}.
156
+
157
+
158
+ ### index
159
+
160
+ [index]: #index
161
+
162
+ A [token] identifying a [child] of an [array] [node]. A non-negative integer. This may be represented in string form in a [pointer].
163
+
164
+
165
+ ### instance
166
+
167
+ [instance]: #instance
168
+
169
+ A heavily-overloaded term. Context should make it clear in what sense it is being used. 'Instance' can refer to an *object* or a *relationship*, in Ruby or JSON Schema or JSI instantiation:
170
+
171
+ - JSON Schema: the *instance* (JSON data) is an *instance* (relationship) of JSON Schemas that describe it
172
+ - Ruby: the *instance* (an Object) is an *instance* (relationship) of a Class and included Modules
173
+ - JSI: the *instance* ([a JSI]) is an *instance* (relationship) of [JSI Schemas][schema]
174
+
175
+ These all operate in parallel in JSI: a JSI instance represents a JSON instance, it is described by JSI Schemas which represent JSON Schemas, and it is a Ruby instance of the [JSI Schema Modules][schema module] of the schemas that describe it.
176
+
177
+
178
+ ### schema
179
+
180
+ [schema]: #schema
181
+
182
+ A JSI Schema is [a JSI] that represents a JSON Schema. It is a Ruby instance of {JSI::Base} and the module {JSI::Schema}.
183
+
184
+ A schema describes a set of [instance]s. Any JSI instance that is described by a given schema is a Ruby instance of that schema's [schema module].
185
+
186
+ A schema is described by a [meta-schema] and is a Ruby instance of that meta-schema's [schema module].
187
+
188
+
189
+ ### schema module
190
+
191
+ [schema module]: #schema_module
192
+
193
+ A JSI Schema Module is a Ruby module associated with a particular [schema]. Any JSI instance that is described by that schema is a Ruby instance of the schema's schema module. This is a {JSI::SchemaModule}.
194
+
195
+ See {JSI::Schema#jsi_schema_module}.
196
+
197
+ A JSI Schema Module is not to be confused with the module {JSI::Schema} - a schema *is* a Ruby instance of the module JSI::Schema, and it *has* a JSI Schema Module. The module JSI::Schema is included on the JSI Schema module of a [meta-schema].
198
+
199
+
200
+ ### meta-schema
201
+
202
+ [meta-schema]: #meta-schema
203
+
204
+ A meta-schema is a [schema] that describes schemas, i.e. [instance]s of the meta-schema are schemas.
205
+
206
+ As with any other JSI instance, a JSI schema is an instance of the [schema module] of the meta-schema that describes it. The meta-schema's schema module defines the functionality for its instances to behave as schemas. It includes the module {JSI::Schema}.
207
+
208
+ A meta-schema is described by a meta-schema, which may be itself or another meta-schema. Examples of self-describing meta-schemas are the JSON Schema meta-schemas. An example of the latter is the [schema describing the OpenAPI v3.0 Schema object](https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/schemas/v3.0/schema.yaml#L203), which describes schemas in OpenAPI documents, but is itself described by the JSON Schema draft-04 meta-schema.
209
+
210
+ A self-describing meta-schema is a Ruby instance of its own schema module.
211
+
212
+ A meta-schema has a [dialect] that defines the functionality of the schemas it describes.
213
+
214
+ In JSI, a meta-schema is a {JSI::Base} that is a {JSI::Schema::MetaSchema}. Its schema module is a {JSI::SchemaModule::MetaSchemaModule}, and includes {JSI::Schema}. See also {JSI::Schema#describes_schema?} and {JSI::Schema#describes_schema!}.
215
+
216
+
217
+ ### dialect
218
+
219
+ [dialect]: #dialect
220
+
221
+ A dialect defines all the keywords of a JSON Schema, how they operate, and any other aspects of schema behavior. It consists of a set of one or more [vocabularies][vocabulary]. Note that while not all specifications of dialects use the terms 'dialect' or 'vocabulary', JSI uses these abstractions for all supported specifications.
222
+
223
+ Examples of dialects include:
224
+ - Each published JSON Schema specification
225
+ - variants of JSON Schema defined by OpenAPI 2.x and 3.x
226
+ - custom dialects composed of vocabularies specified using the `$vocabulary` keyword
227
+
228
+ A dialect defines some or all of:
229
+
230
+ - a set of keywords
231
+ - those keywords' behavior and interactions with other keywords
232
+ - non-keyword behaviors of a schema (e.g. boolean schemas)
233
+ - division of keywords into vocabularies
234
+ - how vocabularies operate
235
+ - a meta-schema that describes/validates instances of the schema the dialect defines
236
+
237
+ Represented as a {JSI::Schema::Dialect}.
238
+
239
+
240
+ ### vocabulary
241
+
242
+ [vocabulary]: #vocabulary
243
+
244
+ A vocabulary is one part of a [dialect]'s definition of schema keywords and behaviors. Dialects are composed of one or more vocabularies.
245
+
246
+ A dialect whose specification does not define vocabularies is implemented using one vocabulary. Vocabularies were not defined for JSON Schema up to draft 07.
247
+
248
+ Represented as a {JSI::Schema::Vocabulary}.
249
+
250
+
251
+ ### resource
252
+
253
+ [resource]: #resource
254
+
255
+ A resource, or schema resource, is either:
256
+
257
+ - A [schema] that is identified by an absolute URI (typically declared with an id keyword)
258
+ - The root of a document containing schemas, whether or not the root is itself a schema. (Technically the root of any document can be considered a resource, but it is only useful when the document contains schemas.)
259
+
260
+ For a given node, its *resource root* is the nearest ancestor that is a resource - this is distinct from the [root] node of the whole document.
261
+
262
+ Relative URIs and [pointer]s used by a schema (e.g. in `$ref` or `$id`) are resolved relative to its resource root and that resource's id.
263
+
264
+ See {JSI::Schema#schema_resource_root}.
265
+
266
+
267
+ ### schema application
268
+
269
+ [schema application]: #schema_application
270
+
271
+ The computation of the [schema]s that apply describing a particular [node]. This involves resolving `$ref`s, choosing what conditional schemas apply (e.g. which subschema of a `oneOf` applies), and recursing down children applying child applicator schemas. The steps of this process:
272
+
273
+ - **root indicated schemas**: Application begins with the schemas (usually just one schema) indicated as describing the [root]. `#new_jsi` is invoked on a {JSI::SchemaSet} of the indicated schemas, or more commonly on one schema or [schema module]. These are the root's {JSI::Base#jsi_indicated_schemas}.
274
+ - **root applied schemas**: [in-place application] is performed on each of the root's indicated schemas to compute its applied schemas.
275
+ - Descending from the root to the given node, for each [token] of the node's [pointer]:
276
+ - **child indicated schemas**: [child application] is performed on each applied schema of the parent on the current token. This results in the child's indicated schemas.
277
+ - **child applied schemas**: [in-place application] is performed on each of the child's indicated schemas to compute its applied schemas.
278
+
279
+ The schemas that apply describing the node are the result of the final in-place application.
280
+
281
+
282
+ ### child application
283
+
284
+ [child application]: #child_application
285
+
286
+ The computation of subschemas of a given schema that describe a [child] of an instance on a given [token]. These come from subschemas defined on child applicator keywords such as `properties` and `items`. The result may be an empty schema set if no such keywords are present or none apply.
287
+
288
+
289
+ ### in-place application
290
+
291
+ [in-place application]: #in_place_application
292
+
293
+ The expansion of a schema to a set of **applied schemas** for a given instance. "In-place" means all the schemas apply to the same location in the instance, in contrast to [child application]. This is a recursive process.
294
+
295
+ - If the schema contains a `$ref` keyword, *and* the specification for the schema is draft-07 or older:
296
+ - The reference is resolved.
297
+ - In-place application recurses on the resolved schema.
298
+ - The rest of the schema is ignored. The schema does not apply itself, and any other applicator keywords are ignored (none should be present).
299
+
300
+ The resulting applied schemas are the resolved schema's in-place applicator schemas.
301
+
302
+ - Otherwise:
303
+ - The schema applies itself (it is added to the set of applied schemas).
304
+ - Any in-place applicator keywords (`anyOf`, `dependencies`, etc.) are evaluated for subschemas that apply to the instance. References are resolved from `$ref` or `$dynamicRef`, if present. For each such schema, in-place application recurses.
305
+
306
+ The resulting applied schemas consist of each recursively applied in-place applicator schema.
307
+
308
+
309
+ ### validation
310
+
311
+ [validation]: #validation
312
+
313
+ The process of determining whether a given [instance] is valid against the [schema]s that describe it, or collecting validation errors indicating why the instance is not valid. See {JSI::Base#jsi_valid?}, {JSI::Base#jsi_validate}, {JSI::Base#jsi_valid!}, {JSI::Schema#instance_valid?}, {JSI::Schema#instance_validate}, {JSI::Schema#instance_valid!}.
data/jsi.gemspec CHANGED
@@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.require_paths = ["lib"]
27
27
 
28
28
  spec.add_dependency "addressable", '~> 2.3'
29
- spec.add_development_dependency "maruku"
29
+ spec.add_dependency "bigdecimal"
30
30
  end