ietf-wg-httpapi / rfc7807bis

Revision of RFC7807: HTTP Problem Details
Other
20 stars 8 forks source link

Cardinality of problem details object members #25

Closed tdonker closed 3 years ago

tdonker commented 3 years ago

When reading:

https://ietf-wg-httpapi.github.io/rfc7807bis/draft-ietf-httpapi-rfc7807bis.html

it's not entrirely clear which member field of the problem details object (type, status, title, detail, instance) is mandatory and which is optional. Is it correct to state that only the 'type' member is mandatory and all others are optional?

sazzer commented 3 years ago

As I understand it, none of them are mandatory.

Under type it states:

When this member is not present, its value is assumed to be "about:blank".

Under status it states: (Emphasis mine)

The "status" member, if present, is only advisory

Under title it states:

The "title" string is advisory and included only for users who are not aware of the semantics of the URI and do not have the ability to discover them

Under detail it states: (Emphasis mine)

The "detail" member, if present

And instance doesn't actually say anything one way or the other, but I've always assumed it's present only if there is anything to include.

asbjornu commented 3 years ago

Yeah, all of them are optional and type has a default value.

tdonker commented 3 years ago

Thanks for the quick reply. The cardinality of the 'type' member made doubt a little bit - but thats clear now.

sazzer commented 3 years ago

I'm not 100% sure I agree that they all should be optional. In some ways that makes it just a little bit harder to work with, since the spec defines 5 fields that are all optional and allows you to add arbitrary other fields as well it means that almost any JSON object is a valid Problem Details object. The only actual rules end up being "Any fields that have these 5 names must have the correct meaning" and nothing else can be relied upon.

For example, the following is a perfectly legal response:

HTTP/1.1 404 Not Found
Content-Type: application/problem+json

{
    "id": "12345"
}

On Fri, 20 Aug 2021 at 10:40, Ton Donker @.***> wrote:

Closed #25 https://github.com/ietf-wg-httpapi/rfc7807bis/issues/25.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ietf-wg-httpapi/rfc7807bis/issues/25#event-5185848490, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQEGB5CI3JXABOOEWYZ2LT5YPHBANCNFSM5CP45WOQ .

mnot commented 3 years ago

I don't think we can change that, @sazzer, without changing the media type for the format, so it's probably out of scope for this effort.