clientele icon indicating copy to clipboard operation
clientele copied to clipboard

Add anyOf support in properties

Open pradishb opened this issue 4 months ago • 0 comments

Example openapi.json

{
  "openapi": "3.1.0",
  "info": {
    "title": "NinjaAPI",
    "version": "1.0.0",
    "description": ""
  },
  "paths": {},
  "components": {
    "schemas": {
      "Pet": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [],
        "title": "Pet",
        "type": "object"
      }
    }
  }
}

Output:

class Pet(pydantic.BaseModel):
    name: typing.Any

Expected output:

class Pet(pydantic.BaseModel):
    name: string | None

pradishb avatar Sep 25 '24 14:09 pradishb