Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
veqryn opened this issue Sep 15, 2024 · 1 comment

Comments

@veqryn
Copy link

veqryn commented Sep 15, 2024

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

@ponelat
Copy link
Member

ponelat commented Sep 20, 2024

Thanks for the report @veqryn ! This is a low priority issue, and may not get attention from the core team any time soon, but a PR would be welcomed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants