Skip to content

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

@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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy