Problem Details Then step definitions
#language: en @stap-documentatie Feature: Problem Details Then step definitions As a consumer of a BRP api I want client and server errors to be supplied in accordance with 'RFC 9457 Problem Details for HTTP APIs' so that my consumer applications can process errors from the BRP API in a consistent way @fout-case Scenario: Then the response has the following data Given the response body equals """ { "type": "https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.1", "title": "Een of meerdere parameters zijn niet correct.", "status": 400, "detail": "De foutieve parameter(s) zijn: type.", "code": "paramsValidation", "instance": "/api/brp/personen" } """ And the response headers equal | naam | waarde | | content-type | application/problem+json | And the response status equals 400 Then the response has an error message | naam | waarde | | type | https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.1 | | title | Een of meerdere parameters zijn niet correct. | | status | 400 | | detail | De foutieve parameter(s) zijn: type. | | code | paramsValidation | | instance | /api/brp/personen | Scenario: Then the following invalidParams error messages Given the response body equals """ { "invalidParams": [ { "code": "required", "name": "geboortedatum", "reason": "Parameter is verplicht." }, { "code": "required", "name": "geslachtsnaam", "reason": "Parameter is verplicht." } ] } """ Then parameter error messages | code | name | reason | | required | geboortedatum | Parameter is verplicht. | | required | geslachtsnaam | Parameter is verplicht. | @fout-case Scenario: Then the response has the following data and the response has invalidParams with the following data Given the response body equals """ { "type": "https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.1", "title": "Een of meerdere parameters zijn niet correct.", "status": 400, "detail": "De foutieve parameter(s) zijn: type.", "code": "paramsValidation", "instance": "/api/brp/personen", "invalidParams": [ { "code": "required", "name": "geboortedatum", "reason": "Parameter is verplicht." }, { "code": "required", "name": "geslachtsnaam", "reason": "Parameter is verplicht." } ] } """ And the response headers equal | naam | waarde | | content-type | application/problem+json | And the response status equals 400 Then the response has an error message | naam | waarde | | type | https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.1 | | title | Een of meerdere parameters zijn niet correct. | | status | 400 | | detail | De foutieve parameter(s) zijn: type. | | code | paramsValidation | | instance | /api/brp/personen | And parameter error messages | code | name | reason | | required | geboortedatum | Parameter is verplicht. | | required | geslachtsnaam | Parameter is verplicht. |