Skip to content

Commit

Permalink
Preserve ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
odscjames committed Oct 5, 2018
1 parent 5e8487e commit 5ea7c0d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion compiletojsonschema/compiletojsonschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pathlib
import os
from copy import deepcopy
from collections import OrderedDict


class CompileToJsonSchema:
Expand All @@ -13,7 +14,10 @@ def __init__(self, input_filename, set_additional_properties_false_everywhere=Fa

def get(self):
with open(self.input_filename) as fp:
resolved = jsonref.load(fp, base_uri=pathlib.Path(os.path.realpath(self.input_filename)).as_uri())
resolved = jsonref.load(fp,
object_pairs_hook=OrderedDict,
base_uri=pathlib.Path(os.path.realpath(self.input_filename)).as_uri()
)

resolved = self.__process(resolved)

Expand Down

0 comments on commit 5ea7c0d

Please sign in to comment.