File tree Expand file tree Collapse file tree 3 files changed +6
-20
lines changed Expand file tree Collapse file tree 3 files changed +6
-20
lines changed Original file line number Diff line number Diff line change @@ -27,19 +27,15 @@ defmodule JS2E.Parser.ArrayParser do
27
27
iex> type?(%{})
28
28
false
29
29
30
- iex> type?(%{"type" => "array"})
31
- false
32
-
33
- iex> type?(%{"type" => "array", "items" => %{"$ref" => "#foo"}})
30
+ iex> type?(%{"items" => %{"$ref" => "#foo"}})
34
31
true
35
32
36
33
"""
37
34
@ impl JS2E.Parser.ParserBehaviour
38
35
@ spec type? ( Types . schemaNode ( ) ) :: boolean
39
36
def type? ( schema_node ) do
40
- type = schema_node [ "type" ]
41
37
items = schema_node [ "items" ]
42
- type == "array" && is_map ( items )
38
+ is_map ( items )
43
39
end
44
40
45
41
@ doc ~S"""
Original file line number Diff line number Diff line change @@ -35,21 +35,16 @@ defmodule JS2E.Parser.ObjectParser do
35
35
iex> type?(%{})
36
36
false
37
37
38
- iex> type?(%{"type" => "object"})
39
- false
40
-
41
- iex> an_object = %{"type" => "object",
42
- ...> "properties" => %{"name" => %{"type" => "string"}}}
38
+ iex> an_object = %{"properties" => %{"name" => %{"type" => "string"}}}
43
39
iex> type?(an_object)
44
40
true
45
41
46
42
"""
47
43
@ impl JS2E.Parser.ParserBehaviour
48
44
@ spec type? ( map ) :: boolean
49
45
def type? ( schema_node ) do
50
- type = schema_node [ "type" ]
51
46
properties = schema_node [ "properties" ]
52
- type == "object" && is_map ( properties )
47
+ is_map ( properties )
53
48
end
54
49
55
50
@ doc ~S"""
Original file line number Diff line number Diff line change @@ -28,21 +28,16 @@ defmodule JS2E.Parser.TupleParser do
28
28
iex> type?(%{})
29
29
false
30
30
31
- iex> type?(%{"type" => "array"})
32
- false
33
-
34
- iex> aTuple = %{"type" => "array",
35
- ...> "items" => [%{"$ref" => "#foo"}, %{"$ref" => "#bar"}]}
31
+ iex> aTuple = %{"items" => [%{"$ref" => "#foo"}, %{"$ref" => "#bar"}]}
36
32
iex> type?(aTuple)
37
33
true
38
34
39
35
"""
40
36
@ impl JS2E.Parser.ParserBehaviour
41
37
@ spec type? ( Types . node ( ) ) :: boolean
42
38
def type? ( schema_node ) do
43
- type = schema_node [ "type" ]
44
39
items = schema_node [ "items" ]
45
- type == "array" && is_list ( items )
40
+ is_list ( items )
46
41
end
47
42
48
43
@ doc ~S"""
You can’t perform that action at this time.
0 commit comments