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

[BUG] [JAVA] [Micronaut] - Using inheritance results in superclass having all fields from subclasses #19037

Open
5 of 6 tasks
KangoV opened this issue Jun 30, 2024 · 2 comments · Fixed by micronaut-projects/micronaut-openapi#1732

Comments

@KangoV
Copy link

KangoV commented Jun 30, 2024

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • 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

When using inheritance (discriminator), the generated subclasses gains fields in their constructors for other subclasses fields. Also, the superclass, gets all the fields of all the subclasses combined. Some getters are also duplicated resulting in compile errors.

It seems all the fields are merged together.

openapi-generator version

6.11.0

OpenAPI declaration file content or url

https://gist.github.com/KangoV/ad36a85420f7c8187a208e09fe9d4242

Generation Details

Using Micronaut Gradle plugin:

    openapi {
        version = "6.11.0"
        server(file(layout.buildDirectory.file("tmp/$specFile"))) {
            apiPackageName = basePackage + ".api"
            modelPackageName = basePackage + ".api.model"
            useOptional = true
            useReactive = false
        }
    }

Generates the superclass/subclass:

https://gist.github.com/KangoV/8a62886376207e281e8b0fedd008a24d

@altro3
Copy link

altro3 commented Aug 25, 2024

@KangoV could you move it to right repo? Here: https://github.com/micronaut-projects/micronaut-openapi

@altro3
Copy link

altro3 commented Aug 26, 2024

@KangoV fixed it here: micronaut-projects/micronaut-openapi#1732

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

Successfully merging a pull request may close this issue.

2 participants