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

Add properties setter to ProblemDetail #31430

Closed
solomon-maeng opened this issue Oct 14, 2023 · 0 comments
Closed

Add properties setter to ProblemDetail #31430

solomon-maeng opened this issue Oct 14, 2023 · 0 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) theme: kotlin An issue related to Kotlin support type: enhancement A general enhancement
Milestone

Comments

@solomon-maeng
Copy link

solomon-maeng commented Oct 14, 2023

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)
}

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 14, 2023
@sdeleuze sdeleuze self-assigned this Oct 17, 2023
@sdeleuze sdeleuze added in: web Issues in web modules (web, webmvc, webflux, websocket) theme: kotlin An issue related to Kotlin support type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 17, 2023
@sdeleuze sdeleuze added this to the 6.0.14 milestone Oct 17, 2023
@sdeleuze sdeleuze changed the title Why does the ProblemDetail class only provide a setProperty method? Add properties setter to ProblemDetail Oct 17, 2023
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) theme: kotlin An issue related to Kotlin support type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants