You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the client openapi generator creates the model for that schema it generates the code but ALL of the getters return NULL which the actual values are really stored in the parent MAP.
Here is the code generated for the HttpProblem.
importcom.fasterxml.jackson.annotation.JsonInclude;
importcom.fasterxml.jackson.annotation.JsonProperty;
importcom.fasterxml.jackson.annotation.JsonCreator;
importcom.fasterxml.jackson.annotation.JsonTypeName;
importcom.fasterxml.jackson.annotation.JsonValue;
importjava.net.URI;
importjava.util.HashMap;
importjava.util.Map;
importcom.fasterxml.jackson.annotation.JsonIgnoreProperties;
importcom.fasterxml.jackson.annotation.JsonProperty;
/** * HTTP Problem Response according to RFC9457 & RFC7807 **/@com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true)
publicclassHttpProblemextendsHashMap<String, Object> {
/** * A optional URI reference that identifies the problem type **/privateURItype;
/** * A optional, short, human-readable summary of the problem type **/privateStringtitle;
/** * The HTTP status code for this occurrence of the problem **/privateIntegerstatus;
/** * A optional human-readable explanation specific to this occurrence of the problem **/privateStringdetail;
/** * A URI reference that identifies the specific occurrence of the problem **/privateURIinstance;
/** * A optional URI reference that identifies the problem type * @return type **/@JsonProperty("type")
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
publicURIgetType() {
returntype;
}
/** * Set type **/publicvoidsetType(URItype) {
this.type = type;
}
publicHttpProblemtype(URItype) {
this.type = type;
returnthis;
}
/** * A optional, short, human-readable summary of the problem type * @return title **/@JsonProperty("title")
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
publicStringgetTitle() {
returntitle;
}
/** * Set title **/publicvoidsetTitle(Stringtitle) {
this.title = title;
}
publicHttpProblemtitle(Stringtitle) {
this.title = title;
returnthis;
}
/** * The HTTP status code for this occurrence of the problem * @return status **/@JsonProperty("status")
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
publicIntegergetStatus() {
returnstatus;
}
/** * Set status **/publicvoidsetStatus(Integerstatus) {
this.status = status;
}
publicHttpProblemstatus(Integerstatus) {
this.status = status;
returnthis;
}
/** * A optional human-readable explanation specific to this occurrence of the problem * @return detail **/@JsonProperty("detail")
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
publicStringgetDetail() {
returndetail;
}
/** * Set detail **/publicvoidsetDetail(Stringdetail) {
this.detail = detail;
}
publicHttpProblemdetail(Stringdetail) {
this.detail = detail;
returnthis;
}
/** * A URI reference that identifies the specific occurrence of the problem * @return instance **/@JsonProperty("instance")
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
publicURIgetInstance() {
returninstance;
}
/** * Set instance **/publicvoidsetInstance(URIinstance) {
this.instance = instance;
}
publicHttpProbleminstance(URIinstance) {
this.instance = instance;
returnthis;
}
/** * Create a string representation of this pojo. **/@OverridepublicStringtoString() {
StringBuildersb = newStringBuilder();
sb.append("class HttpProblem {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" title: ").append(toIndentedString(title)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" detail: ").append(toIndentedString(detail)).append("\n");
sb.append(" instance: ").append(toIndentedString(instance)).append("\n");
sb.append("}");
returnsb.toString();
}
/** * Compares this object to the specified object. The result is * {@code true} if and only if the argument is not * {@code null} and is a {@code HttpProblem} object that * contains the same values as this object. * * @param obj the object to compare with. * @return {@code true} if the objects are the same; * {@code false} otherwise. **/@Overridepublicbooleanequals(Objectobj) {
if (this == obj) returntrue;
if (obj == null || getClass() != obj.getClass()) returnfalse;
HttpProblemmodel = (HttpProblem) obj;
returnjava.util.Objects.equals(type, model.type) &&
java.util.Objects.equals(title, model.title) &&
java.util.Objects.equals(status, model.status) &&
java.util.Objects.equals(detail, model.detail) &&
java.util.Objects.equals(instance, model.instance);
}
/** * Returns a hash code for a {@code HttpProblem}. * * @return a hash code value for a {@code HttpProblem}. **/@OverridepublicinthashCode() {
returnjava.util.Objects.hash(type,
title,
status,
detail,
instance);
}
/** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */privatestaticStringtoIndentedString(Objecto) {
if (o == null) {
return"null";
}
returno.toString().replace("\n", "\n ");
}
/** * HTTP Problem Response according to RFC9457 & RFC7807 **/@com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true)
publicstaticclassHttpProblemQueryParamextendsHashMap<String, Object> {
/** * HTTP Problem Response according to RFC9457 & RFC7807 **/@jakarta.ws.rs.QueryParam("type")
privateURItype;
/** * HTTP Problem Response according to RFC9457 & RFC7807 **/@jakarta.ws.rs.QueryParam("title")
privateStringtitle;
/** * HTTP Problem Response according to RFC9457 & RFC7807 **/@jakarta.ws.rs.QueryParam("status")
privateIntegerstatus;
/** * HTTP Problem Response according to RFC9457 & RFC7807 **/@jakarta.ws.rs.QueryParam("detail")
privateStringdetail;
/** * HTTP Problem Response according to RFC9457 & RFC7807 **/@jakarta.ws.rs.QueryParam("instance")
privateURIinstance;
/** * A optional URI reference that identifies the problem type * @return type **/@com.fasterxml.jackson.annotation.JsonProperty("type")
publicURIgetType() {
returntype;
}
/** * Set type **/publicvoidsetType(URItype) {
this.type = type;
}
publicHttpProblemQueryParamtype(URItype) {
this.type = type;
returnthis;
}
/** * A optional, short, human-readable summary of the problem type * @return title **/@com.fasterxml.jackson.annotation.JsonProperty("title")
publicStringgetTitle() {
returntitle;
}
/** * Set title **/publicvoidsetTitle(Stringtitle) {
this.title = title;
}
publicHttpProblemQueryParamtitle(Stringtitle) {
this.title = title;
returnthis;
}
/** * The HTTP status code for this occurrence of the problem * @return status **/@com.fasterxml.jackson.annotation.JsonProperty("status")
publicIntegergetStatus() {
returnstatus;
}
/** * Set status **/publicvoidsetStatus(Integerstatus) {
this.status = status;
}
publicHttpProblemQueryParamstatus(Integerstatus) {
this.status = status;
returnthis;
}
/** * A optional human-readable explanation specific to this occurrence of the problem * @return detail **/@com.fasterxml.jackson.annotation.JsonProperty("detail")
publicStringgetDetail() {
returndetail;
}
/** * Set detail **/publicvoidsetDetail(Stringdetail) {
this.detail = detail;
}
publicHttpProblemQueryParamdetail(Stringdetail) {
this.detail = detail;
returnthis;
}
/** * A URI reference that identifies the specific occurrence of the problem * @return instance **/@com.fasterxml.jackson.annotation.JsonProperty("instance")
publicURIgetInstance() {
returninstance;
}
/** * Set instance **/publicvoidsetInstance(URIinstance) {
this.instance = instance;
}
publicHttpProblemQueryParaminstance(URIinstance) {
this.instance = instance;
returnthis;
}
/** * Create a string representation of this pojo. **/@OverridepublicStringtoString() {
StringBuildersb = newStringBuilder();
sb.append("class HttpProblemQueryParam {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" title: ").append(toIndentedString(title)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" detail: ").append(toIndentedString(detail)).append("\n");
sb.append(" instance: ").append(toIndentedString(instance)).append("\n");
sb.append("}");
returnsb.toString();
}
/** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */privatestaticStringtoIndentedString(Objecto) {
if (o == null) {
return"null";
}
returno.toString().replace("\n", "\n ");
}
}}
When I print out the model returned from the Rest call I can see the values from the parent but not in the child class.
class HttpProblem {
{instance=/api/v1/bcp/notifications/client/436c5f5f-414c-4b12-ab10-47219da0a8f8, X-Request-Id=6ac32b58-47a2-45ee-9691-16841b216fd5, detail=Client 436c5f5f-414c-4b12-ab10-47219da0a8f8 does not exist, title=Not Found, status=404}
type: null
title: null
status: null
detail: null
instance: null
}```
Here is the SCHEMA snippet for the HTTPProblem that gets auto generated from Quarkus OpenAPI extension:
```json
"HttpProblem" : {
"description" : "HTTP Problem Response according to RFC9457 & RFC7807",
"additionalProperties" : true,
"type" : "object",
"properties" : {
"type" : {
"type" : "string",
"format" : "uri",
"description" : "A optional URI reference that identifies the problem type",
"examples" : [ "https://example.com/errors/not-found" ]
},
"title" : {
"type" : "string",
"description" : "A optional, short, human-readable summary of the problem type",
"examples" : [ "Not Found" ]
},
"status" : {
"type" : "integer",
"format" : "int32",
"description" : "The HTTP status code for this occurrence of the problem",
"examples" : [ 404 ]
},
"detail" : {
"type" : "string",
"description" : "A optional human-readable explanation specific to this occurrence of the problem",
"examples" : [ "Record not found" ]
},
"instance" : {
"type" : "string",
"format" : "uri",
"description" : "A URI reference that identifies the specific occurrence of the problem",
"examples" : [ "https://api.example.com/errors/123" ]
}
}
},
...
This happened:
Calling any of the getters generated always returns NULL
I expected this:
I should get the values returned when I call the getters like getStatus() and getDetails(), etc. and not NULL
Is there a workaround?
No response
How can we try to reproduce the issue?
No response
Anything else?
No response
Output of uname -a or ver
No response
Output of java -version
No response
Quarkus OpenApi version or git rev
No response
Build tool (ie. output of mvnw --version or gradlew --version)
No response
Additional information
No response
Community Notes
Please vote by adding a 👍 reaction to the issue to help us prioritize.
If you are interested to work on this issue, please leave a comment.name: Bug Report 🐞
The text was updated successfully, but these errors were encountered:
I'd assess this and try a few examples before jumping into your issue. Unfortunately, I don't have the time now, but feel free to send a PR or start investigating it since it seems you're a heavy user of the extension.
Right, there are two things to their client support now:
If I use their ThrowingHttpProblemClientExceptionMapper by setting the property during client generation, then I can use their raw HttpProblem exception class BUT then the models for HttpProblemViolation and HttpValidatingProblem still get generated and cause confusion because of the same class name but different packages.
This is why I asked for #1111 so those models would not get created since I know ahead of time I do not want those generated.
Tell us the extension you're using
Client
I tried this:
We are using quarkus-resteasy-problem for our REST error responses and their HttpProblem class extends RuntimeException.
When the client
openapi
generator creates the model for that schema it generates the code but ALL of thegetters
return NULL which the actual values are really stored in the parent MAP.Here is the code generated for the HttpProblem.
When I print out the model returned from the Rest call I can see the values from the parent but not in the child class.
This happened:
Calling any of the
getters
generated always returns NULLI expected this:
I should get the values returned when I call the getters like
getStatus()
andgetDetails()
, etc. and not NULLIs there a workaround?
No response
How can we try to reproduce the issue?
No response
Anything else?
No response
Output of
uname -a
orver
No response
Output of
java -version
No response
Quarkus OpenApi version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
Community Notes
The text was updated successfully, but these errors were encountered: