-
Notifications
You must be signed in to change notification settings - Fork 96
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
OpenAPI Client Generator generates classes that can't build for models with required readonly fields and inheritance #1208
Comments
@runenielsen Hi! Hm... I test your example app and can't reproduce the problem. with yor yaml file I have 2 classes and ExtendedBookInfo is correct: ...
/**
* ExtendedBookInfo
*/
@Serdeable
@JsonPropertyOrder(ExtendedBookInfo.JSON_PROPERTY_ISBN)
@Introspected
public class ExtendedBookInfo extends BookInfo {
public static final String JSON_PROPERTY_ISBN = "isbn";
@NotNull
@Pattern(regexp = "[0-9]{13}")
@Schema(name = "isbn", requiredMode = Schema.RequiredMode.REQUIRED)
@JsonProperty(JSON_PROPERTY_ISBN)
private String isbn;
public ExtendedBookInfo(String isbn, String name, String requiredReadOnly) {
super(name, requiredReadOnly);
this.isbn = isbn;
}
... |
@runenielsen Could you try to use latest micronaut-openapi version - 5.1.1 and also build from master ? |
@runenielsen Sorry, I didn't read it carefully. Yes, indeed, the problem is only in the client generator.... |
@altro3 : Thanks a lot 🙂 |
@altro3 : Do you know when Micronaut OpenAPI will be released again? Last release was 2 months ago, and my project needs your fixes 🙂 |
@runenielsen I just can ask about it. @graemerocher Could we release micronaut-openapi 5.2.0 or we need to wait micronaut-core 4.2.0 release? |
Expected Behavior
When the OpenAPI Client Generator generates classes for an OpenAPI definition with required readonly fields and inheritance, the generated classes should build.
Actual Behaviour
The super-class (
BookInfo
in my example below) is generated correctly, but the constructor in the sub-class (ExtendedBookInfo
) is generated incorrectly and makes the class unable to build. The required readonly parameterrequiredReadOnly
is not part of the constructor signature (which is correct), but it still tries to include it in the call to the super class' constructor.The problem only exists for generated client models and is related to the fix done in this issue.
Steps To Reproduce
https://github.com/runenielsen/readonlyconstructorbug.git
.ExtendedBookInfo
and see, that it is incorrect.readonlyconstructorbug.yml
for the OpenAPI definitions.Environment Information
OS: MacOS
JDK: Java 17
Example Application
https://github.com/runenielsen/readonlyconstructorbug.git
Version
4.1.0
The text was updated successfully, but these errors were encountered: