Show answerHide answer
Correct answer: D 1. 1. import * from libs::etl::WebStore 2. 2. --- 3. 3. loginUser("Todd.Pal@mulesoft.com")
Explanation
Explanation:In DataWeave 2.0, to import functions from a module file, you use the import directive. The path is constructed using double colons :: to represent directory separators, and the file extension (.dwl) is omitted.
Breaking down the correct import:
Module location: src/main/resources/libs/etl/WebStore.dwl
The src/main/resources directory is the root for DataWeave modules.
Therefore, the module path is: libs::etl::WebStore
import * from libs::etl::WebStore imports all functions from that module into the current namespace, allowing you to call loginUser() directly.
Why the other options are incorrect:
A) import libs.etl – This is invalid syntax. DataWeave uses :: separators, not dots. Also, you must specify the filename (WebStore), not just the folder.
B) import * from libs::etl – This tries to import from a directory (etl), not a module file (WebStore). You must import from the specific .dwl file.
C) import libs.etl.WebStore – Uses dot notation (.) instead of the correct double colon (::) syntax.
Key DataWeave Module Import Rules:
- Path separators are ::, not . or /.
- Omit the .dwl extension in the import statement.
- The path is relative to src/main/resources.
- import * from imports all functions so they can be called directly by name.
Reference:
This follows DataWeave 2.0 documentation on module imports, specifically the syntax for importing from custom modules in the resources folder. The pattern import * from some::path::ModuleName is standard.
