Skip to content

Commit 369bd83

Browse files
albertoreddragonwasrobot
authored andcommitted
[Change] split json in definition and main object (#51)
This closes #50
1 parent 476f04a commit 369bd83

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/parsers/root_parser.ex

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ defmodule JS2E.Parsers.RootParser do
2323
title = Map.get(root_node, "title", "")
2424
description = Map.get(root_node, "description")
2525

26-
definitions_parser_result = parse_definitions(root_node, schema_id)
27-
root_parser_result = parse_root_object(root_node, schema_id, title)
26+
root_node_no_def = Map.delete(root_node, "definitions")
27+
root_node_only_def = Map.take(root_node, ["$schema", "id", "title", "definitions"])
28+
29+
definitions_parser_result = parse_definitions(root_node_only_def, schema_id)
30+
root_parser_result = parse_root_object(root_node_no_def, schema_id, title)
2831

2932
%ParserResult{type_dict: type_dict,
3033
errors: errors,

0 commit comments

Comments
 (0)