Skip to content

Add properties setter to ProblemDetailΒ #31430

@solomon-maeng

Description

@solomon-maeng

When I create a ProblemDetail class in Kotlin and want to add properties, I have to do it AS-IS.

When adding object property configuration using a scope function like apply, why can't we do it like TO-BE?

If I didn't consider things like TO-BE in my previous class design, will it be okay if I try to propose code after writing a PR?

AS-IS

ProblemDetail.forStatusAndDetail( HttpStatusCode.valueOf(HttpStatus.BAD_REQUEST.value()), ErrorMessage.INVALID_INPUT.value, ).apply { setProperty("validationErrors" , validationErrors) }

TO-BE

ProblemDetail.forStatusAndDetail( HttpStatusCode.valueOf(HttpStatus.BAD_REQUEST.value()), ErrorMessage.INVALID_INPUT.value, ).apply { properties = mapOf("validationErrors" to validationErrors) }

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)theme: kotlinAn issue related to Kotlin supporttype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions