-
Notifications
You must be signed in to change notification settings - Fork 44
Update flows client classes to use MISSING defaults #1205
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
Conversation
I believe your core rule here is correct.
Because the following two JSON payloads are different: {"foo": null}
{}Relatedly, the following two python function calls are different: do_it(foo=None)
do_it()If we want to support a payload with How we determine which one we want to support hinges on how the underlying API behaves. Also, we can add I'm going to start looking over the PR itself in just a few, but it sounds to me like you're on the right track already in your thinking! |
sirosen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some specific changes I'd like to see. I've commented only on a couple of cases, but please scan the other client methods for FlowsClient in order to find the other ones which "match".
One comment is an open question; I'd like to talk about this with the full team on Monday, if possible, in order to figure out what our collective judgement is about what to do. Your code as-written might be our choice, but I'm trying to avoid assuming that it is or is not what we want.
sirosen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny final item. I'm re-scanning now to be sure but I think this is good to go!
sc-15807
Changes
Nonetoglobus_sdk.MISSINGfor all payload types in the flows client.Updated the base client’s request functions to allow theMissingTypeforquery_params.MISSINGdefaults instead ofNone.Flows OpenAPI spec for reference.
Thought process
When determining if a property's new type should keep or loose its none type, I tried generally to follow this rule:
If the property is both nullable AND a user provided explicit None value has a different behavior than not including the property in the payload, it should transform like so:
field: field_type | None = None->field: field_type | None | MissingType = MISSINGOtherwise, it should loose its none type and transform like so:
field: field_type | None = None->field: field_type | MissingType = MISSINGI'm not completely convinced that this is the correct way of thinking about this, so I would very much appreciate any feedback on this. Specifically, any potential cases where this logic breaks down would be useful to try and get a more concrete ruleset to apply to the other client classes.
📚 Documentation preview 📚: https://globus-sdk-python--1205.org.readthedocs.build/en/1205/