Includes & Data
您所查看的文档没有与当前语言匹配的版本,因此我们将显示默认语言的版本。
Includes & Data
The include arrow
The ~> arrow reads a file (or a URL) into a data value, so a flow can compose data from outside the graph instead of hand-writing it:
'./schema.json!' ~> @in Node
The value on the left is passed through the include resolver, which reads the target and returns its contents. A trailing ! tells the resolver to JSON-parse the result, so the node receives the parsed object rather than the raw text.
'./payload.json' ~> in MyProc # MyProc.in receives the file text
'./payload.json!' ~> in MyProc # MyProc.in receives the parsed JSON
Any port, any role
The include arrow targets any port, in either role:
~> @in Node— a context feed: the resolved data is stored on the node as context.~> in Node— a normal IIP: the resolved data is delivered to the port like any literal.
The include arrow is how a flow pulls in configuration, schemas, or data blobs from the filesystem at compile time, then lets those values flow like any other data. For local files the resolver is the FSResolver; the parser's addIncludeResolver lets the runtime choose how a given target is resolved.