[question] How should the extension of core schema's be specified? #26
Replies: 4 comments
-
|
@devhelpr Here https://www.w3.org/TR/cooluris/#oldweb (just section 2, the other sections are typically semweb over-ambitious :-) ) explains how one URL can serve both HTML and technical specs (here RDF, but we would use JSON schema) |
Beta Was this translation helpful? Give feedback.
-
|
I've been reading the above and json-schema as well: If I understand correctly, then this might be closer: {
"schema_version": "0.1",
"nodes": [
{
"id": "shape:823f6164-79ef-47c5-9549-5dc12eb0d62b",
"schema": "@code-flow-canvas/node",
"schema_version": "0.1",
"x": 521.1098165923908,
"y": -210.65675806881544,
"properties": {
"width": 200.00003545442723,
"height": 112.00003403407696,
"@code-flow-canvas/node-properties": {
"type": "expression",
"formValues": {
"expression": "input",
"inputType": "number"
},
"taskType": "expression"
}
},
"fallback": "expression\ninput"
},
{
"id": "shape:56d448f5-bcd3-4958-b676-27a4e3f7d1da",
"schema": "@code-flow-canvas/node",
"schema_version": "0.1",
"x": 82.67665503888207,
"y": -201.84272012503598,
"properties": {
"width": 200.00003545442723,
"height": 112.00003403407696,
"@code-flow-canvas/node-properties": {
"type": "expression",
"formValues": {
"expression": "1",
"inputType": "number"
},
"taskType": "expression"
}
},
"fallback": "expression\n1"
},
{
"id": "connection:33e0e6be-3104-454e-b3a4-d5bcdc78e6d9",
"schema": "@code-flow-canvas/connection",
"schema_version": "0.1",
"x": 282.6766904933093,
"y": -145.8427031079975,
"properties": {
"width": 0,
"height": 0,
"@code-flow-canvas/node-properties": {},
"start": {
"connected_to": "shape:56d448f5-bcd3-4958-b676-27a4e3f7d1da",
"port_name": "output"
},
"end": {
"connected_to": "shape:823f6164-79ef-47c5-9549-5dc12eb0d62b",
"port_name": "input"
}
},
"fallback": "connection"
}
],
"relations": [],
"schemas": {
"@code-flow-canvas/node": {
"$schema": "https://www.canvasprotocol.org/schema/draft/2024-06/@ocwg/rectangle",
"$id": "https://demo.codeflowcanvas.io/schema/draft/2024-07/@code-flow-canvas/node",
"properties": {
"@code-flow-canvas/node-properties": {
"type": "object"
}
}
},
"@code-flow-canvas/connection": {
"$schema": "https://www.canvasprotocol.org/schema/draft/2024-06/@ocwg/arrow",
"$id": "https://demo.codeflowcanvas.io/schema/draft/2024-07/@code-flow-canvas/connection",
"properties": {
"@code-flow-canvas/node-properties": {
"type": "object"
},
"start": {
"type": "object",
"properties": {
"connected_to": {
"type": "string"
},
"port_name": {
"type": "string"
}
}
},
"end": {
"type": "object",
"properties": {
"connected_to": {
"type": "string"
},
"port_name": {
"type": "string"
}
}
}
}
}
}
}The schema's for @code-flow-canvas are placed inline, and specify from which schema these extend. The schema definitions should also be downloadable from the url's specified in $schema and $id. In the nodes themselves , currently "schema": "@code-flow-canvas/node" is used. But I wonder if this (and the schemas section) needs to be replaced with $ref and $defs (see https://json-schema.org/understanding-json-schema/structuring#dollarref ) ? |
Beta Was this translation helpful? Give feedback.
-
|
I've been thinking a bit more about this and about the input we've got from gtlf regarding extending OCWG, and got some more questions:
|
Beta Was this translation helpful? Give feedback.
-
|
Extensions are now well-defined. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I've made a very early export from codeflowcanvas.io to OCWG (currently just the nodes), and I wondered how the schemas section in the spec works?
See below a very simple export. this is just a single node which is exported and it uses a node schema @ocwg/code-flow-canvas-node which extends @ocwg/rectangle. How should that be specified in the schemas section?
I probably should have used a different schema for my node type, something like @codeflowcanvas/node
{ "schema_version": "0.1", "nodes": { "shape:8fac6770-b623-4d68-8d74-311bb2700b7e": { "id": "shape:8fac6770-b623-4d68-8d74-311bb2700b7e", "schema": "@ocwg/code-flow-canvas-node", "schema_version": "0.1", "x": 120.87079934103329, "y": -264.70281730767437, "properties": { "width": 199.99997425913452, "height": 111.99999198708119, "nodeInfo": { "type": "expression", "formValues": { "expression": "42", "inputType": "number" }, "taskType": "expression" } }, "fallback": "expression\n42" } }, "relations": {}, "schemas": { "@ocwg/code-flow-canvas-node": "@ocwg/rectangle" } }you can play around with this export here : demo.codeflowcanvas.io/ocwg .. please try on desktop and use one of the example flows from the dropdown on the rightside of the topmenu. The export appears on a floating div on the bottom right and is updated when making changes to the canvas.
Kind regards,
Maikel
Beta Was this translation helpful? Give feedback.
All reactions