HAALCENTRAAL English translation
BRP API / Personen / Features / fields-gba

requesting authority relationships with fields when searching by addressable object designation

#language: en

@gba
Feature: requesting authority relationships with fields when searching by addressable object designation


    Background:
      Given an address has the following data
      | gemeentecode (92.10) | identificatiecode verblijfplaats (11.80) |
      | 0599                 | 0599010051001502                         |
      And the person with citizen service number '000000048' is registered at the address with the following data
      | gemeente van inschrijving (09.10) |
      | 0599                              |
      And the person has a 'kind' with the following data
      | burgerservicenummer (01.20) |
      | 000000012                   |
      And the person has a 'kind' with the following data
      | burgerservicenummer (01.20) |
      | 000000024                   |
      And the person has a 'partner' with the following data
      | burgerservicenummer (01.20) |
      | 000000061                   |
      And the following authority relationships apply to the person with citizen service number '000000048'
      | bsnMinderjarige | soortGezag | bsnMeerderjarige |
      | 000000012       | OG1        | 000000048        |
      | 000000024       | OG2        | 000000048        |
      And the person with citizen service number '000000061' is registered at the address with the following data
      | gemeente van inschrijving (09.10) |
      | 0599                              |
      And the person has a 'partner' with the following data
      | burgerservicenummer (01.20) |
      | 000000048                   |
      And the person has a 'kind' with the following data
      | burgerservicenummer (01.20) |
      | 000000024                   |
      And the person has a 'kind' with the following data
      | burgerservicenummer (01.20) |
      | 000000036                   |
      And the following authority relationships apply to the person with citizen service number '000000061'
      | bsnMinderjarige | soortGezag | bsnMeerderjarige |
      | 000000024       | OG2        | 000000061        |
      | 000000036       | GG         | 000000061        |
      And the person with citizen service number '000000012' is registered at the address with the following data
      | gemeente van inschrijving (09.10) |
      | 0599                              |
      And the person has a parent '1' with the following data
      | burgerservicenummer (01.20) |
      | 000000036                   |
      And the following authority relationships apply to the person with citizen service number '000000012'
      | bsnMinderjarige | soortGezag | bsnMeerderjarige |
      | 000000012       | OG1        | 000000048        |
      And the person with citizen service number '000000024' is registered at the address with the following data
      | gemeente van inschrijving (09.10) |
      | 0599                              |
      And the person has a parent '1' with the following data
      | burgerservicenummer (01.20) |
      | 000000048                   |
      And the person has a parent '2' with the following data
      | burgerservicenummer (01.20) |
      | 000000061                   |
      And the following authority relationships apply to the person with citizen service number '000000024'
      | bsnMinderjarige | soortGezag | bsnMeerderjarige |
      | 000000024       | OG2        | 000000048        |
      | 000000024       | OG2        | 000000061        |
      And the person with citizen service number '000000036' is registered at the address with the following data
      | gemeente van inschrijving (09.10) |
      | 0599                              |
      And the person has a parent '1' with the following data
      | burgerservicenummer (01.20) |
      | 000000061                   |
      And the following authority relationships apply to the person with citizen service number '000000036'
      | bsnMinderjarige | soortGezag | bsnMeerderjarige |
      | 000000036       | GG         | 000000061        |
      | 000000036       | GG         | 000000048        |


  Rule: Requesting one or more fields of 'gezag' supplies all fields of 'gezag' that apply to the person

    Scenario Outline: requesting gezag with fields <fields> gives all fields of all kinds of authority applying to the person
      When gba persons are searched with the following parameters
      | naam                             | waarde                                  |
      | type                             | ZoekMetAdresseerbaarObjectIdentificatie |
      | adresseerbaarObjectIdentificatie | 0599010051001502                        |
      | fields                           | burgerservicenummer,<fields>            |
      Then the response has a person with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000048 |
      And the person has a 'gezag' with the following data
      | naam                             | waarde                   |
      | type                             | EenhoofdigOuderlijkGezag |
      | minderjarige.burgerservicenummer | 000000012                |
      | ouder.burgerservicenummer        | 000000048                |
      And the person has a 'gezag' with the following data
      | naam                             | waarde                    |
      | type                             | TweehoofdigOuderlijkGezag |
      | minderjarige.burgerservicenummer | 000000024                 |
      And 'gezag' has a 'ouder' with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000048 |
      And 'gezag' has a 'ouder' with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000061 |
      And the person has a 'gezag' with the following data
      | naam                             | waarde           |
      | type                             | GezamenlijkGezag |
      | minderjarige.burgerservicenummer | 000000036        |
      | ouder.burgerservicenummer        | 000000061        |
      | derde.burgerservicenummer        | 000000048        |
      And the response has a person with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000061 |
      And the person has a 'gezag' with the following data
      | naam                             | waarde                    |
      | type                             | TweehoofdigOuderlijkGezag |
      | minderjarige.burgerservicenummer | 000000024                 |
      And 'gezag' has a 'ouder' with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000048 |
      And 'gezag' has a 'ouder' with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000061 |
      And the person has a 'gezag' with the following data
      | naam                             | waarde           |
      | type                             | GezamenlijkGezag |
      | minderjarige.burgerservicenummer | 000000036        |
      | ouder.burgerservicenummer        | 000000061        |
      | derde.burgerservicenummer        | 000000048        |
      And the response has a person with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000012 |
      And the person has a 'gezag' with the following data
      | naam                             | waarde                   |
      | type                             | EenhoofdigOuderlijkGezag |
      | minderjarige.burgerservicenummer | 000000012                |
      | ouder.burgerservicenummer        | 000000048                |
      And the response has a person with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000024 |
      And the person has a 'gezag' with the following data
      | naam                             | waarde                    |
      | type                             | TweehoofdigOuderlijkGezag |
      | minderjarige.burgerservicenummer | 000000024                 |
      And 'gezag' has a 'ouder' with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000048 |
      And 'gezag' has a 'ouder' with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000061 |
      And the response has a person with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000036 |
      And the person has a 'gezag' with the following data
      | naam                             | waarde           |
      | type                             | GezamenlijkGezag |
      | minderjarige.burgerservicenummer | 000000036        |
      | ouder.burgerservicenummer        | 000000061        |
      | derde.burgerservicenummer        | 000000048        |

      Examples:
      | fields                                     |
      | gezag                                      |
      | gezag.type                                 |
      | gezag.minderjarige                         |
      | gezag.ouders                               |
      | gezag.ouder                                |
      | gezag.derde                                |
      | gezag.derden                               |
      | gezag.minderjarige.burgerservicenummer     |
      | gezag.ouders.burgerservicenummer           |
      | gezag.ouder.burgerservicenummer            |
      | gezag.derde.burgerservicenummer            |
      | gezag.derden.burgerservicenummer           |
      | gezag.ouders,gezag.ouder                   |
      | gezag.type,gezag.minderjarige,gezag.ouders |

    Scenario: authority applies to the person but is not requested
      When gba persons are searched with the following parameters
      | naam                             | waarde                                  |
      | type                             | ZoekMetAdresseerbaarObjectIdentificatie |
      | adresseerbaarObjectIdentificatie | 0599010051001502                        |
      | fields                           | burgerservicenummer                     |
      Then the response has a person with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000048 |
      And the response has a person with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000061 |
      And the response has a person with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000012 |
      And the response has a person with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000024 |
      And the response has a person with the following data
      | naam                | waarde    |
      | burgerservicenummer | 000000036 |

    @fout-case
    Scenario: The fields parameter contains the path to a field that does not exist in gezag
      When gba persons are searched with the following parameters
      | naam                             | waarde                                  |
      | type                             | ZoekMetAdresseerbaarObjectIdentificatie |
      | adresseerbaarObjectIdentificatie | 0599010051001502                        |
      | fields                           | gezag.bestaatNiet                       |
      Then the response has an object with the following data
      | 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: fields[0].                   |
      | code     | paramsValidation                                            |
      | instance | /haalcentraal/api/brp/personen                              |
      And the object has the following 'invalidParams' data
      | code   | name      | reason                                       |
      | fields | fields[0] | Parameter bevat een niet bestaande veldnaam. |