field¶
Canonical path: o6.field
field
¶
field(
*,
name=None,
description=None,
isOptional=False,
valueRank=None,
arrayDimensions=None,
maxStringLength=None
)
Attach OPC UA metadata to an annotated DataType field.
Used as the assigned value of an annotated attribute in a
@o6.datatype class body. The annotation still supplies the
field's static type, so this factory deliberately returns Any to type
checkers and adds only what the annotation cannot express.
@o6.datatype(ns="plant")
class BatchRecord:
batchId: str
comment: Optional[str] = o6.field(description="free-text operator note")
tag: str = o6.field(maxStringLength=32)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Optional[str]
|
OPC UA field name. This renames the Python attribute along with the wire field, so it is mainly useful when a UA field name is not a valid Python identifier. |
None
|
description
|
Optional[str]
|
The field's Description in the |
None
|
isOptional
|
bool
|
Mark the field optional. |
False
|
valueRank
|
Optional[int]
|
Override the rank inferred from the annotation. Structure
members must be scalars ( |
None
|
arrayDimensions
|
Optional[list[int]]
|
ArrayDimensions of the field. |
None
|
maxStringLength
|
Optional[int]
|
Length hint for a |
None
|