Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to not deref jsonrefs #33

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions compiletojsonschema/compiletojsonschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from collections import OrderedDict
from copy import deepcopy

import jsonref


class CompileToJsonSchema:
def __init__(
Expand All @@ -31,15 +29,12 @@ def __init__(
def get(self):
if self.input_filename:
with open(self.input_filename) as fp:
resolved = jsonref.load(
resolved = json.load(
fp,
object_pairs_hook=OrderedDict,
base_uri=pathlib.Path(
os.path.realpath(self.input_filename)
).as_uri(),
)
elif isinstance(self.input_schema, dict):
resolved = jsonref.JsonRef.replace_refs(self.input_schema)
resolved = self.input_schema
else:
raise Exception("Must pass input_filename or input_schema")

Expand Down