Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/cwltool/schemas/v1.0/salad/schema_salad/metaschema/import_include.md @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4f3585e2f14b |
---|---|
1 ## Import | |
2 | |
3 During preprocessing traversal, an implementation must resolve `$import` | |
4 directives. An `$import` directive is an object consisting of exactly one | |
5 field `$import` specifying resource by URI string. It is an error if there | |
6 are additional fields in the `$import` object, such additional fields must | |
7 be ignored. | |
8 | |
9 The URI string must be resolved to an absolute URI using the link | |
10 resolution rules described previously. Implementations must support | |
11 loading from `file`, `http` and `https` resources. The URI referenced by | |
12 `$import` must be loaded and recursively preprocessed as a Salad document. | |
13 The external imported document does not inherit the context of the | |
14 importing document, and the default base URI for processing the imported | |
15 document must be the URI used to retrieve the imported document. If the | |
16 `$import` URI includes a document fragment, the fragment must be excluded | |
17 from the base URI used to preprocess the imported document. | |
18 | |
19 Once loaded and processed, the `$import` node is replaced in the document | |
20 structure by the object or array yielded from the import operation. | |
21 | |
22 URIs may reference document fragments which refer to specific an object in | |
23 the target document. This indicates that the `$import` node must be | |
24 replaced by only the object with the appropriate fragment identifier. | |
25 | |
26 It is a fatal error if an import directive refers to an external resource | |
27 or resource fragment which does not exist or is not accessible. | |
28 | |
29 ### Import example | |
30 | |
31 import.yml: | |
32 ``` | |
33 { | |
34 "hello": "world" | |
35 } | |
36 | |
37 ``` | |
38 | |
39 parent.yml: | |
40 ``` | |
41 { | |
42 "form": { | |
43 "bar": { | |
44 "$import": "import.yml" | |
45 } | |
46 } | |
47 } | |
48 | |
49 ``` | |
50 | |
51 This becomes: | |
52 | |
53 ``` | |
54 { | |
55 "form": { | |
56 "bar": { | |
57 "hello": "world" | |
58 } | |
59 } | |
60 } | |
61 ``` | |
62 | |
63 ## Include | |
64 | |
65 During preprocessing traversal, an implementation must resolve `$include` | |
66 directives. An `$include` directive is an object consisting of exactly one | |
67 field `$include` specifying a URI string. It is an error if there are | |
68 additional fields in the `$include` object, such additional fields must be | |
69 ignored. | |
70 | |
71 The URI string must be resolved to an absolute URI using the link | |
72 resolution rules described previously. The URI referenced by `$include` must | |
73 be loaded as a text data. Implementations must support loading from | |
74 `file`, `http` and `https` resources. Implementations may transcode the | |
75 character encoding of the text data to match that of the parent document, | |
76 but must not interpret or parse the text document in any other way. | |
77 | |
78 Once loaded, the `$include` node is replaced in the document structure by a | |
79 string containing the text data loaded from the resource. | |
80 | |
81 It is a fatal error if an import directive refers to an external resource | |
82 which does not exist or is not accessible. | |
83 | |
84 ### Include example | |
85 | |
86 parent.yml: | |
87 ``` | |
88 { | |
89 "form": { | |
90 "bar": { | |
91 "$include": "include.txt" | |
92 } | |
93 } | |
94 } | |
95 | |
96 ``` | |
97 | |
98 include.txt: | |
99 ``` | |
100 hello world | |
101 | |
102 ``` | |
103 | |
104 This becomes: | |
105 | |
106 ``` | |
107 { | |
108 "form": { | |
109 "bar": "hello world" | |
110 } | |
111 } | |
112 ``` | |
113 | |
114 | |
115 ## Mixin | |
116 | |
117 During preprocessing traversal, an implementation must resolve `$mixin` | |
118 directives. An `$mixin` directive is an object consisting of the field | |
119 `$mixin` specifying resource by URI string. If there are additional fields in | |
120 the `$mixin` object, these fields override fields in the object which is loaded | |
121 from the `$mixin` URI. | |
122 | |
123 The URI string must be resolved to an absolute URI using the link resolution | |
124 rules described previously. Implementations must support loading from `file`, | |
125 `http` and `https` resources. The URI referenced by `$mixin` must be loaded | |
126 and recursively preprocessed as a Salad document. The external imported | |
127 document must inherit the context of the importing document, however the file | |
128 URI for processing the imported document must be the URI used to retrieve the | |
129 imported document. The `$mixin` URI must not include a document fragment. | |
130 | |
131 Once loaded and processed, the `$mixin` node is replaced in the document | |
132 structure by the object or array yielded from the import operation. | |
133 | |
134 URIs may reference document fragments which refer to specific an object in | |
135 the target document. This indicates that the `$mixin` node must be | |
136 replaced by only the object with the appropriate fragment identifier. | |
137 | |
138 It is a fatal error if an import directive refers to an external resource | |
139 or resource fragment which does not exist or is not accessible. | |
140 | |
141 ### Mixin example | |
142 | |
143 mixin.yml: | |
144 ``` | |
145 { | |
146 "hello": "world", | |
147 "carrot": "orange" | |
148 } | |
149 | |
150 ``` | |
151 | |
152 parent.yml: | |
153 ``` | |
154 { | |
155 "form": { | |
156 "bar": { | |
157 "$mixin": "mixin.yml" | |
158 "carrot": "cake" | |
159 } | |
160 } | |
161 } | |
162 | |
163 ``` | |
164 | |
165 This becomes: | |
166 | |
167 ``` | |
168 { | |
169 "form": { | |
170 "bar": { | |
171 "hello": "world", | |
172 "carrot": "cake" | |
173 } | |
174 } | |
175 } | |
176 ``` |