MarcoMuellner / openapi-python-generator

A client generator from openapi for python.
MIT License
56 stars 25 forks source link

"Error in model ...: unexpected indent" when an enum contains an empty string #71

Open jstasiak opened 5 months ago

jstasiak commented 5 months ago

Describe the bug The code generator crashes.

To Reproduce Steps to reproduce the behavior:

Run

openapi-python-generator mini.json output

using the following OpenAPI schema (in JSON form, mini.json):

{
    "openapi": "3.0.1",
    "info": {
        "version": "1.0",
        "title": "Title"
    },
    "components": {
        "schemas": {
            "Registry": {
                "type": "string",
                "enum": [
                    "A",
                    "B",
                    ""
                ]
            }
        }
    }
}

The application produces an error:

Generating data from mini.json
Error in model Registry: unexpected indent (<string>, line 7)

Expected behavior I expected code to be generated.

Screenshots N/A

Desktop (please complete the following information):

% python --version
Python 3.12.3
% pip freeze | grep openapi-python-generator
openapi-python-generator==0.5.0

Smartphone (please complete the following information): N/A

Additional context N/A