Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APIv2 Versioning: apiLevel should be parsed for major.minor and should be required #4338

Closed
sfoster1 opened this issue Oct 30, 2019 · 0 comments · Fixed by #4358
Closed

APIv2 Versioning: apiLevel should be parsed for major.minor and should be required #4338

sfoster1 opened this issue Oct 30, 2019 · 0 comments · Fixed by #4358
Labels
api Affects the `api` project feature Ticket is a feature request / PR introduces a feature medium papi-v2 Python API V2

Comments

@sfoster1
Copy link
Member

overview

When we parse the contents of the apiLevel metadata key, we check for the exact strings 1 and 2. Instead, we should check for either 1 (to provide backwards compatibility with previously written protocols or 2.x. Leading zeroes do not need to be supported.

The version stored in a Protocol object should be an enum that provides both major and minor versions. Downstream consumers should also be updated to handle this enum.

If a version is not specified, there should be an exception.

Test cases:

should parse with api level 1.0:

metadata = {'apiLevel': '1'}
from opentrons import robot, instruments

should parse with api level 2.0:

metadata = {'apiLevel': '2.0'}

def run(ctx): pass

should parse with api level 2.5:

metadata = {'apiLevel': '2.5'}

def run(ctx): pass

should raise an exception explaining the correct format of the version:

metadata = {'apiLevel': '2.5.1'}

def run(ctx): pass
metadata = {'apiLevel': '2'}

def run(ctx): pass

should raise an exception requiring the presence of an api version:

def run(ctx): pass
@sfoster1 sfoster1 added feature Ticket is a feature request / PR introduces a feature api Affects the `api` project papi-v2 Python API V2 labels Oct 30, 2019
sfoster1 added a commit that referenced this issue Oct 31, 2019
This allows and requires apiv2 users to have

'apiLevel': '2.0'

in their metadata dict.

This is parsed and stored along with the protocol and passed along with RPC.
This allows specification of API minor versions.

Closes #4338
sfoster1 added a commit that referenced this issue Oct 31, 2019
This allows and requires apiv2 users to have

'apiLevel': '2.0'

in their metadata dict.

This is parsed and stored along with the protocol and passed along with RPC.
This allows specification of API minor versions.

Closes #4338
sfoster1 added a commit that referenced this issue Nov 6, 2019
…4358)

This allows and requires apiv2 users to have

'apiLevel': '2.0'

in their metadata dict.

This is parsed and stored along with the protocol and passed along with RPC.
This allows specification of API minor versions.

Closes #4338
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Affects the `api` project feature Ticket is a feature request / PR introduces a feature medium papi-v2 Python API V2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant