Skip to content

Commit f2e4161

Browse files
committed
Consolidate the buffer information into a single object, and add a new encoding attribute
We initially have the ‘hex’ and ‘base64’ encodings. We unpublished the 0.2.0 package so we could replace version 2 of the spec with these updates, so we bump the package number to 0.3.0.
1 parent ad04dc9 commit f2e4161

File tree

2 files changed

+32
-20
lines changed

2 files changed

+32
-20
lines changed

jupyter-widgets-schema/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jupyter-widgets-schema",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "Schemas for the Jupyter interactive Widgets",
55
"main": "index.js",
66
"scripts": {

jupyter-widgets-schema/v2/state.schema.json

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"type": "number"
1515
},
1616
"state": {
17-
"description": "Model State for All Widget Models",
17+
"description": "Model State for All Widget Models - keys are model ids, values are model state",
1818
"type": "object",
1919
"additionalProperties" : {
2020
"type": "object",
@@ -35,25 +35,37 @@
3535
"description" : "Serialized state of the model",
3636
"type": "object"
3737
},
38-
"buffer_paths": {
39-
"description" : "Array of paths in the state for the corresponding buffers",
40-
"type": "array",
41-
"items": {
42-
"description": "A path for a binary buffer value.",
43-
"type": "array",
44-
"items": {
45-
"description": "An object key or array index",
46-
"anyOf": [{"type": "string"}, {"type": "number"}]
47-
}
48-
}
49-
},
5038
"buffers": {
51-
"description" : "Array of base64-encoded binary buffers",
52-
"type": "array",
53-
"items": {
54-
"description": "A base64-encoded binary buffer",
55-
"type": "string"
56-
}
39+
"description": "Binary buffers in the state",
40+
"type": "object",
41+
"properties": {
42+
"paths": {
43+
"description" : "Array of paths in the state for the corresponding buffers",
44+
"type": "array",
45+
"items": {
46+
"description": "A path for a binary buffer value.",
47+
"type": "array",
48+
"items": {
49+
"description": "An object key or array index",
50+
"type": ["string", "number"]
51+
}
52+
}
53+
},
54+
"data": {
55+
"description" : "Array of encoded binary buffers, encoded as specified in the 'encoding' property",
56+
"type": "array"
57+
},
58+
"encoding": {
59+
"description": "The encoding of each item in the data property",
60+
"type": "string",
61+
"oneOf": [
62+
{"enum": ["hex"], "description": "Base 16 encoding, as specified in RFC 4648, section 8 (https://tools.ietf.org/html/rfc4648#section-8)"},
63+
{"enum": ["base64"], "description": "Base 64 encoding, as specified in RFC 4648, section 4 (https://tools.ietf.org/html/rfc4648#section-4)"}
64+
65+
]
66+
}
67+
},
68+
"required": ["paths", "data", "encoding"]
5769
}
5870
},
5971
"required": [ "model_name", "model_module", "state" ]

0 commit comments

Comments
 (0)