
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
@eclipse-emfcloud/coffee-custom-validators-example
Advanced tools
Example custom validation plug-in for the Model Server.
This package provides an example of a validation provider plug-in for the Model Server.
It provides an implementation of a custom validation rule for the root Machine
in a Coffee model that randomly reports a warning condition.
See the parent readme for details of how to set up and build the project.
For detailed instructions how to run the example server configuration that includes this plug-in example, see the Example Server readme.
There are a variety of tools available for ad hoc REST interactions with services such as the Model Server. A recommended option is the Postman application.
Start by fetching the current state of the model.
Send a GET
request to
http://localhost:8082/api/v2/models?modeluri=SuperBrewer3000.coffee
The result should look something like this:
{
"type": "success",
"data": {
"$type": "http://www.eclipsesource.com/modelserver/example/coffeemodel#//Machine",
"$id": "/",
"children": [
{
"$type": "http://www.eclipsesource.com/modelserver/example/coffeemodel#//BrewingUnit",
"$id": "//@children.0"
},
{
"$type": "http://www.eclipsesource.com/modelserver/example/coffeemodel#//ControlUnit",
"$id": "//@children.1",
"processor": {
"$id": "//@children.1/@processor",
"clockSpeed": 5,
"numberOfCores": 10,
"socketconnectorType": "Z51",
"thermalDesignPower": 100
},
"display": {
"$id": "//@children.1/@display",
"width": 10,
"height": 20
}
}
],
"name": "Super Brewer 3000",
"workflows": [
// ... workflow model here ...
]
}
}
Now send a validation request to check the model against its intrinsic rules and also the custom validation rule provided by the example plug-in.
Send a GET
request to
http://localhost:8082/api/v2/validation?modeluri=SuperBrewer3000.coffee
No body content is required.
The response may include a warning like the following:
{
"severity": 2,
"source": "@eclipse-emfcloud/coffee-custom-validators-example",
"code": 1,
"message": "This is a randomly occurring example diagnostic.",
"data": [0.7710443792767079],
"children": [],
"id": "//@children.1"
}
in which the data is a random number between 0 and 1 that decided whether to report the warning.
This plug-in provider is included in live model validation, also. So if there are any clients subscribed for live validation updates (which also may be accomplished via testing tools like Postman) then executing commands as described in the command providers example should sometimes include this example warning diagnostic in the validation broadcasts.
FAQs
Example custom validation plug-in for the Model Server.
We found that @eclipse-emfcloud/coffee-custom-validators-example demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.