#[derive(WithOptions)]
{
// Attributes available to this derive:
#[with_option]
}
Expand description
Annotates that the struct represents the WITH
properties for a connector.
This implements a marker trait WithOptions
.
It’s also used to generate the with_option_*.yaml
files.
§Notes about how to define property structs
§Prefer strongly-typed fields
Avoid using HashMap
with #[serde(flatten)]
to include all unknown fields.
Declare all fields explicitly instead.
The only exception now is CDC, which needs to pass a lot of options as-is to Debezium.
§Common struct
When there are some fields can be grouped together, and/or can be shared by source and sink,
or by multiple connectors, define a struct for them and use the common struct as a
#[serde(flatten)]
field.
Add #[derive(WithOptions)]
to both the outer and the inner struct.
Avoid using nested #[serde(flatten)]
field in the common struct,
because this will lead to unexpected serde behaviors.
Put all flatten fields in the top-level struct instead.