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

Allow strings for group methods as an alternative to enums #691

Merged
merged 3 commits into from
Feb 27, 2023

Conversation

sirosen
Copy link
Member

@sirosen sirosen commented Feb 25, 2023

A variety of enums are published by the SDK for use with the Groups service. These cover GroupRole, etc and must be imported to use various methods in a type-safe way. Make all methods taking these enums more permissive by taking a Literal[...] as well. The literals are defined alongside the enums for easier consistency between the two.

A new type checking test validates these changes against relevant usages.

Tests which interact with these Groups API methods now are parametrized to pass enum members OR literal strings, variously. These must always serialize as strings before being sent.


Additionally, I started moving some of the fixture data into globus_sdk._testing to make it more available (and this makes tests marginally faster than the older method, which repeatedly reads data from disk).


📚 Documentation preview 📚: https://globus-sdk-python--691.org.readthedocs.build/en/691/

A variety of enums are published by the SDK for use with the Groups
service. These cover GroupRole, etc and must be imported to use
various methods in a type-safe way. Make all methods taking these
enums more permissive by taking a Literal[...] as well. The literals
are defined alongside the enums for easier consistency between the
two.

A new type checking test validates these changes against relevant
usages.

Tests which interact with these Groups API methods now are
parametrized to pass enum members OR literal strings, variously. These
must always serialize as strings before being sent.
@sirosen sirosen merged commit 4c1663a into globus:main Feb 27, 2023
@sirosen sirosen deleted the allow-strings-for-group-methods branch February 27, 2023 19:26
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