#2147: implement dynamic wotValidationConfig endpoints#2179
Merged
thjaeckle merged 14 commits intoeclipse-ditto:masterfrom Jun 20, 2025
Merged
#2147: implement dynamic wotValidationConfig endpoints#2179thjaeckle merged 14 commits intoeclipse-ditto:masterfrom
thjaeckle merged 14 commits intoeclipse-ditto:masterfrom
Conversation
88a54d1 to
c3c30b5
Compare
thjaeckle
requested changes
Jun 2, 2025
...l/src/main/java/org/eclipse/ditto/things/model/devops/events/WotValidationConfigCreated.java
Outdated
Show resolved
Hide resolved
...l/src/main/java/org/eclipse/ditto/things/model/devops/events/WotValidationConfigCreated.java
Outdated
Show resolved
Hide resolved
...l/src/main/java/org/eclipse/ditto/things/model/devops/events/WotValidationConfigCreated.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/eclipse/ditto/things/model/devops/events/WotValidationConfigModified.java
Show resolved
Hide resolved
...main/java/org/eclipse/ditto/things/model/devops/events/AbstractWotValidationConfigEvent.java
Show resolved
Hide resolved
...rvice/persistence/actors/strategies/commands/AbstractWotValidationConfigCommandStrategy.java
Outdated
Show resolved
Hide resolved
wot/api/src/main/java/org/eclipse/ditto/wot/api/validator/DefaultWotThingModelValidator.java
Outdated
Show resolved
Hide resolved
wot/api/src/main/java/org/eclipse/ditto/wot/api/validator/DefaultWotThingModelValidator.java
Outdated
Show resolved
Hide resolved
wot/integration/src/main/java/org/eclipse/ditto/wot/integration/DittoWotIntegration.java
Outdated
Show resolved
Hide resolved
wot/validation/src/main/java/org/eclipse/ditto/wot/validation/config/TmValidationConfig.java
Outdated
Show resolved
Hide resolved
thjaeckle
reviewed
Jun 3, 2025
...main/java/org/eclipse/ditto/things/model/devops/exceptions/WotValidationConfigException.java
Outdated
Show resolved
Hide resolved
thjaeckle
reviewed
Jun 3, 2025
...main/java/org/eclipse/ditto/things/model/devops/exceptions/WotValidationConfigException.java
Outdated
Show resolved
Hide resolved
7865d63 to
18a09dd
Compare
18a09dd to
f8da4b5
Compare
8c37fe6 to
89f26d2
Compare
* javadocs, @nullable use, appendPayload use of predicate, hashCode/equals/toString, formatting
thjaeckle
reviewed
Jun 17, 2025
documentation/src/main/resources/pages/ditto/basic-wot-validation-config.md
Outdated
Show resolved
Hide resolved
Member
|
@hu-ahmed thanks for providing the documentation, looks good. Just 2 things:
|
* equals/hashCode/toString * logging
thjaeckle
approved these changes
Jun 20, 2025
Member
thjaeckle
left a comment
There was a problem hiding this comment.
@hu-ahmed thanks a lot for this great addition
I left some minor review commits, cleaning up the codebase a little to be more "Ditto like".
Functionality-wise it works well 👍
System tests also passed - so this is good to be merged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #2147
Purpose
This PR implements dynamic WoT (Web of Things) validation configuration endpoints for Ditto, enabling runtime CRUD operations for validation settings via a new DevOps REST API. This allows for flexible, real-time updates to validation rules, especially useful during model migrations or deployment transitions, without requiring service restarts.
Key Features
All endpoints are under /devops/wot/config:
GET /devops/wot/config
List all dynamic validation configs (by scope).
GET /devops/wot/config/{scopeId}
Retrieve a specific dynamic validation config section.
PUT /devops/wot/config/{scopeId}
Create or replace a dynamic validation config section.
PATCH /devops/wot/config/{scopeId}
Partially update a dynamic validation config section.
DELETE /devops/wot/config/{scopeId}
Delete a dynamic validation config section.
GET /devops/wot/config/merged
Retrieve the merged (static + dynamic) effective validation config.
MongoDB is used for persistent storage of dynamic validation configs.
Pekko Distributed Data (DData) is used to distribute dynamic config state across all Ditto instances in the cluster.
When a config is updated via the API:
The change is persisted to MongoDB.
DData is updated, which automatically synchronizes the new state across all nodes.
All Ditto instances immediately see the latest config, ensuring strong consistency and real-time updates.
On startup, each instance loads the static config from things.conf.
Dynamic configs are loaded from MongoDB and distributed via DData.
The effective validation config is computed by merging static and dynamic configs, with dynamic overrides taking precedence for their scopes.
Benefits
Real-time, cluster-wide updates: Instantly change validation rules across all Ditto instances, with no restarts required.
Safe migrations: Temporarily relax or tighten validation for specific models or scopes.
Consistent distributed state: DData ensures all nodes have the latest config, with no manual cache management.
Separation of static and dynamic: Static config remains as a fallback; dynamic config is layered on top.