-
Notifications
You must be signed in to change notification settings - Fork 12
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
List typing fixes #287
List typing fixes #287
Conversation
workos/resources/list.py
Outdated
list_method: Callable = Field(exclude=True) | ||
list_args: ListArgs = Field(exclude=True) | ||
filter_params: FilterParams = Field(exclude=True) |
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 don't love passing in an entirely separate type for this, but guess what? Python type hinting doesn't support intersection between two TypedDict
s. This is why we can't have nice things.
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.
... actually, I wonder if all of the list resource params can inherit from ListArgs
and add their own specific params. I think that will work out better. Going to convert this back to drafe.
33a47e4
to
a956d3d
Compare
* Update ini to pick up more files * Remove runtime type checking for list types * Change approach to specifying list params * Fix after rebase * Formatting * Remove som unused imports and switch typed dict import to typing extensions
Description
Rather than check list params at runtime, just define static types. I had to refactor the list resource a bit to accomplish this, as I moved away from using a model for the args and just used a
TypedDict
Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.