Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

docs: Clarify semantics of multiple oneof variants passed to msg ctor#263

Merged
software-dov merged 1 commit intogoogleapis:masterfrom
software-dov:oneof-docs
Oct 11, 2021
Merged

docs: Clarify semantics of multiple oneof variants passed to msg ctor#263
software-dov merged 1 commit intogoogleapis:masterfrom
software-dov:oneof-docs

Conversation

@software-dov
Copy link
Copy Markdown
Contributor

Example:

import proto

class Song(proto.Message):
name = proto.Field(proto.STRING, number=1, oneof="identifier")
database_id = proto.Field(proto.STRING, number=2, oneof="identifier")

s = Song(name="Canon in D minor", database_id="b5a37aad3")
assert "database_id" in s and "name" not in s

s = Song(database_id="e6aa708c7e", name="Little Fugue")

Example:

import proto

class Song(proto.Message):
    name = proto.Field(proto.STRING, number=1, oneof="identifier")
    database_id = proto.Field(proto.STRING, number=2, oneof="identifier")

s = Song(name="Canon in D minor", database_id="b5a37aad3")
assert "database_id" in s and "name" not in s

s = Song(database_id="e6aa708c7e", name="Little Fugue")
@software-dov software-dov requested review from a team and busunkim96 October 11, 2021 17:31
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 11, 2021
@software-dov software-dov requested a review from atulep October 11, 2021 18:45
@software-dov software-dov merged commit 6f8a5b2 into googleapis:master Oct 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants