@ @open
@open
Applies to: enum
Section: §4.4
Syntax
Attr = "@" Path [ "(" [ AttrArgs ] ")" ] ;Grammar: App. A
Defined in
- 4.4 enum — A variant: without fields, with positional or with named fields.
- 4.9 Attributes — Syntax: @name or @name(arguments) before a declaration, field, parameter or rpc.
- 9.2 Field numbers and schema — Every field of a data and every variant of an enum has a stable tag (the number in the wire format).
- 9.3 The OxL wire format — The OxL binary format is protobuf 3 encoding with the following mappings
- 9.4 Decoding and validation — A missing required field → DecodeError.Missing.
Examples
pub(api) enum Role { User, Support, Admin }
pub(api) enum Shape {
Circle(r: f64)
Rect(w: f64, h: f64)
Empty
}
@error enum PayError { Declined(reason: str), Fraud, Limit(max: Money) }
@open pub(api) enum Status { New = 1, Paid = 2, Shipped = 3 }— 4.4 enum
Related diagnostics
deprecated, schema-attr, schema-break, secret-json