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
Uploading a JSON Protocol that does not validate under its corresponding schema should cause the Robot Server to throw an error explaining why validation failed.
Overview
Right now, the APIv1 and APIv2 executors are more permissive than the JSON schema. IMO this is a Bad Thing because it permits protocol creators to make out-of-spec JSON protocols. If a superuser makes a tool that creates JSON protocols which are invalid under the schema, and a version of the executor runs them just fine (perhaps by implicitly casting numbers to strings or visa-versa, or having other coincidental fallbacks), that superuser probably won't even be aware that their protocol creator is making invalid protocols. When users who have happily used that tool upgrade their robot and go to execute their protocols, they may get errors or unexpected behaviors.
Strongly encouraging schema consistency is very important for interoperability across our platform: between our own projects, as well as with third-party projects which we often have limited knowledge about. The schema is intended to enforce a common language across all JSON protocol creators and consumers, and we should take the opportunity to enforce it on protocol execution.
Implementation notes
Looks like jsonschema is the go-to JSON schema implementation in Python
Here's what "corresponding schema" means: JSON Protocol Schemas will be versioned with a single integer, but V1 and V2 are ill-specified (my fault!). A JSON protocol file has information about the schema version that is was written to comply with:
V1 protocols have "protocol-schema": "1.0.0" (or at least ^1). The schema def only specifies it should be a string, and the description says: A version string for the Opentrons JSON Protocol schema being used. "<major>.<minor>.<patch>.
V3 protocols will drop the "protocol-schema" key and use whatever is agreed upon in Write new JSON schema for V3 #3110 (we shouldn't have to handle them in the context of this issue, until we're nearing a release of JSON Protocol V3 executor(s)). Future versions should follow this same convention.
The text was updated successfully, but these errors were encountered:
Acceptance Criteria
Overview
Right now, the APIv1 and APIv2 executors are more permissive than the JSON schema. IMO this is a Bad Thing because it permits protocol creators to make out-of-spec JSON protocols. If a superuser makes a tool that creates JSON protocols which are invalid under the schema, and a version of the executor runs them just fine (perhaps by implicitly casting numbers to strings or visa-versa, or having other coincidental fallbacks), that superuser probably won't even be aware that their protocol creator is making invalid protocols. When users who have happily used that tool upgrade their robot and go to execute their protocols, they may get errors or unexpected behaviors.
Strongly encouraging schema consistency is very important for interoperability across our platform: between our own projects, as well as with third-party projects which we often have limited knowledge about. The schema is intended to enforce a common language across all JSON protocol creators and consumers, and we should take the opportunity to enforce it on protocol execution.
Implementation notes
Looks like jsonschema is the go-to JSON schema implementation in Python
Here's what "corresponding schema" means: JSON Protocol Schemas will be versioned with a single integer, but V1 and V2 are ill-specified (my fault!). A JSON protocol file has information about the schema version that is was written to comply with:
"protocol-schema": "1.0.0"
(or at least^1
). The schema def only specifies it should be a string, and the description says:A version string for the Opentrons JSON Protocol schema being used. "<major>.<minor>.<patch>
.<major>.<minor>.<patch>
string."protocol-schema"
key and use whatever is agreed upon in Write new JSON schema for V3 #3110 (we shouldn't have to handle them in the context of this issue, until we're nearing a release of JSON Protocol V3 executor(s)). Future versions should follow this same convention.The text was updated successfully, but these errors were encountered: