Skip to content

[BUG] defaultToEmptyContainer not working with Maven plugin #21505

@jpfinne

Description

@jpfinne

Bug Report Checklist

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

#21269 introduces a new global additionalProperty: defaultToEmptyContainer

Unfortunately it only works when using additionalProperties.
It does not work with configOptions in maven. The plugin requires cliOptions. See

openapi-generator version

7.14.0

Steps to reproduce

Configure maven

<configOptions>
        <defaultToEmptyContainer>array|undefined</defaultToEmptyContainer>
</configOptions>
Related issues/PRs

#21269

Suggest a fix

Add cliOptions to the supported generators (maybe all by default?)

cliOptions.add(CliOption.newString(DEFAULT_TO_EMPTY_CONTAINER, "description..."));

Update CodeGenMojo to put all configOptions to additionalProperties:

    if (configOptions != null) {
        for (Map.Entry<?, ?> configOptionsEntry : configOptions.entrySet()) {
            input.getConfig().additionalProperties().put(configOptionsEntry.getKey().toString(), configOptionsEntry.getValue());
        }
    }

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