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

Decide on whether to rename ProblemDetail to ProblemDetails #29303

Closed
quaff opened this issue Oct 12, 2022 · 7 comments
Closed

Decide on whether to rename ProblemDetail to ProblemDetails #29303

quaff opened this issue Oct 12, 2022 · 7 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: declined A suggestion or change that we don't feel we should currently apply type: task A general task

Comments

@quaff
Copy link
Contributor

quaff commented Oct 12, 2022

Keep it consistent with RFC title Problem Details for HTTP APIs

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 12, 2022
quaff added a commit to quaff/spring-framework that referenced this issue Oct 12, 2022
@rstoyanchev
Copy link
Contributor

rstoyanchev commented Oct 12, 2022

Thanks for the comment. From the opening of the spec:

   This document defines a "problem detail" as a way to carry machine-
   readable details of errors in a HTTP response to avoid the need to
   define new error response formats for HTTP APIs.

It uses both singular ("problem detail") and plural ("machine-readable details") in the same sentence, so clearly there is something very intentional here. Most of the spec uses plural, but the double quotes around "problem detail" seems meant to draw a distinction. Here is my interpretation of it.

The singular form refers to the fact there is one problem to explain, you can choose one HTTP status and reason, and there is one String field called "detail". In other words, here is the problem and a description of it. The plural form, by contrast, refers to all the additional fields included in the response, which can be seen as auxiliary details along with the description.

There is a bit of an overlap of terminology there. The spec could have used a different name for the "detail" field, perhaps "description", "cause", or similar. Overall, I think neither ProblemDetail nor ProblemDetails is wrong. It just depends on your perspective. The former is more focused on the [single] problem / description, and the latter on all the auxiliary fields included in the response.

We'll try and finalize this for RC2 next week, but comments welcome in the mean time.

@rstoyanchev rstoyanchev self-assigned this Oct 12, 2022
@rstoyanchev rstoyanchev changed the title Rename ProblemDetail to ProblemDetails Decide on whether to rename ProblemDetail to ProblemDetails Oct 12, 2022
@rstoyanchev rstoyanchev added in: web Issues in web modules (web, webmvc, webflux, websocket) type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 12, 2022
@rstoyanchev rstoyanchev added this to the 6.0.0-RC2 milestone Oct 12, 2022
@membersound
Copy link

I would see the ProblemDetail class as a wrapper object, which should be singular.
Compare it with shopping: you have several products, and group them into a basket (not into baskets). Or you group them into an order (not orders).

Also, http APIs are usually kept in singular names as best practice.

In contrast, the naming ProblemDetail**s** could pretend that it contains multiple ProblemDetail objects as an array. Which is not the plan afaik.

@quaff
Copy link
Contributor Author

quaff commented Oct 13, 2022

FYI: spring-security use UserDetails instead of UserDetail, and .net use ProblemDetails instead of ProblemDetail.

@membersound
Copy link

And AWS is using ProblemDetail (https://docs.aws.amazon.com/de_de/devicefarm/latest/APIReference/API_ProblemDetail.html). You probably find both ways 50:50.

@rstoyanchev
Copy link
Contributor

The Spring Security example isn't something to go by. Yes, the same ending, but other than that, its own context and reasons. Let's stick to the case of RFC 7807. I've already laid out my interpretation of the language used there. If you have any comments or thoughts on that, please share.

@membersound I take it you see this as the plural applying to both "problem" and "detail", and that there is only one problem to be detailed.

@vpavic
Copy link
Contributor

vpavic commented Oct 13, 2022

FWIW, I agree with the current naming and interpretation outlined by @rstoyanchev.

The way I see it, this is a part of story that's basically about translating an exception (singular) to some specific representation of the underlying error. The translation is 1:1 so it seems natural to me to name the representation as ProblemDetail (singular again).

@rstoyanchev
Copy link
Contributor

I'm closing this in favour of the current choice, ProblemDetail, focusing on the actual problem and its description, rather than all the additional auxiliary details. Thanks for raising this in any case, it's good to have considered this with more scrutiny.

@rstoyanchev rstoyanchev closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2022
@rstoyanchev rstoyanchev removed this from the 6.0.0-RC2 milestone Oct 19, 2022
@rstoyanchev rstoyanchev added the status: declined A suggestion or change that we don't feel we should currently apply label Oct 19, 2022
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) status: declined A suggestion or change that we don't feel we should currently apply type: task A general task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants