Commit 3debe1e
Config file improvements (drasi-project#55)
* Remove platform examples
Signed-off-by: Agent of Reality <agentx@agentofreality.com>
* Fix trading example configuration schema to match API naming conventions
The API uses a mix of snake_case and camelCase depending on the struct:
- SourceConfig/ReactionConfig top-level fields: snake_case (auto_start, bootstrap_provider)
- Nested config DTOs (QueryConfigDto, SseReactionConfigDto, etc.): camelCase (sourceId, ssePath)
Changes:
- YAML: auto_start, bootstrap_provider for SourceConfig fields
- DrasiClient.ts: sourceId for query sources, ssePath/heartbeatIntervalMs for SSE config
- DrasiClient.ts: autoStart for QueryConfigDto, auto_start for ReactionConfig
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Remove deleted platform example tests from validation suite
Removes test references to examples that were deleted in commit 7ffee84:
- debug-platform-building-comfort
- drasi-platform
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Update trading example readme file.
Signed-off-by: Agent of Reality <agentx@agentofreality.com>
* Add CONTRIBUTING.md with learning exercises and contribution ideas
Includes:
- 9 learning exercises (beginner to advanced) for understanding Drasi
- Prioritized feature contribution suggestions
- Documentation improvement ideas
- Getting started guide for contributors
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* remove unused plugin config models
Signed-off-by: Agent of Reality <agentx@agentofreality.com>
* Add wide range of config file examples
Signed-off-by: Agent of Reality <agentx@agentofreality.com>
* Add two-pass config validation to catch unknown and snake_case fields
Implements field validation that runs before typed deserialization to
catch typos and snake_case field names that would otherwise be silently
ignored. This prevents configuration errors from going unnoticed.
Key changes:
- Add src/config/validation.rs with field validation for all config types
- Integrate validation into load_config_file() as first-pass check
- Add rename_all_fields="camelCase" to SourceConfig/ReactionConfig enums
- Fix test files and example configs to use camelCase consistently
- Add comprehensive test coverage for parsing failures
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix mock source dataType and query label mismatches in examples
The mock source only supports "sensor", "counter", and "generic" data
types. The examples incorrectly used "sensor_live" which falls through
to generic. Also fixed query labels to match actual generated data:
- dataType "sensor" generates SensorReading nodes (not Sensor)
- dataType "counter" generates Counter nodes
- dataType "generic" generates Generic nodes
Added unit tests to verify YAML deserialization of mock source config.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix templates in example config files
Signed-off-by: Agent of Reality <agentx@agentofreality.com>
* Add Handlebars template syntax validation to config validation
Uses Handlebars' built-in register_template_string() method to validate
template syntax at config parse time, catching errors early rather than
at runtime when reactions try to execute templates.
Validates templates in:
- Log reaction: defaultTemplate and routes templates
- SSE reaction: defaultTemplate and routes templates
- HTTP reaction: body and url fields in routes
Catches common template errors:
- Unclosed braces: {{after.Name
- Empty expressions: {{}}
- Unclosed blocks: {{#if condition}}...
- Mismatched helpers: {{#each}}...{{/if}}
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Replace manual field validation with custom serde deserializers
- Add custom Deserialize implementations for SourceConfig and ReactionConfig
that extract common fields (kind, id, autoStart, queries) manually and
delegate remaining fields to inner DTOs with deny_unknown_fields
- Add #[serde(deny_unknown_fields)] to all source and reaction inner DTOs
to reject unknown/snake_case fields at deserialization time
- Inline adaptive batch fields in HttpAdaptiveReactionConfigDto and
GrpcAdaptiveReactionConfigDto to avoid flatten + deny_unknown_fields conflict
- Remove ~1100 lines of hardcoded field validation from validation.rs
(SOURCE_COMMON_FIELDS, source_fields(), reaction_fields(), etc.)
- Add 44 unit tests for custom deserializers covering valid configs,
missing fields, unknown fields, snake_case rejection, and error messages
- Fix trading example client to use camelCase field names (autoStart,
ssePath, heartbeatIntervalMs) instead of snake_case
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fixing Getting Started integration test
Signed-off-by: Agent of Reality <agentx@agentofreality.com>
* refactor: unify config validation using deny_unknown_fields
- Add deny_unknown_fields to DrasiServerConfig, DrasiLibInstanceConfig,
QueryConfigDto, and SourceSubscriptionConfigDto
- Implement custom deserializer for StateStoreConfig matching the pattern
used by SourceConfig and ReactionConfig
- Create RedbStateStoreConfigDto with deny_unknown_fields for strict
field validation
- Simplify validation.rs to only handle Handlebars template syntax
validation (remove manual field arrays)
- Remove SERVER_FIELDS, INSTANCE_FIELDS, QUERY_FIELDS arrays
- Add comprehensive tests for StateStoreConfig validation
This change makes all config types use consistent validation:
- Simple structs use #[serde(deny_unknown_fields)]
- Tagged enums (Source, Reaction, StateStore) use custom deserializers
with inner DTOs that have deny_unknown_fields
Unknown fields are now rejected during deserialization instead of
requiring separate manual validation.
* refactor: move BootstrapProviderConfig to drasi-server and standardize on 'kind' discriminator
Changes:
- Created src/api/models/bootstrap.rs with local BootstrapProviderConfig
- Custom deserializer with deny_unknown_fields on all inner DTOs
- Conversion implementations to drasi-lib types
- Comprehensive test coverage (20 tests)
- Changed discriminator field from 'type' to 'kind' for consistency
with SourceConfig, ReactionConfig, and StateStoreConfig
- Removed unused AdaptiveBatchConfigDto struct (dead code)
- Updated factories.rs to use local BootstrapProviderConfig
- Updated init/prompts.rs to use local types
- Updated all example configs and tests
This completes the config validation consistency work:
- All tagged enums now use 'kind' as discriminator
- All inner DTOs have deny_unknown_fields
- All custom deserializers provide contextual error messages
* fix: rename bootstrapProvider type to kind in config
* docs: update config examples to use camelCase and correct field names
- Change bootstrap provider discriminator from 'type' to 'kind'
- Convert all snake_case field names to camelCase in YAML examples
- Update README.md, CLAUDE.md, and examples/getting-started/README.md
- Ensures documentation matches current config schema validation
* test: cleanup obsolete tests and add CLI test coverage
- Add validate_command_test.rs (19 tests) for CLI validate command
- Add init_output_test.rs (18 tests) for init output validation
- Rename test files to use _test.rs suffix convention
- Delete obsolete manual tests (grpc/, http/, sse-console/)
- Delete broken shell scripts referencing missing files
- Update tests/README.md with comprehensive documentation
- Fix config/server-docker.yaml to use current schema format
Total test count: 486 automated tests
---------
Signed-off-by: Agent of Reality <agentx@agentofreality.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent 9909926 commit 3debe1e
102 files changed
Lines changed: 10122 additions & 3198 deletions
File tree
- config
- examples
- configs
- 01-fundamentals
- 02-sources
- 03-reactions
- 04-query-patterns
- 05-advanced-features
- 06-real-world-scenarios
- basic-mock-source
- getting-started
- trading
- app/src/services
- server
- src
- api
- mappings/reactions
- models
- queries
- reactions
- sources
- config
- init
- tests
- grpc
- http
- integration/getting-started
- sse-console
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
121 | | - | |
| 120 | + | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
138 | | - | |
| 137 | + | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
143 | | - | |
| 142 | + | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
0 commit comments