-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(shared-data, app, protocol-designer, api-client, api, robot-serv…
…er): schemaV7 migration (#13007) closes RAUT-515 and RAUT-272 and RQA-1128 --------- Co-authored-by: TamarZanzouri <[email protected]>
- Loading branch information
1 parent
a87555f
commit 9f29c9d
Showing
136 changed files
with
20,928 additions
and
1,960 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
"""JSON file reading.""" | ||
from typing import Union | ||
|
||
from opentrons_shared_data.protocol.models.protocol_schema_v6 import ProtocolSchemaV6 | ||
from opentrons.protocol_reader import ProtocolSource | ||
from opentrons_shared_data.protocol.models.protocol_schema_v7 import ProtocolSchemaV7 | ||
from opentrons.protocol_reader import ProtocolSource, JsonProtocolConfig | ||
|
||
|
||
class JsonFileReader: | ||
"""Reads and parses JSON protocol files.""" | ||
|
||
@staticmethod | ||
def read(protocol_source: ProtocolSource) -> ProtocolSchemaV6: | ||
def read( | ||
protocol_source: ProtocolSource, | ||
) -> Union[ProtocolSchemaV6, ProtocolSchemaV7]: | ||
"""Read and parse file into a JsonProtocol model.""" | ||
return ProtocolSchemaV6.parse_file(protocol_source.main_file) | ||
if ( | ||
isinstance(protocol_source.config, JsonProtocolConfig) | ||
and protocol_source.config.schema_version == 6 | ||
): | ||
return ProtocolSchemaV6.parse_file(protocol_source.main_file) | ||
else: | ||
return ProtocolSchemaV7.parse_file(protocol_source.main_file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,7 +157,19 @@ class _ValidJsonProtocolSpec: | |
"spec", | ||
[ | ||
# Basic JSON protocols of various versions: | ||
# todo(mm, 2022-12-22): Add a v7 protocol when we support that in production. | ||
_ValidJsonProtocolSpec( | ||
file_name="foo.json", | ||
contents=load_shared_data("protocol/fixtures/7/simpleV7.json"), | ||
expected_schema_version=7, | ||
expected_robot_type="OT-2 Standard", | ||
expected_metadata={ | ||
"protocolName": "Simple test protocol", | ||
"author": "engineering <[email protected]>", | ||
"description": "A short test protocol", | ||
"created": 1223131231, | ||
"tags": ["unitTest"], | ||
}, | ||
), | ||
_ValidJsonProtocolSpec( | ||
file_name="foo.json", | ||
contents=load_shared_data("protocol/fixtures/6/simpleV6.json"), | ||
|
Oops, something went wrong.