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

number should be rendered as type float, not int #40

Open
pradishb opened this issue Sep 25, 2024 · 0 comments
Open

number should be rendered as type float, not int #40

pradishb opened this issue Sep 25, 2024 · 0 comments

Comments

@pradishb
Copy link
Contributor

Django-ninja sets the type of float data type as number in openapi and clientene renders number as int which causes pydantic validation error.

openapi.json

{
  "openapi": "3.1.0",
  "info": {
    "title": "NinjaAPI",
    "version": "1.0.0",
    "description": ""
  },
  "paths": {},
  "components": {
    "schemas": {
      "Pet": {
        "properties": {
          "age": {
            "type": "number"
          }
        },
        "required": [],
        "title": "Pet",
        "type": "object"
      }
    }
  }
}

Output:

class Pet(pydantic.BaseModel):
    age: int

Expected:

class Pet(pydantic.BaseModel):
    age: float
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

No branches or pull requests

1 participant