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

Stop using 0 for params and match fields ids #417

Merged
merged 1 commit into from
Mar 31, 2017

Conversation

antoninbas
Copy link
Member

It has been decided to stop using 0 in ids for action parameters and
table match fields. This is because in protobuf 3, 0 is the default
value for integers and there is an ambiguity between an id that has been
set to 0 and an id that wasn't set. Additionally this is more
consistent with the way ids used to be allocated (0 was used exclusively
as an invalid id).

It has been decided to stop using 0 in ids for action parameters and
table match fields. This is because in protobuf 3, 0 is the default
value for integers and there is an ambiguity between an id that has been
set to 0 and an id that wasn't set. Additionally this is more
consistent with the way ids used to be allocated (0 was used exclusively
as an invalid id).
Copy link
Contributor

@sethfowler sethfowler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I had noticed that ambiguity too. It made the JSON representation of the API a lot uglier. This is a nice change!

@antoninbas
Copy link
Member Author

@sethfowler when we support programmer-provided ids for action parameters and match fields, we should still exclude 0 I think.

@sethfowler
Copy link
Contributor

Yeah, I agree. We can make that an error.

@antoninbas antoninbas merged commit d7e3c9c into master Mar 31, 2017
@antoninbas antoninbas deleted the p4runtime-dont-use-0-as-id branch March 31, 2017 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants