Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,25 @@
return Objects.hash({{#allParams}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{paramName}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{paramName}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{paramName}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/allParams}});
{{/useReflectionEqualsHashCode}}
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request {\n");
{{#allParams}}
sb.append(" {{paramName}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{paramName}}){{/isPassword}}).append("\n");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: A request parameter named sb is rendered incorrectly: the unqualified field reference resolves to the local StringBuilder sb, so toString() prints the builder instead of the parameter value. Qualifying generated fields with this. avoids this valid name collision.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/resources/Java/libraries/restclient/single_request_parameter.mustache, line 65:

<comment>A request parameter named `sb` is rendered incorrectly: the unqualified field reference resolves to the local `StringBuilder sb`, so `toString()` prints the builder instead of the parameter value. Qualifying generated fields with `this.` avoids this valid name collision.</comment>

<file context>
@@ -56,6 +56,25 @@
+            StringBuilder sb = new StringBuilder();
+            sb.append("class {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request {\n");
+            {{#allParams}}
+            sb.append("    {{paramName}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{paramName}}){{/isPassword}}).append("\n");
+            {{/allParams}}
+            sb.append("}");
</file context>
Suggested change
sb.append(" {{paramName}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{paramName}}){{/isPassword}}).append("\n");
sb.append(" {{paramName}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString(this.{{paramName}}){{/isPassword}}).append("\n");

{{/allParams}}
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private{{#jsonb}} static{{/jsonb}} String toIndentedString(Object o) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}
}
{{/staticRequest}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,25 @@
return Objects.hash({{#allParams}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{paramName}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{paramName}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{paramName}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/allParams}});
{{/useReflectionEqualsHashCode}}
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request {\n");
{{#allParams}}
sb.append(" {{paramName}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{paramName}}){{/isPassword}}).append("\n");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Binary request parameters will produce identity-based values such as [B@... in toString(), so output is nondeterministic and does not provide useful expected/actual diffs for byte[] values. Handling isByteArray with Arrays.toString(...) (while retaining the password branch) would make this formatting useful for binary parameters too.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/resources/Java/libraries/webclient/single_request_parameter.mustache, line 61:

<comment>Binary request parameters will produce identity-based values such as `[B@...` in `toString()`, so output is nondeterministic and does not provide useful expected/actual diffs for `byte[]` values. Handling `isByteArray` with `Arrays.toString(...)` (while retaining the password branch) would make this formatting useful for binary parameters too.</comment>

<file context>
@@ -52,6 +52,25 @@
+            StringBuilder sb = new StringBuilder();
+            sb.append("class {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request {\n");
+            {{#allParams}}
+            sb.append("    {{paramName}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{paramName}}){{/isPassword}}).append("\n");
+            {{/allParams}}
+            sb.append("}");
</file context>
Suggested change
sb.append(" {{paramName}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{paramName}}){{/isPassword}}).append("\n");
sb.append(" {{paramName}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}{{#isByteArray}}Arrays.toString({{paramName}}){{/isByteArray}}{{^isByteArray}}toIndentedString({{paramName}}){{/isByteArray}}{{/isPassword}}).append("\n");

{{/allParams}}
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private{{#jsonb}} static{{/jsonb}} String toIndentedString(Object o) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,25 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(pet, query1, header1);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FakeHttpSignatureTestRequest {\n");
sb.append(" pet: ").append(toIndentedString(pet)).append("\n");
sb.append(" query1: ").append(toIndentedString(query1)).append("\n");
sb.append(" header1: ").append(toIndentedString(header1)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}
}

/**
Expand Down Expand Up @@ -974,6 +993,24 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(query, user);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TestBodyWithQueryParamsRequest {\n");
sb.append(" query: ").append(toIndentedString(query)).append("\n");
sb.append(" user: ").append(toIndentedString(user)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}
}

/**
Expand Down Expand Up @@ -1341,6 +1378,36 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(number, _double, patternWithoutDelimiter, Arrays.hashCode(_byte), integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TestEndpointParametersRequest {\n");
sb.append(" number: ").append(toIndentedString(number)).append("\n");
sb.append(" _double: ").append(toIndentedString(_double)).append("\n");
sb.append(" patternWithoutDelimiter: ").append(toIndentedString(patternWithoutDelimiter)).append("\n");
sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n");
sb.append(" integer: ").append(toIndentedString(integer)).append("\n");
sb.append(" int32: ").append(toIndentedString(int32)).append("\n");
sb.append(" int64: ").append(toIndentedString(int64)).append("\n");
sb.append(" _float: ").append(toIndentedString(_float)).append("\n");
sb.append(" string: ").append(toIndentedString(string)).append("\n");
sb.append(" binary: ").append(toIndentedString(binary)).append("\n");
sb.append(" date: ").append(toIndentedString(date)).append("\n");
sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n");
sb.append(" password: ").append("*").append("\n");
sb.append(" paramCallback: ").append(toIndentedString(paramCallback)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}
}

/**
Expand Down Expand Up @@ -1668,6 +1735,31 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TestEnumParametersRequest {\n");
sb.append(" enumHeaderStringArray: ").append(toIndentedString(enumHeaderStringArray)).append("\n");
sb.append(" enumHeaderString: ").append(toIndentedString(enumHeaderString)).append("\n");
sb.append(" enumQueryStringArray: ").append(toIndentedString(enumQueryStringArray)).append("\n");
sb.append(" enumQueryString: ").append(toIndentedString(enumQueryString)).append("\n");
sb.append(" enumQueryInteger: ").append(toIndentedString(enumQueryInteger)).append("\n");
sb.append(" enumQueryDouble: ").append(toIndentedString(enumQueryDouble)).append("\n");
sb.append(" enumQueryModelArray: ").append(toIndentedString(enumQueryModelArray)).append("\n");
sb.append(" enumFormStringArray: ").append(toIndentedString(enumFormStringArray)).append("\n");
sb.append(" enumFormString: ").append(toIndentedString(enumFormString)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}
}

/**
Expand Down Expand Up @@ -1912,6 +2004,28 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TestGroupParametersRequest {\n");
sb.append(" requiredStringGroup: ").append(toIndentedString(requiredStringGroup)).append("\n");
sb.append(" requiredBooleanGroup: ").append(toIndentedString(requiredBooleanGroup)).append("\n");
sb.append(" requiredInt64Group: ").append(toIndentedString(requiredInt64Group)).append("\n");
sb.append(" stringGroup: ").append(toIndentedString(stringGroup)).append("\n");
sb.append(" booleanGroup: ").append(toIndentedString(booleanGroup)).append("\n");
sb.append(" int64Group: ").append(toIndentedString(int64Group)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}
}

/**
Expand Down Expand Up @@ -2237,6 +2351,24 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(param, param2);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TestJsonFormDataRequest {\n");
sb.append(" param: ").append(toIndentedString(param)).append("\n");
sb.append(" param2: ").append(toIndentedString(param2)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}
}

/**
Expand Down Expand Up @@ -2525,6 +2657,29 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(pipe, ioutil, http, url, context, allowEmpty, language);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TestQueryParameterCollectionFormatRequest {\n");
sb.append(" pipe: ").append(toIndentedString(pipe)).append("\n");
sb.append(" ioutil: ").append(toIndentedString(ioutil)).append("\n");
sb.append(" http: ").append(toIndentedString(http)).append("\n");
sb.append(" url: ").append(toIndentedString(url)).append("\n");
sb.append(" context: ").append(toIndentedString(context)).append("\n");
sb.append(" allowEmpty: ").append(toIndentedString(allowEmpty)).append("\n");
sb.append(" language: ").append(toIndentedString(language)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,24 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(petId, apiKey);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DeletePetRequest {\n");
sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}
}

/**
Expand Down Expand Up @@ -668,6 +686,25 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(petId, name, status);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class UpdatePetWithFormRequest {\n");
sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}
}

/**
Expand Down Expand Up @@ -851,6 +888,25 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(petId, additionalMetadata, _file);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class UploadFileRequest {\n");
sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
sb.append(" additionalMetadata: ").append(toIndentedString(additionalMetadata)).append("\n");
sb.append(" _file: ").append(toIndentedString(_file)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}
}

/**
Expand Down Expand Up @@ -1034,6 +1090,25 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(petId, requiredFile, additionalMetadata);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class UploadFileWithRequiredFileRequest {\n");
sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
sb.append(" requiredFile: ").append(toIndentedString(requiredFile)).append("\n");
sb.append(" additionalMetadata: ").append(toIndentedString(additionalMetadata)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}
}

/**
Expand Down
Loading
Loading