Skip to content

Commit

Permalink
Rename id -> $id and add info of supported JSON Schema dialect
Browse files Browse the repository at this point in the history
  • Loading branch information
kgiszczak committed May 10, 2022
1 parent ed8fa47 commit 4f0f656
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,8 @@ Shale.xml_adapter = Shale::Adapter::Ox

To generate JSON Schema from you Shale data model use:

:warning: Shale only supports **[Draft 2020-12](https://json-schema.org/draft/2020-12/schema)** JSON Schema

```ruby
require 'shale/schema'

Expand All @@ -622,7 +624,7 @@ Shale::Schema.to_json(Person, id: 'http://foo.bar/schema/person', description: '
#
# {
# "$schema": "https://json-schema.org/draft/2020-12/schema",
# "id": "http://foo.bar/schema/person",
# "$id": "http://foo.bar/schema/person",
# "description": "My description",
# "$ref": "#/$defs/Person",
# "$defs": {
Expand Down Expand Up @@ -685,7 +687,7 @@ Shale::Schema::JSON.register_json_type(MyEmailType, MyEmailJSONType)

### Generating XML Schema

To generate XML Schema from you Shale data model use:
To generate XML Schema from your Shale data model use:

```ruby
require 'shale/schema'
Expand Down
2 changes: 1 addition & 1 deletion lib/shale/schema/json/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def initialize(types, id: nil, description: nil)
def as_json
schema = {
'$schema' => DIALECT,
'id' => @id,
'$id' => @id,
'description' => @description,
}

Expand Down

0 comments on commit 4f0f656

Please sign in to comment.