55[ ![ Hex Docs] ( https://img.shields.io/badge/hex-docs-lightgreen.svg )] ( https://hexdocs.pm/json_schema/ )
66[ ![ License] ( https://img.shields.io/hexpm/l/json_schema.svg )] ( https://github.com/dragonwasrobot/json_schema/blob/master/LICENSE )
77
8- A JSON schema parser for inspection and manipulation of JSON schema abstract
9- syntax trees (ASTs). This library is meant as a basis for writing other
8+ A JSON schema parser for inspection and manipulation of JSON Schema Abstract
9+ Syntax Trees (ASTs). This library is meant as a basis for writing other
1010libraries or tools that need to use JSON schema documents. For example, a JSON
1111schema validator that validates a JSON object according to a JSON schema
1212specification, or a code generator that generates a data model and accompanying
@@ -21,7 +21,7 @@ Add `:json_schema` as a dependency in `mix.exs`:
2121``` elixir
2222defp deps do
2323 [
24- {:json_schema , " ~> 0.3 " }
24+ {:json_schema , " ~> 0.4 " }
2525 ]
2626end
2727```
@@ -35,7 +35,7 @@ The main API entry point is the `JsonSchema` module, which supports parsing a
3535list of JSON schema files into JSON Schema ASTs via ` parse_schema_files ` , or
3636resolving a JSON schema type given an identifier via ` resolve_type ` .
3737
38- ### Parsing a JSON schema file into an AST
38+ ### Parsing a JSON schema file into an Abstract Syntax Tree
3939
4040Presuming we have the following two JSON schema files:
4141
@@ -137,7 +137,7 @@ schema_result = JsonSchema.parse_schema_files(schema_paths)
137137 description: nil ,
138138 name: " radius" ,
139139 path: URI .parse (" #/properties/radius),
140- type: " number"
140+ type: : number
141141 },
142142 " http: // example.com/ circle.json# " => %JsonSchema.Types.ObjectType{
143143 additional_properties: nil ,
@@ -164,7 +164,7 @@ schema_result = JsonSchema.parse_schema_files(schema_paths)
164164 description: nil ,
165165 name: " color" ,
166166 path: URI .parse (" #/definitions/color" ),
167- type: " string" ,
167+ type: : string ,
168168 values: [" red" , " yellow" , " green" , " blue" ]
169169 },
170170 " #/definitions/point" => %JsonSchema .Types .ObjectType {
@@ -183,19 +183,19 @@ schema_result = JsonSchema.parse_schema_files(schema_paths)
183183 description: nil ,
184184 name: " x" ,
185185 path: URI .parse (" /definitions/point/properties/x" ),
186- type: " number"
186+ type: : number
187187 },
188188 " #/definitions/point/properties/y" => %JsonSchema .Types .PrimitiveType {
189189 description: nil ,
190190 name: " y" ,
191191 path: URI .parse (" #/definitions/point/properties/y" ),
192- type: " number"
192+ type: : number
193193 },
194194 " http://example.com/definitions.json#color" => %JsonSchema .Types .EnumType {
195195 description: nil ,
196196 name: " color" ,
197197 path: URI .parse (" #/definitions/color" ),
198- type: " string" ,
198+ type: : string ,
199199 values: [" red" , " yellow" , " green" , " blue" ]
200200 },
201201 " http://example.com/definitions.json#point" => %JsonSchema .Types .ObjectType {
@@ -263,7 +263,7 @@ color_type
263263 description: nil ,
264264 name: " color" ,
265265 path: URI .parse (" #/definitions/color" ),
266- type: " string" ,
266+ type: : string ,
267267 values: [" red" , " yellow" , " green" , " blue" ]
268268 }
269269```
0 commit comments