You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -45,10 +48,82 @@ Enhancements should be submitted as issues using the issue template.
45
48
46
49
The project supports development through the use of [Visual Studio Code configurations](https://code.visualstudio.com/docs/remote/containers). The VS Code [development container](.devcontainer/Dockerfile) contains all packages required to develop and test changes locally before submitting pull requests.
47
50
51
+
### [Conditions](condition/)
52
+
53
+
Each condition should be functional and solve a single problem, and each one is nested under a "family" of conditions. (We may ask that you split complex condition logic into multiple conditions.) For example, there is a family for string comparisons:
54
+
- Equal To (`cnd.string.equal_to`, `cnd.str.eq`)
55
+
- Starts With (`cnd.string.starts_with`, `cnd.str.prefix`)
56
+
- Ends With (`cnd.string.ends_with`, `cnd.str.suffix`)
57
+
- Contains (`cnd.string.contains`, `cnd.str.has`)
58
+
- Match (regular expression) (`cnd.string.match`)
59
+
- Greater Than (`cnd.string.greater_than`, `cnd.str.gt`)
60
+
- Less Than (`cnd.string.less_than`, `cnd.str.lt`)
61
+
62
+
Conditions may require changes to the [configuration library](substation.libsonnet) (usually when adding features or making breaking changes). For new conditions, we typically ask that you add a new [example](examples/) that uses a config unit test.
63
+
64
+
Conditions may reuse these field structures:
65
+
-`object`: For reading from JSON objects.
66
+
67
+
In some cases, we may ask you to rename fields for consistency.
68
+
69
+
### [Transforms](transform/)
70
+
71
+
Each transform should be functional and solve a single problem, and each one is nested under a "family" of transforms. (We may ask that you split complex transform logic into multiple transforms.) For example, there is a family for JSON object operations:
72
+
- Copy (`tf.object.copy`, `tf.obj.cp`)
73
+
- Delete (`tf.object.delete`, `tf.obj.del`)
74
+
- Insert (`tf.object.insert`)
75
+
- To Boolean (`tf.object.to.boolean`, `tf.obj.to.bool`)
76
+
- To String (`tf.object.to.string`, `tf.obj.to.str`)
77
+
- To Float (`tf.object.to.float`)
78
+
- To Integer (`tf.object.to.integer`, `tf.obj.to.int`)
79
+
- To Unsigned Integer (`tf.object.to.unsigned_integer`, `tf.obj.to.uint`)
80
+
81
+
Transforms may require changes to the [configuration library](substation.libsonnet) (usually when adding features or making breaking changes). For new transforms, we typically ask that you add a new [example](examples/) that uses a config unit test.
82
+
83
+
Transforms may reuse these field structures:
84
+
-`id`: For uniquely identifying a transform. (If not configured, then this is automatically generated when a configuration is compiled by Jsonnet.)
85
+
-`object`: For reading from and writing to JSON objects.
86
+
-`batch`: For stateful collection of multiple messages in a transform.
87
+
-`transforms`: For chaining multiple transforms together. (Used in `meta` transforms.)
88
+
-`aux_transforms`: For chaining multiple transforms together, _after_ the primary transform has executed. (Used in `send` transforms.)
89
+
90
+
In some cases, we may ask you to rename fields for consistency.
91
+
48
92
### Testing
49
93
50
94
We rely on contributors to test changes before they are submitted as pull requests. Any components added or changed should be tested and public packages should be supported by unit tests.
51
95
96
+
#### Config Unit Tests
97
+
98
+
Configuration examples should use config unit tests to demo new concepts or features, like this:
@@ -125,7 +200,7 @@ Sources that [add metadata during message creation](/message/) should use lowerC
125
200
126
201
#### Package Configurations
127
202
128
-
Configurations for packages (for example, [condition](/condition/README.md) and [transform](/transform/README.md)) should always use lower_snake_case in their JSON keys. This helps maintain readability when reviewing large configuration files.
203
+
Configurations for packages (for example, conditions and transforms) should always use lower_snake_case in their JSON keys. This helps maintain readability when reviewing large configuration files.
129
204
130
205
We strongly urge everyone to use Jsonnet for managing configurations.
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -474,7 +474,7 @@ ok examples/transform/time/str_conversion/config.jsonnet 133µs
474
474
475
475
[VS Code](https://code.visualstudio.com/docs/devcontainers/containers) is the recommended development environment for Substation. The project includes a [development container](.devcontainer/Dockerfile) that should be used to develop and test the system. Refer to the [development guide](CONTRIBUTING.md) for more information.
476
476
477
-
If don't use VS Code, then you should run the development container from the command line:
477
+
If you don't use VS Code, then you should run the development container from the command line:
0 commit comments