Skip to content

Add --skip_schemas to avoid loading external schemas #439

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

Merged
merged 3 commits into from
Jun 23, 2017
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions cwltool/load_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ def validate_document(document_loader, # type: Loader
enable_dev=False, # type: bool
strict=True, # type: bool
preprocess_only=False, # type: bool
fetcher_constructor=None
fetcher_constructor=None,
skip_schemas=None
# type: Callable[[Dict[unicode, unicode], requests.sessions.Session], Fetcher]
):
# type: (...) -> Tuple[Loader, Names, Union[Dict[Text, Any], List[Dict[Text, Any]]], Dict[Text, Any], Text]
Expand Down Expand Up @@ -180,9 +181,10 @@ def validate_document(document_loader, # type: Loader
raise avsc_names

processobj = None # type: Union[CommentedMap, CommentedSeq, unicode]

document_loader = Loader(sch_document_loader.ctx, schemagraph=sch_document_loader.graph,
idx=document_loader.idx, cache=sch_document_loader.cache,
fetcher_constructor=fetcher_constructor)
fetcher_constructor=fetcher_constructor, skip_schemas=skip_schemas)

_add_blank_ids(workflowobj)

Expand Down
7 changes: 6 additions & 1 deletion cwltool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ def arg_parser(): # type: () -> argparse.ArgumentParser
exgroup.add_argument("--non-strict", action="store_false", help="Lenient validation (ignore unrecognized fields)",
default=True, dest="strict")

parser.add_argument("--skip-schemas", action="store_true",
help="Skip loading of schemas", default=True, dest="skip_schemas")

exgroup = parser.add_mutually_exclusive_group()
exgroup.add_argument("--verbose", action="store_true", help="Default logging")
exgroup.add_argument("--quiet", action="store_true", help="Only print warnings and errors.")
Expand Down Expand Up @@ -634,6 +637,7 @@ def main(argsl=None, # type: List[str]
'enable_dev': False,
'enable_ext': False,
'strict': True,
'skip_schemas': False,
'rdf_serializer': None,
'basedir': None,
'tool_help': False,
Expand Down Expand Up @@ -701,7 +705,8 @@ def main(argsl=None, # type: List[str]
= validate_document(document_loader, workflowobj, uri,
enable_dev=args.enable_dev, strict=args.strict,
preprocess_only=args.print_pre or args.pack,
fetcher_constructor=fetcher_constructor)
fetcher_constructor=fetcher_constructor,
skip_schemas=args.skip_schemas)

if args.pack:
stdout.write(print_pack(document_loader, processobj, uri, metadata))
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ ruamel.yaml==0.13.7
rdflib==4.2.2
rdflib-jsonld==0.4.0
shellescape==3.4.1
schema-salad>=2.4.20170308171942,<3
schema-salad>=2.5.20170623152720,<3
typing==3.5.2.2 ; python_version>="2.7"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
'ruamel.yaml >= 0.12.4',
'rdflib >= 4.2.2, < 4.3.0',
'shellescape >= 3.4.1, < 3.5',
'schema-salad >= 2.4.20170308171942, < 3',
'schema-salad >= 2.5.20170623152720, < 3',
'typing >= 3.5.2, < 3.6',
'six >= 1.8.0',
],
Expand Down