Skip to content

Commit 5157b38

Browse files
Bumps version to 0.4
1 parent 0505eba commit 5157b38

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## v0.4.0 [2022-05-09]
4+
5+
### Changed
6+
7+
- Replaces auto-generated schema names like `zero` and `one` with `:anonymous`
8+
making it easier for a consuming project to decide what to do when a subschema
9+
does not have an explicit name. (#97)
10+
- Replaces stringly-typed `type` properties for several schema types to instead
11+
use specific atoms corresponding to the set of valid JSON value type.
12+
- Adds better error description for invalid `union` types.
13+
314
## v0.3.0 [2019-10-30]
415

516
### Added

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
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
1010
libraries or tools that need to use JSON schema documents. For example, a JSON
1111
schema validator that validates a JSON object according to a JSON schema
1212
specification, 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
2222
defp deps do
2323
[
24-
{:json_schema, "~> 0.3"}
24+
{:json_schema, "~> 0.4"}
2525
]
2626
end
2727
```
@@ -35,7 +35,7 @@ The main API entry point is the `JsonSchema` module, which supports parsing a
3535
list of JSON schema files into JSON Schema ASTs via `parse_schema_files`, or
3636
resolving 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

4040
Presuming 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
```

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule JsonSchema.MixProject do
22
use Mix.Project
33

4-
@version "0.3.0"
4+
@version "0.4.0"
55
@elixir_version "~> 1.12"
66

77
def project do

0 commit comments

Comments
 (0)