Skip to content

Conversation

@HoodyH
Copy link

@HoodyH HoodyH commented Sep 5, 2025

Fixing Bigint coerce to string missing

Creates a new type BigIntegerField to map django.models.BigIntegerField and solve the problem

Fix #9733

Copy link
Collaborator

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

looks good

@HoodyH
Copy link
Author

HoodyH commented Sep 22, 2025

Any news?

@auvipy auvipy added this to the 3.17 milestone Sep 22, 2025
- typo fix
- value test fix
- import order fix
@auvipy auvipy requested a review from Copilot November 11, 2025 07:22
Copilot finished reviewing on behalf of auvipy November 11, 2025 07:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new BigIntegerField serializer field to properly handle Django's BigIntegerField and BigAutoField model fields, addressing issue #9733. Previously, these fields were incorrectly mapped to the standard IntegerField serializer.

Key Changes:

  • Introduces BigIntegerField class that extends IntegerField with optional string coercion for large integers
  • Adds COERCE_BIGINT_TO_STRING setting (default: False) to control output format
  • Updates model field mappings to use BigIntegerField for BigIntegerField and BigAutoField

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
rest_framework/fields.py Implements new BigIntegerField class with coerce_to_string parameter and custom error messages
rest_framework/serializers.py Imports BigIntegerField and updates serializer_field_mapping to map Django's BigIntegerField and BigAutoField to the new field type
rest_framework/settings.py Adds COERCE_BIGINT_TO_STRING configuration setting with default value of False
docs/api-guide/fields.md Documents the new BigIntegerField with its signature and parameters
docs/api-guide/settings.md Documents the COERCE_BIGINT_TO_STRING setting and its behavior
tests/test_fields.py Adds comprehensive test cases for BigIntegerField including validation, min/max constraints, and string coercion
tests/test_model_serializer.py Updates expected serializer representation test to expect BigIntegerField instead of IntegerField

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

auvipy and others added 3 commits November 11, 2025 13:34
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

Bigint coerce to string missing

3 participants