|
9 | 9 | from rdflib.namespace import OWL, RDFS
|
10 | 10 | from ruamel.yaml.comments import CommentedMap
|
11 | 11 | from schema_salad import validate
|
12 |
| -from schema_salad.schema import AvroSchemaFromJSONData, Names |
| 12 | +from schema_salad.schema import Names, convert_to_dict |
| 13 | +from schema_salad.avro.schema import make_avsc_object |
13 | 14 | from schema_salad.sourceline import SourceLine
|
14 | 15 | from six import iteritems, string_types
|
15 | 16 | from typing_extensions import (TYPE_CHECKING, # pylint: disable=unused-import
|
@@ -109,27 +110,27 @@ def get_requirement(self,
|
109 | 110 |
|
110 | 111 | class Builder(HasReqsHints):
|
111 | 112 | def __init__(self,
|
112 |
| - job, # type: Dict[Text, Union[Dict[Text, Any], List, Text, None]] |
113 |
| - files, # type: List[Dict[Text, Text]] |
114 |
| - bindings, # type: List[Dict[Text, Any]] |
115 |
| - schemaDefs, # type: Dict[Text, Dict[Text, Any]] |
116 |
| - names, # type: Names |
117 |
| - requirements, # type: List[Dict[Text, Any]] |
118 |
| - hints, # type: List[Dict[Text, Any]] |
119 |
| - resources, # type: Dict[str, int] |
120 |
| - mutation_manager, # type: Optional[MutationManager] |
121 |
| - formatgraph, # type: Optional[Graph] |
122 |
| - make_fs_access, # type: Type[StdFsAccess] |
123 |
| - fs_access, # type: StdFsAccess |
124 |
| - job_script_provider, # type: Optional[Any] |
125 |
| - timeout, # type: float |
126 |
| - debug, # type: bool |
127 |
| - js_console, # type: bool |
128 |
| - force_docker_pull, # type: bool |
129 |
| - loadListing, # type: Text |
130 |
| - outdir, # type: Text |
131 |
| - tmpdir, # type: Text |
132 |
| - stagedir, # type: Text |
| 113 | + job, # type: Dict[Text, Union[Dict[Text, Any], List, Text, None]] |
| 114 | + files, # type: List[Dict[Text, Text]] |
| 115 | + bindings, # type: List[Dict[Text, Any]] |
| 116 | + schemaDefs, # type: Dict[Text, Dict[Text, Any]] |
| 117 | + names, # type: Names |
| 118 | + requirements, # type: List[Dict[Text, Any]] |
| 119 | + hints, # type: List[Dict[Text, Any]] |
| 120 | + resources, # type: Dict[str, int] |
| 121 | + mutation_manager, # type: Optional[MutationManager] |
| 122 | + formatgraph, # type: Optional[Graph] |
| 123 | + make_fs_access, # type: Type[StdFsAccess] |
| 124 | + fs_access, # type: StdFsAccess |
| 125 | + job_script_provider, # type: Optional[Any] |
| 126 | + timeout, # type: float |
| 127 | + debug, # type: bool |
| 128 | + js_console, # type: bool |
| 129 | + force_docker_pull, # type: bool |
| 130 | + loadListing, # type: Text |
| 131 | + outdir, # type: Text |
| 132 | + tmpdir, # type: Text |
| 133 | + stagedir, # type: Text |
133 | 134 | ): # type: (...) -> None
|
134 | 135 |
|
135 | 136 | self.job = job
|
@@ -208,12 +209,14 @@ def bind_input(self,
|
208 | 209 | if isinstance(schema["type"], MutableSequence):
|
209 | 210 | bound_input = False
|
210 | 211 | for t in schema["type"]:
|
| 212 | + avsc = None |
211 | 213 | if isinstance(t, string_types) and self.names.has_name(t, ""):
|
212 | 214 | avsc = self.names.get_name(t, "")
|
213 | 215 | elif isinstance(t, MutableMapping) and "name" in t and self.names.has_name(t["name"], ""):
|
214 | 216 | avsc = self.names.get_name(t["name"], "")
|
215 |
| - else: |
216 |
| - avsc = AvroSchemaFromJSONData(t, self.names) |
| 217 | + if not avsc: |
| 218 | + avsc = make_avsc_object(convert_to_dict(t), self.names) |
| 219 | + assert avsc is not None |
217 | 220 | if validate.validate(avsc, datum):
|
218 | 221 | schema = copy.deepcopy(schema)
|
219 | 222 | schema["type"] = t
|
|
0 commit comments