Skip to content

Add toString() method in ArgumentValue #1196

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

Closed
wants to merge 1 commit into from

Conversation

SnuK87
Copy link
Contributor

@SnuK87 SnuK87 commented Apr 23, 2025

Override toString() method in ArgumentValue class based upon the java.util.Optional implementation.

Purpose:
The ArgumentValue class doesn't override toString() which makes logging and debugging quite tedious.

For example, if you define an input type for a graphql mutation with multiple properties wrapped in ArgumentValue:

record MyInput(
  ArgumentValue<String> field1,
  ArgumentValue<String> field2,
  ArgumentValue<String> field3,
  // many more fields...
) {}

You would have to manually write a custom toString() method for MyInput because IDEs or Lombok are (afaik) not able to generate it properly.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 23, 2025
@rstoyanchev rstoyanchev added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 23, 2025
@rstoyanchev rstoyanchev added this to the 1.3.6 milestone Apr 23, 2025
@rstoyanchev rstoyanchev self-assigned this Apr 23, 2025
@rstoyanchev rstoyanchev changed the title Override toString() method in ArgumentValue class Add toString() method in ArgumentValue Apr 23, 2025
Copy link
Contributor

@rstoyanchev rstoyanchev left a comment

Choose a reason for hiding this comment

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

@SnuK87 the change is good, but if you could, please check the DCO requirements, and follow the instructions to sign off the commit

@SnuK87 SnuK87 force-pushed the argumentvalue-tostring branch from 63e6fc3 to 741a3a5 Compare April 23, 2025 14:19
@SnuK87
Copy link
Contributor Author

SnuK87 commented Apr 23, 2025

@rstoyanchev Thanks for the fast feedback. Updated the Commit as described in the instructions.

@rstoyanchev rstoyanchev modified the milestones: 1.3.6, 1.4.1 May 29, 2025
@rstoyanchev rstoyanchev added the for: backport-to-1.3.x Marks an issue as a candidate for backport to 1.3.x label May 29, 2025
@rstoyanchev rstoyanchev added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-1.3.x Marks an issue as a candidate for backport to 1.3.x labels May 29, 2025
rstoyanchev pushed a commit that referenced this pull request May 29, 2025
rstoyanchev added a commit that referenced this pull request May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants