Skip to content

Wrong integer format in openapi spec for read only big integers #9642

Open
@poroh

Description

@poroh

Rest framework removes min_value and max_value kwargs for readonly fields:

'max_length', 'min_value', 'max_value', 'validators', 'queryset'

But drf-spectacluar uses these values to detect when format: int64 should be added:

Here it sets minimum and maximum by these values:
https://github.com/tfranzel/drf-spectacular/blob/5734744545bd0c4801c4c010d13edc77328fd412/drf_spectacular/openapi.py#L932

And here adds format if minimum or maximum are outside integer range:
https://github.com/tfranzel/drf-spectacular/blob/5734744545bd0c4801c4c010d13edc77328fd412/drf_spectacular/openapi.py#L846

I'm not sure how this should work. Writing to rest-framework because it first erases information about integer range.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions