This module provides resources for registering a new data format for the DataWeave language.
For an example, see Custom Data Formats Example.
Types
DataFormat
Represents the DataFormat
definition and contains the following fields:
-
binaryFormat
: True if this is data format is represented as binary representation instead of text. False if not present. -
defaultCharset
: Default character set of this format, if any. -
fileExtensions
: Returns the list of file extensions with the.
(for example,.json
,.xml
) to assign to this data format. -
acceptedMimeTypes
: The list of MIME types to accept. -
reader
: Function that reads raw content and transforms it into the canonical DataWeave model. -
writer
: Function that writes the canonical DataWeave model into binary content.
1
{ binaryFormat?: Boolean, defaultCharset?: String, fileExtensions?: Array<String>, acceptedMimeTypes: Array<MimeType>, reader: (content: Binary, charset: String, settings: ReaderSettings) -> Any, writer: (value: Any, settings: WriterSettings) -> Binary }
EmptySettings
Represents a configuration with no settings.
1
Object
EncodingSettings
Represents encoding settings and contains the following field:
-
encoding
: Encoding that the writer uses for output. Defaults to "UTF-8".
1
{ encoding?: String {defaultValue: "UTF-8"} }
MimeType
Represents a MIME type, such as application/json
.
1
String
Settings
Reader or writer configuration settings.
1
Object
Annotations
@DataFormatExtension()
Registration hook that the DataWeave engine uses to discover the variable that represents the custom data format. For an example, see the Custom Data Formats Example README.