Skip to content

Conversation

sanderke
Copy link
Member

De linter bevatte reeds een regel voor het verschaffen van "problem details". Hier wordt het ook als design rule toegevoegd.

fixes #188

Copy link

@sanderke sanderke requested a review from TimvdLippe July 24, 2025 13:24
Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

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

nlgov:use-problem-schema:
moet ook een verwijzing krijgen naar deze nieuwe regel

@TimvdLippe TimvdLippe added Scope: Klein Kleine wijzigingen met beperkte scope Status: In bewerking Het voorstel is in bewerking bij de beheerorganisatie. Type: Wijziging Inhoudelijke wijziging op een standaard Overleg: TO-API Te agenderen voor het Technisch Overleg API labels Aug 14, 2025
@TimvdLippe
Copy link
Contributor

Besproken om de volgende velden als verplicht voor te stellen:

  1. status
  2. title
  3. detail

Optioneel zijn de velden

  1. type
  2. instance

Er mogen geen andere velden gespecificeerd worden. De linter moet daarom geupdate worden dat het JSON object de verplichte velden bevat, en als er meer velden zijn enkel die optioneel zijn. Elk ander veld moet een error opleveren.

@TimvdLippe TimvdLippe added this to the ADR 2.2 milestone Aug 15, 2025

nlgov:problem-schema-members:
severity: warn
message: "These fields are required: status, title and detail. Additionally, only type and instance are allowed."
Copy link
Contributor

Choose a reason for hiding this comment

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

Laten we nog testen of het toevoegen van {{value}} ook laat zien dat bijvoorbeeld het veld "extra" niet toegestaan is.

Copy link
Member Author

Choose a reason for hiding this comment

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

{{value}} gaf [object Object].
{{error}} geeft een mooie zin met de value erin, zoals Property "extra" is not expected to be here.
Hiermee kwam ook aan het licht dat de test een niveau te hoog aan het kijken was voor de verwachte velden.

<dt>Statement</dt>
<dd>
<p>Error responses with HTTP status codes <code>4xx</code> or <code>5xx</code> MUST use either <code>application/problem+json</code> or <code>application/problem+xml</code> as the <code>Content-Type</code> header, and the response body MUST conform to the structure defined in [[rfc9457]].</p>
<p>The following fields MUST be present: <code>status</code>, <code>title</code>, and <code>detail</code>. Additionally, only these fields MAY be present: <code>type</code> and <code>instance</code>.</p>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Er moet ook ruimte zijn voor additionele details, bijv validatie-feedback van de request body waarbij je vaak per property een validatie-boodschap wil teruggeven. Dit zouden we ook kunnen standaardiseren of evt additionele properties toestaan.

<dl>
<dt>Statement</dt>
<dd>
<p>Error responses with HTTP status codes <code>4xx</code> or <code>5xx</code> MUST use either <code>application/problem+json</code> or <code>application/problem+xml</code> as the <code>Content-Type</code> header, and the response body MUST conform to the structure defined in [[rfc9457]].</p>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hoe verhouden de media types zich tot content negotiation? Wat als ik Accept: application/json heb meegestuurd in mijn request, maar een fout-response krijg? Wordt deze dan "overruled"? En wat als ik zowel JSON als XML problem responses ondersteun, wanneer krijg je welke? Etc etc...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Overleg: TO-API Te agenderen voor het Technisch Overleg API Scope: Klein Kleine wijzigingen met beperkte scope Status: In bewerking Het voorstel is in bewerking bij de beheerorganisatie. Type: Wijziging Inhoudelijke wijziging op een standaard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Voeg regel toe voor problem+json responses
3 participants