ardatan / feTS

🗹 TypeScript HTTP Framework focusing on e2e type-safety, easy setup, performance & great developer experience
https://the-guild.dev/openapi/fets
MIT License
617 stars 28 forks source link

Object types being inferred as undefined #1807

Open BernardoSM opened 1 month ago

BernardoSM commented 1 month ago

Describe the bug

My openapi spec has an object type but on my fets client is showing only undefined.

To Reproduce Steps to reproduce the behavior:

Generate an openapi with this item and instantiate a fets client:

//...
"id_doc_front_file": {
    "type": [
      "object",
      "null"
    ],
    "properties": {
      "url": {
        "type": "string",
        "format": "uri",
        "example": "https://example.com/document.pdf"
      },
      "name": {
        "type": "string",
        "example": "File name.jpg"
      },
      "size": {
        "type": "number",
        "example": 123456
      }
    },
    "required": [
      "url",
      "name",
      "size"
    ]
  }
//... 

Expected behavior

It should be inferred as an object with three keys: url, name and size.

But is inferring as undefined:

CleanShot 2024-08-10 at 23 27 39

Environment:

ardatan commented 3 weeks ago

Are you sure if it is valid to have both object and null in type as an array because there is always properties there?