Serializable representation of a configuration node.
| 122 | |
| 123 | @dataclass(frozen=True) |
| 124 | class SchemaNode: |
| 125 | """Serializable representation of a configuration node.""" |
| 126 | |
| 127 | node: str |
| 128 | fields: Sequence[ConfigFieldSpec] |
| 129 | constraints: Sequence[RuntimeConstraint] = field(default_factory=list) |
| 130 | |
| 131 | def to_json(self) -> Dict[str, Any]: |
| 132 | return { |
| 133 | "node": self.node, |
| 134 | "fields": [spec.to_json() for spec in self.fields], |
| 135 | "constraints": [constraint.to_json() for constraint in self.constraints], |
| 136 | } |
| 137 | |
| 138 | |
| 139 | @dataclass |