Skip to content

Conversion from v2 to v3 incorrectly changes additionalProperties: {} into additionalProperties: type: object #12468

@veqryn

Description

@veqryn
Description

I have an OpenAPI v2 yaml that is being converted to v3 by swagger-codegen-cli, and it ends up changing the behavior of my models from allowing any freeform additional properties of any type, to only allowing properties of type object.

Swagger-codegen version

3.0.61

Swagger declaration file content or url

My openapi v2 yaml includes:

  protobufAny:
    type: object
    properties:
      '@type':
        type: string
    additionalProperties: {}

This is converted by swagger-codegen-api into this yaml:

    protobufAny:
      type: object
      properties:
        '@type':
          type: string
      additionalProperties:
        type: object
Command line used for generation

swagger-codegen-cli generate -i ./openapiv2/gen/awesome.swagger.yaml -l openapi-yaml -o ./openapiv3/gen/

Steps to reproduce

See above

Related issues/PRs

N/A

Suggest a fix/enhancement

This v2 yaml should convert to additionalProperties: {} or additionalProperties: true

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