Skip to content

[BUG][Dart-Dio] - Default value for enums is broken #22120

@bw-flagship

Description

@bw-flagship

Bug Report Checklist

  • [ x ] Have you provided a full/minimal spec to reproduce the issue?
  • [ x ] Have you validated the input using an OpenAPI validator?
  • [ x ] Have you tested with the latest master to confirm the issue still exists?
  • [ x ] Have you searched for related issues/PRs?
  • [ x ] What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

The generated dart code is invalid when enums have a default value.

openapi-generator version

Using 7.16, it worked in 7.13, I think it was a regression with pr #21355

OpenAPI declaration file content or url
{
    "openapi": "3.1.0",
    "info": {
        "title": "Simple",
        "version": "0.0.1"
    },
    "paths": {},
    "components": {
        "schemas": {
            "TestItem": {
                "properties": {
                    "productTypeSetting": {
                        "default": "physical",
                        "enum": [
                            "physical",
                            "service",
                            "perProduct"
                        ],
                        "type": "string"
                    }
                },
                "type": "object",
                "title": "TestItem"
            }
        }
    },
    "tags": []
}
Generation Details

Simple command:
openapi-generator generate -i openapi.json -g dart-dio

Steps to reproduce

Run the generation command

Related issues/PRs

#21355

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions