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
Validation tool is not validating the ‘datatype’ and ‘unit’ keys in the JSON-Schema.
The JSON-Schema must accommodate two different type related keys, one is ‘datatype’ that is inherited from ECLASS for XSD types, and one is ‘type’ for UI usage that might contain types like ‘string’, ‘array’, 'number', etc. The JSON-Schema must also accommodate ‘unit’ key for some properties to use in UI.
Hence, we need to include ‘datatype’ and ‘unit’ in validation process.
Example JSON-Schema:
{
"$schema": "http://json-schema.org/schema#",
"$id": "https://industry-fusion.org/eclass%230173-1%2301-AKJ975%23017",
"title": "Plasma Cutter POC",
"description": "Plasma Cutter template for IFF",
"type": "object",
"properties": {
"eclass:0173-1#02-AAH841#003": {
"type": "number",
"datatype": "xsd:double",
"title": "max. center cut",
"description": "maximum spacial expansion of the centre cut",
"unit": "mm"
}
}
}
Issue 2:
Validation tool is validating unknown fields.
Expected:
Field doesn’t exist in the schema.
Actual:
The data is getting validated successfully.
Example JSON-Schema:
{
"$schema": "http://json-schema.org/schema#",
"$id": "https://industry-fusion.org/eclass%230173-1%2301-AKJ975%23017",
"title": "Plasma Cutter POC",
"description": "Plasma Cutter template for IFF",
"type": "object",
"properties": {
"machine_state": {
"type": "string",
"title": "Machine Status",
"description": "Current status of the machine (Online_Idle, Run, Online_Error, Online_Maintenance, Setup, Testing)",
"readOnly": false
},
"eclass:0173-1#02-AAH841#003": {
"type": "number",
"datatype": "xs:double",
"title": "max. center cut",
"description": "maximum spacial expansion of the centre cut",
"unit": "mm"
}
}
first part: @LahariMIBS this can be solved by adding both field names to the addedKeywords array in validate.js. Please create a PR for it, in the PR please add the example in the examples directory and add one example to tests/validation directory for script tests.
second part: This needs a little bit more considerations. JSON-LD is also adding fields which must be ignored by the schema (e.g the "@context" field in your example. When we validate that strict, we can run into other problems.
Issue 1:
Validation tool is not validating the ‘datatype’ and ‘unit’ keys in the JSON-Schema.
The JSON-Schema must accommodate two different type related keys, one is ‘datatype’ that is inherited from ECLASS for XSD types, and one is ‘type’ for UI usage that might contain types like ‘string’, ‘array’, 'number', etc. The JSON-Schema must also accommodate ‘unit’ key for some properties to use in UI.
Hence, we need to include ‘datatype’ and ‘unit’ in validation process.
Example JSON-Schema:
Issue 2:
Validation tool is validating unknown fields.
Expected:
Field doesn’t exist in the schema.
Actual:
The data is getting validated successfully.
Example JSON-Schema:
Example JSON-LD Data:
The text was updated successfully, but these errors were encountered: