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

Update Field constructor kwargs-only parameters #491

Merged
merged 12 commits into from
Oct 18, 2023

Conversation

intgr
Copy link
Contributor

@intgr intgr commented Oct 18, 2023

I have made things!

The number of allowed positional parameters of Field class constructors was significantly reduced by DRF upstream, but some remain regardless.

Also correctly reordered arguments where positional args are allowed.

Related issues

The number of allowed positional parameters was significantly reduced by DRF upstream, but some remain regardless.
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

I think we need a stubtest for this :(

@intgr
Copy link
Contributor Author

intgr commented Oct 18, 2023

Agreed, stubtest would help for sure and it's on my radar. I've assigned #434 to myself.

@intgr
Copy link
Contributor Author

intgr commented Oct 18, 2023

Marking as draft until #493 is merged.

@intgr intgr marked this pull request as draft October 18, 2023 12:23
@sobolevn sobolevn marked this pull request as ready for review October 18, 2023 14:54
@intgr
Copy link
Contributor Author

intgr commented Oct 18, 2023

Updated this PR.

Comment on lines 51 to 52
rest_framework.fields.Field.__init__
rest_framework.fields.FilePathField.__init__
Copy link
Contributor Author

@intgr intgr Oct 18, 2023

Choose a reason for hiding this comment

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

Note: some XxxField.__init__ methods remain because our argument types aren't precise. But I'd rather fix that separately.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

stubtest gives a lot of confidence! Thanks!

@intgr intgr merged commit 133e572 into typeddjango:master Oct 18, 2023
11 checks passed
@intgr intgr deleted the Field-kwargs-only-parameters branch October 18, 2023 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

update serializers Field arguments to be named-only
2 participants