Attributes
The attributes allow to further apply configuration to elements, while not affecting the schema itself. These rather provide either extra information or customize how language specific code is generated.
For example, they allow to mark elements as deprecated or define how a certain value is represented in code, off the default variant.
Schema
Section titled “Schema”Attributes can come in 3 forms.
- Unit, just having the name of the attribute itself.
- Singe-value, with a literal assignment (can be optional).
- Multi-value, as an object that can have multiple sub-attributes.
#[deprecated]struct Sample {}Single-value
Section titled “Single-value”#[deprecated = "Don't use anymore"]struct Sample {}Multi-value
Section titled “Multi-value”struct Sample { #[validate(min = 1, max = 100)] age: u8 @1,}