openapi-python-client icon indicating copy to clipboard operation
openapi-python-client copied to clipboard

"model_type" error when encountering "items": false

Open Ichmed opened this issue 10 months ago • 0 comments

Describe the bug According to the openapi 3.1 specification, tuples should be modeled using the "prefixItems" field with the "items" field being set to false (spec).

However this causes a "model_type" error as the generator expects the "items" field to be a dictionary.

OpenAPI Spec File

{
    "openapi": "3.1.0",
    "info": {
        "title": "foobar",
        "description": "",
        "license": {
            "name": ""
        },
        "version": "0.1.0"
    },
    "paths": {
        "/my/path": {
            "get": {
                "description": "foo",
                "operationId": "bar",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "array",
                                        "items": false,
                                        "prefixItems": [
                                            {
                                                "type": "string",
                                                "format": "date-time"
                                            },
                                            {}
                                        ]
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

Removing the "items": false causes the file to parse successfully.

Desktop (please complete the following information):

  • OS: Ubuntu 22.04.5 LTS
  • Python Version: 3.10.12
  • openapi-python-client version 0.24.1

Ichmed avatar Mar 19 '25 14:03 Ichmed