Skip to content
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

Improve optional parameter checks for HTTP Interface argument #33339

Conversation

OlgaMaciaszek
Copy link
Contributor

Fixes gh-31467.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 7, 2024
@snicoll snicoll added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 8, 2024
@snicoll snicoll added this to the 6.2.x milestone Aug 8, 2024
@snicoll snicoll changed the title Reject not optional null arguments. Reject not optional null arguments in HTTP Interface Aug 8, 2024
@rstoyanchev rstoyanchev self-assigned this Aug 8, 2024
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.

Thanks for the changes.

Overall looks good. One minor suggestion for all the argument resolvers to check for null first and exit early. I think that would make it easier to read. Something like:

if (argument == null) {
	Assert.isTrue(parameter.isOptional(), "HttpMethod is required");
	return true;
}

// argument is not null...

@rstoyanchev rstoyanchev modified the milestones: 6.2.x, 6.2.0-M7 Aug 8, 2024
@rstoyanchev rstoyanchev changed the title Reject not optional null arguments in HTTP Interface Improve optional parameter checks for HTTP Interface argument Aug 8, 2024
Copy link

@RAWMEN888 RAWMEN888 left a comment

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Null Handling of HTTP Interface
5 participants