Skip to content

Commit

Permalink
Adds example of URI type reference
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonwasrobot committed Aug 7, 2017
1 parent bed83c0 commit bbbd5a2
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions lib/types/type_reference.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,42 @@ defmodule JS2E.Types.TypeReference do
JSON Schema:
"self": {
"$ref": "#/definitions/link"
"$ref": "#/definitions/foo"
}
Where "#/definitions/link" resolves to
"other": {
"$ref": "http://www.example.com/definitions.json#bar"
}
Where "#/definitions/foo" resolves to
"definitions": {
"link": {
"type": "string"
}
"foo": {
"type": "string"
}
}
and "http://www.example.com/definitions.json#bar" resolves to
"definitions": {
"bar": {
"id": "#bar",
"type": "number"
}
}
Elixir intermediate representation:
%TypeReference{name: "self",
path: ["#", "definitions", "link"]}
%TypeReference{name: "other",
path: %URI{scheme: "http",
host: "www.example.com",
path: "/definitions.json",
fragment: "bar",
...}}
"""

alias JS2E.Types
Expand Down

0 comments on commit bbbd5a2

Please sign in to comment.