Skip to content

[BUG] JavaClient Generator with feign library does not handle inherited required and readonly attributes correctly #15190

@LupusMKW

Description

@LupusMKW

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

See attached yaml file. When generating with
<generatorName>java</generatorName>
<configOptions>
<interfaceOnly>true</interfaceOnly>
<delegatePattern>true</delegatePattern>
<openApiNullable>false</openApiNullable>
<useBeanValidation>true</useBeanValidation>
<library>feign</library>
</configOptions>

The class SecondDerivation contains a constructor that tries to set the fields id and href which are actually in class FirstDerivation. Since the fields are private this can not work.

openapi-generator version

Version 6.5

OpenAPI declaration file content or url

Yaml file attached.

Generation Details
Steps to reproduce

Generate a model from the yaml with the above options.

Related issues/PRs

This issue shows a very similar, or maybe even the same problem:

#13253

Suggest a fix

The Spring generator implements the postProcessAllModels method and handles this perfectly by calling the constructor of the base class instead of trying to set the variables. As a temporary fix I changed the pojo.mustache of the Java generator in my project, but I am not sure this fixes all problems.

simpleAPI.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions