diff --git a/src/openforms/contrib/zgw/clients/catalogi.py b/src/openforms/contrib/zgw/clients/catalogi.py index fd335164e9..4e2a1b3b17 100644 --- a/src/openforms/contrib/zgw/clients/catalogi.py +++ b/src/openforms/contrib/zgw/clients/catalogi.py @@ -35,6 +35,16 @@ class Catalogus(TypedDict): rsin: str naam: NotRequired[str] # not present in older versions informatieobjecttypen: list[str] + zaaktypen: list[str] + + +class CaseType(TypedDict): + # there are more attributes, but we currently don't use them. See the Catalogi + # API spec + url: str + catalogus: str # URL pointer to the catalogue + identificatie: str + omschrijving: str class InformatieObjectType(TypedDict): @@ -48,6 +58,14 @@ class InformatieObjectType(TypedDict): concept: NotRequired[bool] +class Eigenschap(TypedDict): + # there are more attributes, but we currently don't use them. See the Catalogi + # API spec + url: str + naam: str + zaaktype: str # URL pointer to the case type + + CatalogiAPIVersion: TypeAlias = tuple[ int, # major int, # minor @@ -226,7 +244,7 @@ def list_roltypen( results = response.json()["results"] return matcher(results) - def list_eigenschappen(self, zaaktype: str) -> list[dict]: + def list_eigenschappen(self, zaaktype: str) -> list[Eigenschap]: query = {"zaaktype": zaaktype} response = self.get("eigenschappen", params=query) diff --git a/src/openforms/registrations/contrib/zgw_apis/options.py b/src/openforms/registrations/contrib/zgw_apis/options.py index 09929c3e65..c609b10ce6 100644 --- a/src/openforms/registrations/contrib/zgw_apis/options.py +++ b/src/openforms/registrations/contrib/zgw_apis/options.py @@ -1,13 +1,14 @@ -from typing import Any - from django.db.models import Q from django.utils.translation import gettext_lazy as _ +from ape_pie import InvalidURLError from rest_framework import serializers +from rest_framework.exceptions import ErrorDetail from zgw_consumers.api_models.constants import VertrouwelijkheidsAanduidingen from openforms.api.fields import PrimaryKeyRelatedAsChoicesField -from openforms.contrib.zgw.clients.catalogi import omschrijving_matcher +from openforms.contrib.zgw.clients.catalogi import CatalogiClient, omschrijving_matcher +from openforms.contrib.zgw.serializers import CatalogueSerializer from openforms.formio.api.fields import FormioVariableKeyField from openforms.template.validators import DjangoTemplateValidator from openforms.utils.mixins import JsonSchemaSerializerMixin @@ -15,6 +16,7 @@ from .client import get_catalogi_client from .models import ZGWApiGroupConfig +from .typing import RegistrationOptions class MappedVariablePropertySerializer(serializers.Serializer): @@ -40,6 +42,18 @@ class ZaakOptionsSerializer(JsonSchemaSerializerMixin, serializers.Serializer): help_text=_("Which ZGW API set to use."), label=_("ZGW API set"), ) + # TODO: if selected, the informatieobjecttypen should also be limited to this + # catalogue, but that requires moving the registration options from the component + # to the registration options! + catalogue = CatalogueSerializer( + label=_("catalogue"), + required=False, + help_text=_( + "The catalogue in the catalogi API from the selected API group. This " + "overrides the catalogue specified in the API group, if it's set. Case " + "and document types specified will be resolved against this catalogue." + ), + ) zaaktype = serializers.URLField( required=True, help_text=_("URL of the ZAAKTYPE in the Catalogi API") ) @@ -116,7 +130,7 @@ def get_fields(self): fields["zgw_api_group"].required = False return fields - def validate(self, attrs: dict[str, Any]) -> dict[str, Any]: + def validate(self, attrs: RegistrationOptions) -> RegistrationOptions: validate_business_logic = self.context.get("validate_business_logic", True) if not validate_business_logic: return attrs @@ -140,81 +154,163 @@ def validate(self, attrs: dict[str, Any]) -> dict[str, Any]: else: attrs["zgw_api_group"] = existing_group - group_config = attrs["zgw_api_group"] + _validate_against_catalogi_api(attrs) - # Run all validations against catalogi API in the same connection pool. - with get_catalogi_client(group_config) as client: - catalogi = list(client.get_all_catalogi()) + return attrs - # validate that the zaaktype is in the provided catalogi - zaaktype_url = attrs["zaaktype"] - zaaktype_exists = any( - zaaktype_url in catalogus["zaaktypen"] for catalogus in catalogi - ) - if not zaaktype_exists: - raise serializers.ValidationError( - { - "zaaktype": _( - "The provided zaaktype does not exist in the specified " - "Catalogi API." - ) - }, - code="not-found", - ) - # validate that the informatieobjecttype is in the provided catalogi - informatieobjecttype_url = attrs["informatieobjecttype"] - informatieobjecttype_exists = any( - informatieobjecttype_url in catalogus["informatieobjecttypen"] - for catalogus in catalogi +def _validate_against_catalogi_api(attrs: RegistrationOptions) -> None: + """ + Validate the configuration options against the specified catalogi API. + + 1. If provided, validate that the specified catalogue exists in the configured + Catalogi API (ZTC). + 2. Validate that the case type and document type exist: + + 1. If a catalogue is provided (either in the options or on the API group), + check that they are contained inside the specified catalogue. + 2. Otherwise, apply the legacy behaviour and validate that both exist in the + specified Catalogi API. + + 3. Validate that the configured case properties ("eigenschappen") exist on the + specified case type. + 4. Validate that the employee role type ("medewerkerroltype") exists on the + specified case type. + """ + with get_catalogi_client(attrs["zgw_api_group"]) as client: + # validate the catalogue itself - the queryset in the field guarantees that + # api_group.ztc_service is not null. + _validate_catalogue_case_and_doc_type(client, attrs) + _validate_case_type_properties(client, attrs) + _validate_medewerker_roltype(client, attrs) + + +def _validate_catalogue_case_and_doc_type( + client: CatalogiClient, attrs: RegistrationOptions +) -> None: + _errors = {} + + api_group = attrs["zgw_api_group"] + catalogus = None + catalogue_option = attrs.get("catalogue") + + case_type_url = attrs["zaaktype"] + document_type_url = attrs["informatieobjecttype"] + + domain, rsin = ( + ( + catalogue_option["domain"], + catalogue_option["rsin"], + ) + if catalogue_option is not None + else ( + api_group.catalogue_domain, + api_group.catalogue_rsin, + ) + ) + + err_invalid_case_type = ErrorDetail( + _("The provided zaaktype does not exist in the specified Catalogi API."), # type: ignore + code="not-found", + ) + err_invalid_document_type = ErrorDetail( + _( + "The provided informatieobjecttype does not exist in the specified " + "Catalogi API." + ), # type: ignore + code="not-found", + ) + + # DB check constraint + serializer validation guarantee that both or none + # are empty at the same time + if domain and rsin: + catalogus = client.find_catalogus(domain=domain, rsin=rsin) + if catalogus is None: + raise serializers.ValidationError( + { + "catalogue": _( + "The specified catalogue does not exist. Maybe you made a " + "typo in the domain or RSIN?" + ), + }, + code="invalid-catalogue", ) - if not informatieobjecttype_exists: - raise serializers.ValidationError( - { - "informatieobjecttype": _( - "The provided informatieobjecttype does not exist in the " - "specified Catalogi API." - ) - }, - code="not-found", - ) - # Make sure the property (eigenschap) related to the zaaktype exists - if mappings := attrs.get("property_mappings"): - eigenschappen = client.list_eigenschappen(zaaktype=attrs["zaaktype"]) - retrieved_eigenschappen = { - eigenschap["naam"]: eigenschap["url"] - for eigenschap in eigenschappen - } - - errors = [] - for mapping in mappings: - if mapping["eigenschap"] not in retrieved_eigenschappen: - errors.append( - _( - "Could not find a property with the name " - "'{property_name}' related to the zaaktype." - ).format(property_name=mapping["eigenschap"]) - ) + if case_type_url not in catalogus["zaaktypen"]: + _errors["zaaktype"] = err_invalid_case_type + if document_type_url not in catalogus["informatieobjecttypen"]: + _errors["informatieobjecttype"] = err_invalid_document_type - if errors: - raise serializers.ValidationError( - {"property_mappings": errors}, code="invalid" - ) + else: + try: + zaaktype_response = client.get(attrs["zaaktype"]) + zaaktype_ok = zaaktype_response.status_code == 200 + except InvalidURLError: + zaaktype_ok = False + if not zaaktype_ok: + _errors["zaaktype"] = err_invalid_case_type - if "medewerker_roltype" in attrs: - roltypen = client.list_roltypen( - zaaktype=attrs["zaaktype"], - matcher=omschrijving_matcher(attrs["medewerker_roltype"]), - ) - if not roltypen: - raise serializers.ValidationError( - { - "medewerker_roltype": _( - "Could not find a roltype with this description related to the zaaktype." - ) - }, - code="invalid", - ) + try: + document_type_response = client.get(attrs["informatieobjecttype"]) + document_type_ok = document_type_response.status_code == 200 + except InvalidURLError: + document_type_ok = False + if not document_type_ok: + _errors["informatieobjecttype"] = err_invalid_document_type - return attrs + # If there are problems with the case type or document type, there's no point + # to continue validation that relies on these values, so bail early. + if _errors: + raise serializers.ValidationError(_errors) + + +def _validate_case_type_properties( + client: CatalogiClient, attrs: RegistrationOptions +) -> None: + # Make sure the property (eigenschap) related to the zaaktype exists + if not (mappings := attrs.get("property_mappings")): + return + + eigenschappen = client.list_eigenschappen(zaaktype=attrs["zaaktype"]) + eigenschappen_names = {eigenschap["naam"] for eigenschap in eigenschappen} + + _errors: dict[int, dict] = {} + for index, mapping in enumerate(mappings): + if (name := mapping["eigenschap"]) in eigenschappen_names: + continue + + msg = _( + "Could not find a property with the name '{name}' in the case type" + ).format(name=name) + _errors[index] = {"eigenschap": ErrorDetail(msg, code="not-found")} + + # TODO: validate that the componentKey is a valid reference, but for that the + # variables must be persisted before the form registration options are being + # validated, which currently is not the case. + + if _errors: + raise serializers.ValidationError( + {"property_mappings": _errors}, # type: ignore + code="invalid", + ) + + +def _validate_medewerker_roltype( + client: CatalogiClient, attrs: RegistrationOptions +) -> None: + if not (description := attrs.get("medewerker_roltype")): + return + + roltypen = client.list_roltypen( + zaaktype=attrs["zaaktype"], + matcher=omschrijving_matcher(description), + ) + if not roltypen: + raise serializers.ValidationError( + { + "medewerker_roltype": _( + "Could not find a roltype with this description related to the zaaktype." + ) + }, + code="invalid", + ) diff --git a/src/openforms/registrations/contrib/zgw_apis/plugin.py b/src/openforms/registrations/contrib/zgw_apis/plugin.py index 3bc73b6f1e..2e77b15d4b 100644 --- a/src/openforms/registrations/contrib/zgw_apis/plugin.py +++ b/src/openforms/registrations/contrib/zgw_apis/plugin.py @@ -34,6 +34,7 @@ from .client import get_catalogi_client, get_documents_client, get_zaken_client from .models import ZGWApiGroupConfig from .options import ZaakOptionsSerializer +from .typing import RegistrationOptions from .utils import process_according_to_eigenschap_format logger = logging.getLogger(__name__) @@ -96,7 +97,7 @@ def decorator(*args, **kwargs): @register("zgw-create-zaak") -class ZGWRegistration(BasePlugin): +class ZGWRegistration(BasePlugin[RegistrationOptions]): verbose_name = _("ZGW API's") configuration_options = ZaakOptionsSerializer @@ -148,7 +149,7 @@ class ZGWRegistration(BasePlugin): @wrap_api_errors def pre_register_submission( - self, submission: "Submission", options: dict + self, submission: "Submission", options: RegistrationOptions ) -> PreRegistrationResult: """ Create a Zaak, so that we can have a registration ID. @@ -187,7 +188,9 @@ def pre_register_submission( ) @wrap_api_errors - def register_submission(self, submission: Submission, options: dict) -> dict | None: + def register_submission( + self, submission: Submission, options: RegistrationOptions + ) -> dict | None: """ Add the PDF document with the submission data (confirmation report) to the zaak created during pre-registration. """ @@ -458,7 +461,9 @@ def register_submission(self, submission: Submission, options: dict) -> dict | N return result @wrap_api_errors - def update_payment_status(self, submission: Submission, options: dict): + def update_payment_status( + self, submission: Submission, options: RegistrationOptions + ): zgw = options["zgw_api_group"] assert submission.registration_result zaak = submission.registration_result["zaak"] @@ -477,7 +482,7 @@ def get_config_actions(self) -> list[Action]: ] def register_submission_to_objects_api( - self, submission: Submission, options: dict + self, submission: Submission, options: RegistrationOptions ) -> dict: object_mapping = { "geometry": FieldConf( diff --git a/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_existing_provided_variable_in_specific_zaaktype.yaml b/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_existing_provided_variable_in_specific_zaaktype.yaml index 9120ce0f82..768c63ae53 100644 --- a/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_existing_provided_variable_in_specific_zaaktype.yaml +++ b/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_existing_provided_variable_in_specific_zaaktype.yaml @@ -7,29 +7,74 @@ interactions: Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyMDE2MTMyNSwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.9hsYAKtQoAUTyhdR6ACa9lJwE5lDgGStd7II5Lg-4wU + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NiwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.yUp2YB0oc7wy3MLAZtYOQw8wne8ZfEZLtI3d4_wvojA Connection: - keep-alive User-Agent: - python-requests/2.32.2 method: GET - uri: http://localhost:8003/catalogi/api/v1/catalogussen + uri: http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc response: body: - string: '{"count":1,"next":null,"previous":null,"results":[{"url":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","domein":"TEST","rsin":"000000000","contactpersoonBeheerNaam":"Test - name","contactpersoonBeheerTelefoonnummer":"","contactpersoonBeheerEmailadres":"","zaaktypen":["http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc"],"besluittypen":[],"informatieobjecttypen":["http://localhost:8003/catalogi/api/v1/informatieobjecttypen/7a474713-0833-402a-8441-e467c08ac55b","http://localhost:8003/catalogi/api/v1/informatieobjecttypen/b2d83b94-9b9b-4e80-a82f-73ff993c62f3","http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7"],"naam":"Test - catalog","versie":"","begindatumVersie":null}]}' + string: '{"url":"http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc","identificatie":"ZT-001","omschrijving":"Test","omschrijvingGeneriek":"","vertrouwelijkheidaanduiding":"intern","doel":"testen","aanleiding":"integratietests","toelichting":"","indicatieInternOfExtern":"intern","handelingInitiator":"Formulier + indienen","onderwerp":"Testformulier","handelingBehandelaar":"Controleren","doorlooptijd":"P1D","servicenorm":null,"opschortingEnAanhoudingMogelijk":false,"verlengingMogelijk":false,"verlengingstermijn":null,"trefwoorden":[],"publicatieIndicatie":false,"publicatietekst":"","verantwoordingsrelatie":[],"productenOfDiensten":[],"selectielijstProcestype":"https://selectielijst.openzaak.nl/api/v1/procestypen/aa8aa2fd-b9c6-4e34-9a6c-58a677f60ea0","referentieproces":{"naam":"Testen","link":""},"concept":false,"verantwoordelijke":"Ontwikkelaar","beginGeldigheid":"2024-03-26","eindeGeldigheid":null,"versiedatum":"2024-03-26","beginObject":"2024-03-26","eindeObject":null,"catalogus":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","statustypen":["http://localhost:8003/catalogi/api/v1/statustypen/1de05b57-a938-47e4-b808-f129c6406b60","http://localhost:8003/catalogi/api/v1/statustypen/6443ac1a-04a1-4335-9db2-5f3c998dbb34"],"resultaattypen":["http://localhost:8003/catalogi/api/v1/resultaattypen/65b7cedd-5729-41bd-b9c7-1f51d7583340"],"eigenschappen":["http://localhost:8003/catalogi/api/v1/eigenschappen/b659caed-e39e-47e3-ac51-bc8bd2ad797e"],"informatieobjecttypen":["http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7"],"roltypen":["http://localhost:8003/catalogi/api/v1/roltypen/43e8026c-8abd-4b29-8a4c-ac2a37bc6f5b","http://localhost:8003/catalogi/api/v1/roltypen/7f1887e8-bf22-47e7-ae52-ed6848d7e70e"],"besluittypen":[],"deelzaaktypen":[],"gerelateerdeZaaktypen":[],"zaakobjecttypen":[]}' headers: API-version: - 1.3.1 Allow: - - GET, POST, HEAD, OPTIONS + - GET, PUT, PATCH, DELETE, HEAD, OPTIONS + Content-Length: + - '1918' + Content-Type: + - application/json + Cross-Origin-Opener-Policy: + - same-origin + ETag: + - '"4b7814375796d28f29fea94ee27127b8"' + Referrer-Policy: + - same-origin + Vary: + - Accept, origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, br + Authorization: + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NiwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.yUp2YB0oc7wy3MLAZtYOQw8wne8ZfEZLtI3d4_wvojA + Connection: + - keep-alive + User-Agent: + - python-requests/2.32.2 + method: GET + uri: http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7 + response: + body: + string: '{"url":"http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7","catalogus":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","omschrijving":"Attachment + Informatieobjecttype","vertrouwelijkheidaanduiding":"openbaar","beginGeldigheid":"2024-03-19","eindeGeldigheid":"2024-07-10","concept":false,"besluittypen":[],"informatieobjectcategorie":"Test + category","trefwoord":[],"omschrijvingGeneriek":{"informatieobjecttypeOmschrijvingGeneriek":"","definitieInformatieobjecttypeOmschrijvingGeneriek":"","herkomstInformatieobjecttypeOmschrijvingGeneriek":"","hierarchieInformatieobjecttypeOmschrijvingGeneriek":"","opmerkingInformatieobjecttypeOmschrijvingGeneriek":""},"zaaktypen":["http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc"],"beginObject":"2024-03-19","eindeObject":"2024-07-10"}' + headers: + API-version: + - 1.3.1 + Allow: + - GET, PUT, PATCH, DELETE, HEAD, OPTIONS Content-Length: - - '799' + - '899' Content-Type: - application/json Cross-Origin-Opener-Policy: - same-origin + ETag: + - '"cf350f1b55d7eb0ccd17cceb88c1c6c8"' Referrer-Policy: - same-origin Vary: @@ -49,7 +94,7 @@ interactions: Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyMDE2MTMyNSwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.9hsYAKtQoAUTyhdR6ACa9lJwE5lDgGStd7II5Lg-4wU + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NiwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.yUp2YB0oc7wy3MLAZtYOQw8wne8ZfEZLtI3d4_wvojA Connection: - keep-alive User-Agent: diff --git a/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_invalid_omschrijving.yaml b/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_invalid_omschrijving.yaml index 8332e89bb4..863f452abf 100644 --- a/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_invalid_omschrijving.yaml +++ b/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_invalid_omschrijving.yaml @@ -7,29 +7,74 @@ interactions: Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyMDE2MTMyNSwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.9hsYAKtQoAUTyhdR6ACa9lJwE5lDgGStd7II5Lg-4wU + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NywiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.Q-eFRynF9E7lUrJeKcQ348LZiMqzzwddz7tZOsvarYY Connection: - keep-alive User-Agent: - python-requests/2.32.2 method: GET - uri: http://localhost:8003/catalogi/api/v1/catalogussen + uri: http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc response: body: - string: '{"count":1,"next":null,"previous":null,"results":[{"url":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","domein":"TEST","rsin":"000000000","contactpersoonBeheerNaam":"Test - name","contactpersoonBeheerTelefoonnummer":"","contactpersoonBeheerEmailadres":"","zaaktypen":["http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc"],"besluittypen":[],"informatieobjecttypen":["http://localhost:8003/catalogi/api/v1/informatieobjecttypen/7a474713-0833-402a-8441-e467c08ac55b","http://localhost:8003/catalogi/api/v1/informatieobjecttypen/b2d83b94-9b9b-4e80-a82f-73ff993c62f3","http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7"],"naam":"Test - catalog","versie":"","begindatumVersie":null}]}' + string: '{"url":"http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc","identificatie":"ZT-001","omschrijving":"Test","omschrijvingGeneriek":"","vertrouwelijkheidaanduiding":"intern","doel":"testen","aanleiding":"integratietests","toelichting":"","indicatieInternOfExtern":"intern","handelingInitiator":"Formulier + indienen","onderwerp":"Testformulier","handelingBehandelaar":"Controleren","doorlooptijd":"P1D","servicenorm":null,"opschortingEnAanhoudingMogelijk":false,"verlengingMogelijk":false,"verlengingstermijn":null,"trefwoorden":[],"publicatieIndicatie":false,"publicatietekst":"","verantwoordingsrelatie":[],"productenOfDiensten":[],"selectielijstProcestype":"https://selectielijst.openzaak.nl/api/v1/procestypen/aa8aa2fd-b9c6-4e34-9a6c-58a677f60ea0","referentieproces":{"naam":"Testen","link":""},"concept":false,"verantwoordelijke":"Ontwikkelaar","beginGeldigheid":"2024-03-26","eindeGeldigheid":null,"versiedatum":"2024-03-26","beginObject":"2024-03-26","eindeObject":null,"catalogus":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","statustypen":["http://localhost:8003/catalogi/api/v1/statustypen/1de05b57-a938-47e4-b808-f129c6406b60","http://localhost:8003/catalogi/api/v1/statustypen/6443ac1a-04a1-4335-9db2-5f3c998dbb34"],"resultaattypen":["http://localhost:8003/catalogi/api/v1/resultaattypen/65b7cedd-5729-41bd-b9c7-1f51d7583340"],"eigenschappen":["http://localhost:8003/catalogi/api/v1/eigenschappen/b659caed-e39e-47e3-ac51-bc8bd2ad797e"],"informatieobjecttypen":["http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7"],"roltypen":["http://localhost:8003/catalogi/api/v1/roltypen/43e8026c-8abd-4b29-8a4c-ac2a37bc6f5b","http://localhost:8003/catalogi/api/v1/roltypen/7f1887e8-bf22-47e7-ae52-ed6848d7e70e"],"besluittypen":[],"deelzaaktypen":[],"gerelateerdeZaaktypen":[],"zaakobjecttypen":[]}' headers: API-version: - 1.3.1 Allow: - - GET, POST, HEAD, OPTIONS + - GET, PUT, PATCH, DELETE, HEAD, OPTIONS + Content-Length: + - '1918' + Content-Type: + - application/json + Cross-Origin-Opener-Policy: + - same-origin + ETag: + - '"4b7814375796d28f29fea94ee27127b8"' + Referrer-Policy: + - same-origin + Vary: + - Accept, origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, br + Authorization: + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NywiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.Q-eFRynF9E7lUrJeKcQ348LZiMqzzwddz7tZOsvarYY + Connection: + - keep-alive + User-Agent: + - python-requests/2.32.2 + method: GET + uri: http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7 + response: + body: + string: '{"url":"http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7","catalogus":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","omschrijving":"Attachment + Informatieobjecttype","vertrouwelijkheidaanduiding":"openbaar","beginGeldigheid":"2024-03-19","eindeGeldigheid":"2024-07-10","concept":false,"besluittypen":[],"informatieobjectcategorie":"Test + category","trefwoord":[],"omschrijvingGeneriek":{"informatieobjecttypeOmschrijvingGeneriek":"","definitieInformatieobjecttypeOmschrijvingGeneriek":"","herkomstInformatieobjecttypeOmschrijvingGeneriek":"","hierarchieInformatieobjecttypeOmschrijvingGeneriek":"","opmerkingInformatieobjecttypeOmschrijvingGeneriek":""},"zaaktypen":["http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc"],"beginObject":"2024-03-19","eindeObject":"2024-07-10"}' + headers: + API-version: + - 1.3.1 + Allow: + - GET, PUT, PATCH, DELETE, HEAD, OPTIONS Content-Length: - - '799' + - '899' Content-Type: - application/json Cross-Origin-Opener-Policy: - same-origin + ETag: + - '"cf350f1b55d7eb0ccd17cceb88c1c6c8"' Referrer-Policy: - same-origin Vary: @@ -49,7 +94,7 @@ interactions: Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyMDE2MTMyNSwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.9hsYAKtQoAUTyhdR6ACa9lJwE5lDgGStd7II5Lg-4wU + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NywiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.Q-eFRynF9E7lUrJeKcQ348LZiMqzzwddz7tZOsvarYY Connection: - keep-alive User-Agent: diff --git a/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_provided_variable_does_not_exist_in_specific_zaaktype.yaml b/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_provided_variable_does_not_exist_in_specific_zaaktype.yaml index 9120ce0f82..27c6d4790e 100644 --- a/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_provided_variable_does_not_exist_in_specific_zaaktype.yaml +++ b/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_provided_variable_does_not_exist_in_specific_zaaktype.yaml @@ -7,29 +7,74 @@ interactions: Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyMDE2MTMyNSwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.9hsYAKtQoAUTyhdR6ACa9lJwE5lDgGStd7II5Lg-4wU + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NywiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.Q-eFRynF9E7lUrJeKcQ348LZiMqzzwddz7tZOsvarYY Connection: - keep-alive User-Agent: - python-requests/2.32.2 method: GET - uri: http://localhost:8003/catalogi/api/v1/catalogussen + uri: http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc response: body: - string: '{"count":1,"next":null,"previous":null,"results":[{"url":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","domein":"TEST","rsin":"000000000","contactpersoonBeheerNaam":"Test - name","contactpersoonBeheerTelefoonnummer":"","contactpersoonBeheerEmailadres":"","zaaktypen":["http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc"],"besluittypen":[],"informatieobjecttypen":["http://localhost:8003/catalogi/api/v1/informatieobjecttypen/7a474713-0833-402a-8441-e467c08ac55b","http://localhost:8003/catalogi/api/v1/informatieobjecttypen/b2d83b94-9b9b-4e80-a82f-73ff993c62f3","http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7"],"naam":"Test - catalog","versie":"","begindatumVersie":null}]}' + string: '{"url":"http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc","identificatie":"ZT-001","omschrijving":"Test","omschrijvingGeneriek":"","vertrouwelijkheidaanduiding":"intern","doel":"testen","aanleiding":"integratietests","toelichting":"","indicatieInternOfExtern":"intern","handelingInitiator":"Formulier + indienen","onderwerp":"Testformulier","handelingBehandelaar":"Controleren","doorlooptijd":"P1D","servicenorm":null,"opschortingEnAanhoudingMogelijk":false,"verlengingMogelijk":false,"verlengingstermijn":null,"trefwoorden":[],"publicatieIndicatie":false,"publicatietekst":"","verantwoordingsrelatie":[],"productenOfDiensten":[],"selectielijstProcestype":"https://selectielijst.openzaak.nl/api/v1/procestypen/aa8aa2fd-b9c6-4e34-9a6c-58a677f60ea0","referentieproces":{"naam":"Testen","link":""},"concept":false,"verantwoordelijke":"Ontwikkelaar","beginGeldigheid":"2024-03-26","eindeGeldigheid":null,"versiedatum":"2024-03-26","beginObject":"2024-03-26","eindeObject":null,"catalogus":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","statustypen":["http://localhost:8003/catalogi/api/v1/statustypen/1de05b57-a938-47e4-b808-f129c6406b60","http://localhost:8003/catalogi/api/v1/statustypen/6443ac1a-04a1-4335-9db2-5f3c998dbb34"],"resultaattypen":["http://localhost:8003/catalogi/api/v1/resultaattypen/65b7cedd-5729-41bd-b9c7-1f51d7583340"],"eigenschappen":["http://localhost:8003/catalogi/api/v1/eigenschappen/b659caed-e39e-47e3-ac51-bc8bd2ad797e"],"informatieobjecttypen":["http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7"],"roltypen":["http://localhost:8003/catalogi/api/v1/roltypen/43e8026c-8abd-4b29-8a4c-ac2a37bc6f5b","http://localhost:8003/catalogi/api/v1/roltypen/7f1887e8-bf22-47e7-ae52-ed6848d7e70e"],"besluittypen":[],"deelzaaktypen":[],"gerelateerdeZaaktypen":[],"zaakobjecttypen":[]}' headers: API-version: - 1.3.1 Allow: - - GET, POST, HEAD, OPTIONS + - GET, PUT, PATCH, DELETE, HEAD, OPTIONS + Content-Length: + - '1918' + Content-Type: + - application/json + Cross-Origin-Opener-Policy: + - same-origin + ETag: + - '"4b7814375796d28f29fea94ee27127b8"' + Referrer-Policy: + - same-origin + Vary: + - Accept, origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, br + Authorization: + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NywiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.Q-eFRynF9E7lUrJeKcQ348LZiMqzzwddz7tZOsvarYY + Connection: + - keep-alive + User-Agent: + - python-requests/2.32.2 + method: GET + uri: http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7 + response: + body: + string: '{"url":"http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7","catalogus":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","omschrijving":"Attachment + Informatieobjecttype","vertrouwelijkheidaanduiding":"openbaar","beginGeldigheid":"2024-03-19","eindeGeldigheid":"2024-07-10","concept":false,"besluittypen":[],"informatieobjectcategorie":"Test + category","trefwoord":[],"omschrijvingGeneriek":{"informatieobjecttypeOmschrijvingGeneriek":"","definitieInformatieobjecttypeOmschrijvingGeneriek":"","herkomstInformatieobjecttypeOmschrijvingGeneriek":"","hierarchieInformatieobjecttypeOmschrijvingGeneriek":"","opmerkingInformatieobjecttypeOmschrijvingGeneriek":""},"zaaktypen":["http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc"],"beginObject":"2024-03-19","eindeObject":"2024-07-10"}' + headers: + API-version: + - 1.3.1 + Allow: + - GET, PUT, PATCH, DELETE, HEAD, OPTIONS Content-Length: - - '799' + - '899' Content-Type: - application/json Cross-Origin-Opener-Policy: - same-origin + ETag: + - '"cf350f1b55d7eb0ccd17cceb88c1c6c8"' Referrer-Policy: - same-origin Vary: @@ -49,7 +94,7 @@ interactions: Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyMDE2MTMyNSwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.9hsYAKtQoAUTyhdR6ACa9lJwE5lDgGStd7II5Lg-4wU + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NywiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.Q-eFRynF9E7lUrJeKcQ348LZiMqzzwddz7tZOsvarYY Connection: - keep-alive User-Agent: diff --git a/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_valid_omschrijving.yaml b/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_valid_omschrijving.yaml index 8332e89bb4..863f452abf 100644 --- a/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_valid_omschrijving.yaml +++ b/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_valid_omschrijving.yaml @@ -7,29 +7,74 @@ interactions: Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyMDE2MTMyNSwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.9hsYAKtQoAUTyhdR6ACa9lJwE5lDgGStd7II5Lg-4wU + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NywiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.Q-eFRynF9E7lUrJeKcQ348LZiMqzzwddz7tZOsvarYY Connection: - keep-alive User-Agent: - python-requests/2.32.2 method: GET - uri: http://localhost:8003/catalogi/api/v1/catalogussen + uri: http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc response: body: - string: '{"count":1,"next":null,"previous":null,"results":[{"url":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","domein":"TEST","rsin":"000000000","contactpersoonBeheerNaam":"Test - name","contactpersoonBeheerTelefoonnummer":"","contactpersoonBeheerEmailadres":"","zaaktypen":["http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc"],"besluittypen":[],"informatieobjecttypen":["http://localhost:8003/catalogi/api/v1/informatieobjecttypen/7a474713-0833-402a-8441-e467c08ac55b","http://localhost:8003/catalogi/api/v1/informatieobjecttypen/b2d83b94-9b9b-4e80-a82f-73ff993c62f3","http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7"],"naam":"Test - catalog","versie":"","begindatumVersie":null}]}' + string: '{"url":"http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc","identificatie":"ZT-001","omschrijving":"Test","omschrijvingGeneriek":"","vertrouwelijkheidaanduiding":"intern","doel":"testen","aanleiding":"integratietests","toelichting":"","indicatieInternOfExtern":"intern","handelingInitiator":"Formulier + indienen","onderwerp":"Testformulier","handelingBehandelaar":"Controleren","doorlooptijd":"P1D","servicenorm":null,"opschortingEnAanhoudingMogelijk":false,"verlengingMogelijk":false,"verlengingstermijn":null,"trefwoorden":[],"publicatieIndicatie":false,"publicatietekst":"","verantwoordingsrelatie":[],"productenOfDiensten":[],"selectielijstProcestype":"https://selectielijst.openzaak.nl/api/v1/procestypen/aa8aa2fd-b9c6-4e34-9a6c-58a677f60ea0","referentieproces":{"naam":"Testen","link":""},"concept":false,"verantwoordelijke":"Ontwikkelaar","beginGeldigheid":"2024-03-26","eindeGeldigheid":null,"versiedatum":"2024-03-26","beginObject":"2024-03-26","eindeObject":null,"catalogus":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","statustypen":["http://localhost:8003/catalogi/api/v1/statustypen/1de05b57-a938-47e4-b808-f129c6406b60","http://localhost:8003/catalogi/api/v1/statustypen/6443ac1a-04a1-4335-9db2-5f3c998dbb34"],"resultaattypen":["http://localhost:8003/catalogi/api/v1/resultaattypen/65b7cedd-5729-41bd-b9c7-1f51d7583340"],"eigenschappen":["http://localhost:8003/catalogi/api/v1/eigenschappen/b659caed-e39e-47e3-ac51-bc8bd2ad797e"],"informatieobjecttypen":["http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7"],"roltypen":["http://localhost:8003/catalogi/api/v1/roltypen/43e8026c-8abd-4b29-8a4c-ac2a37bc6f5b","http://localhost:8003/catalogi/api/v1/roltypen/7f1887e8-bf22-47e7-ae52-ed6848d7e70e"],"besluittypen":[],"deelzaaktypen":[],"gerelateerdeZaaktypen":[],"zaakobjecttypen":[]}' headers: API-version: - 1.3.1 Allow: - - GET, POST, HEAD, OPTIONS + - GET, PUT, PATCH, DELETE, HEAD, OPTIONS + Content-Length: + - '1918' + Content-Type: + - application/json + Cross-Origin-Opener-Policy: + - same-origin + ETag: + - '"4b7814375796d28f29fea94ee27127b8"' + Referrer-Policy: + - same-origin + Vary: + - Accept, origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, br + Authorization: + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NywiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.Q-eFRynF9E7lUrJeKcQ348LZiMqzzwddz7tZOsvarYY + Connection: + - keep-alive + User-Agent: + - python-requests/2.32.2 + method: GET + uri: http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7 + response: + body: + string: '{"url":"http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7","catalogus":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","omschrijving":"Attachment + Informatieobjecttype","vertrouwelijkheidaanduiding":"openbaar","beginGeldigheid":"2024-03-19","eindeGeldigheid":"2024-07-10","concept":false,"besluittypen":[],"informatieobjectcategorie":"Test + category","trefwoord":[],"omschrijvingGeneriek":{"informatieobjecttypeOmschrijvingGeneriek":"","definitieInformatieobjecttypeOmschrijvingGeneriek":"","herkomstInformatieobjecttypeOmschrijvingGeneriek":"","hierarchieInformatieobjecttypeOmschrijvingGeneriek":"","opmerkingInformatieobjecttypeOmschrijvingGeneriek":""},"zaaktypen":["http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc"],"beginObject":"2024-03-19","eindeObject":"2024-07-10"}' + headers: + API-version: + - 1.3.1 + Allow: + - GET, PUT, PATCH, DELETE, HEAD, OPTIONS Content-Length: - - '799' + - '899' Content-Type: - application/json Cross-Origin-Opener-Policy: - same-origin + ETag: + - '"cf350f1b55d7eb0ccd17cceb88c1c6c8"' Referrer-Policy: - same-origin Vary: @@ -49,7 +94,7 @@ interactions: Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyMDE2MTMyNSwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.9hsYAKtQoAUTyhdR6ACa9lJwE5lDgGStd7II5Lg-4wU + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NywiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.Q-eFRynF9E7lUrJeKcQ348LZiMqzzwddz7tZOsvarYY Connection: - keep-alive User-Agent: diff --git a/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_validate_informatieobjecttype_within_configured_ztc_service.yaml b/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_validate_informatieobjecttype_within_configured_ztc_service.yaml index 7464021d1c..febf007f90 100644 --- a/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_validate_informatieobjecttype_within_configured_ztc_service.yaml +++ b/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_validate_informatieobjecttype_within_configured_ztc_service.yaml @@ -7,29 +7,30 @@ interactions: Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyMDE2MTMyNiwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.6d_Y3TSnD11WCF0lW8Se6WWmOitjmnFG4XT6-wESmt4 + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NywiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.Q-eFRynF9E7lUrJeKcQ348LZiMqzzwddz7tZOsvarYY Connection: - keep-alive User-Agent: - python-requests/2.32.2 method: GET - uri: http://localhost:8003/catalogi/api/v1/catalogussen + uri: http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc response: body: - string: '{"count":1,"next":null,"previous":null,"results":[{"url":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","domein":"TEST","rsin":"000000000","contactpersoonBeheerNaam":"Test - name","contactpersoonBeheerTelefoonnummer":"","contactpersoonBeheerEmailadres":"","zaaktypen":["http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc"],"besluittypen":[],"informatieobjecttypen":["http://localhost:8003/catalogi/api/v1/informatieobjecttypen/7a474713-0833-402a-8441-e467c08ac55b","http://localhost:8003/catalogi/api/v1/informatieobjecttypen/b2d83b94-9b9b-4e80-a82f-73ff993c62f3","http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7"],"naam":"Test - catalog","versie":"","begindatumVersie":null}]}' + string: '{"url":"http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc","identificatie":"ZT-001","omschrijving":"Test","omschrijvingGeneriek":"","vertrouwelijkheidaanduiding":"intern","doel":"testen","aanleiding":"integratietests","toelichting":"","indicatieInternOfExtern":"intern","handelingInitiator":"Formulier + indienen","onderwerp":"Testformulier","handelingBehandelaar":"Controleren","doorlooptijd":"P1D","servicenorm":null,"opschortingEnAanhoudingMogelijk":false,"verlengingMogelijk":false,"verlengingstermijn":null,"trefwoorden":[],"publicatieIndicatie":false,"publicatietekst":"","verantwoordingsrelatie":[],"productenOfDiensten":[],"selectielijstProcestype":"https://selectielijst.openzaak.nl/api/v1/procestypen/aa8aa2fd-b9c6-4e34-9a6c-58a677f60ea0","referentieproces":{"naam":"Testen","link":""},"concept":false,"verantwoordelijke":"Ontwikkelaar","beginGeldigheid":"2024-03-26","eindeGeldigheid":null,"versiedatum":"2024-03-26","beginObject":"2024-03-26","eindeObject":null,"catalogus":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","statustypen":["http://localhost:8003/catalogi/api/v1/statustypen/1de05b57-a938-47e4-b808-f129c6406b60","http://localhost:8003/catalogi/api/v1/statustypen/6443ac1a-04a1-4335-9db2-5f3c998dbb34"],"resultaattypen":["http://localhost:8003/catalogi/api/v1/resultaattypen/65b7cedd-5729-41bd-b9c7-1f51d7583340"],"eigenschappen":["http://localhost:8003/catalogi/api/v1/eigenschappen/b659caed-e39e-47e3-ac51-bc8bd2ad797e"],"informatieobjecttypen":["http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7"],"roltypen":["http://localhost:8003/catalogi/api/v1/roltypen/43e8026c-8abd-4b29-8a4c-ac2a37bc6f5b","http://localhost:8003/catalogi/api/v1/roltypen/7f1887e8-bf22-47e7-ae52-ed6848d7e70e"],"besluittypen":[],"deelzaaktypen":[],"gerelateerdeZaaktypen":[],"zaakobjecttypen":[]}' headers: API-version: - 1.3.1 Allow: - - GET, POST, HEAD, OPTIONS + - GET, PUT, PATCH, DELETE, HEAD, OPTIONS Content-Length: - - '799' + - '1918' Content-Type: - application/json Cross-Origin-Opener-Policy: - same-origin + ETag: + - '"4b7814375796d28f29fea94ee27127b8"' Referrer-Policy: - same-origin Vary: @@ -41,4 +42,45 @@ interactions: status: code: 200 message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, br + Authorization: + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NywiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.Q-eFRynF9E7lUrJeKcQ348LZiMqzzwddz7tZOsvarYY + Connection: + - keep-alive + User-Agent: + - python-requests/2.32.2 + method: GET + uri: http://localhost:8003/catalogi/api/v1/informatieobjecttypen/ca5ffa84-3806-4663-a226-f2d163b79643 + response: + body: + string: '{"type":"http://localhost:8003/ref/fouten/NotFound/","code":"not_found","title":"Niet + gevonden.","status":404,"detail":"Niet gevonden.","instance":"urn:uuid:19f1c7fb-c237-4be7-86ed-d6d9d0619018"}' + headers: + API-version: + - 1.3.1 + Allow: + - GET, PUT, PATCH, DELETE, HEAD, OPTIONS + Content-Length: + - '195' + Content-Type: + - application/json + Cross-Origin-Opener-Policy: + - same-origin + Referrer-Policy: + - same-origin + Vary: + - Accept, origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + status: + code: 404 + message: Not Found version: 1 diff --git a/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_validate_zaaktype_within_configured_ztc_service.yaml b/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_validate_zaaktype_within_configured_ztc_service.yaml index 7464021d1c..240dd6c8c2 100644 --- a/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_validate_zaaktype_within_configured_ztc_service.yaml +++ b/src/openforms/registrations/contrib/zgw_apis/tests/files/vcr_cassettes/OptionsSerializerTests/OptionsSerializerTests.test_validate_zaaktype_within_configured_ztc_service.yaml @@ -7,25 +7,24 @@ interactions: Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyMDE2MTMyNiwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.6d_Y3TSnD11WCF0lW8Se6WWmOitjmnFG4XT6-wESmt4 + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NywiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.Q-eFRynF9E7lUrJeKcQ348LZiMqzzwddz7tZOsvarYY Connection: - keep-alive User-Agent: - python-requests/2.32.2 method: GET - uri: http://localhost:8003/catalogi/api/v1/catalogussen + uri: http://localhost:8003/catalogi/api/v1/zaaktypen/ca5ffa84-3806-4663-a226-f2d163b79643 response: body: - string: '{"count":1,"next":null,"previous":null,"results":[{"url":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","domein":"TEST","rsin":"000000000","contactpersoonBeheerNaam":"Test - name","contactpersoonBeheerTelefoonnummer":"","contactpersoonBeheerEmailadres":"","zaaktypen":["http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc"],"besluittypen":[],"informatieobjecttypen":["http://localhost:8003/catalogi/api/v1/informatieobjecttypen/7a474713-0833-402a-8441-e467c08ac55b","http://localhost:8003/catalogi/api/v1/informatieobjecttypen/b2d83b94-9b9b-4e80-a82f-73ff993c62f3","http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7"],"naam":"Test - catalog","versie":"","begindatumVersie":null}]}' + string: '{"type":"http://localhost:8003/ref/fouten/NotFound/","code":"not_found","title":"Niet + gevonden.","status":404,"detail":"Niet gevonden.","instance":"urn:uuid:faa00bae-b99f-4df3-9d9b-65cd30d8e7b3"}' headers: API-version: - 1.3.1 Allow: - - GET, POST, HEAD, OPTIONS + - GET, PUT, PATCH, DELETE, HEAD, OPTIONS Content-Length: - - '799' + - '195' Content-Type: - application/json Cross-Origin-Opener-Policy: @@ -38,6 +37,50 @@ interactions: - nosniff X-Frame-Options: - DENY + status: + code: 404 + message: Not Found +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, br + Authorization: + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcyNDEzOTc1NywiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.Q-eFRynF9E7lUrJeKcQ348LZiMqzzwddz7tZOsvarYY + Connection: + - keep-alive + User-Agent: + - python-requests/2.32.2 + method: GET + uri: http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7 + response: + body: + string: '{"url":"http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7","catalogus":"http://localhost:8003/catalogi/api/v1/catalogussen/bd58635c-793e-446d-a7e0-460d7b04829d","omschrijving":"Attachment + Informatieobjecttype","vertrouwelijkheidaanduiding":"openbaar","beginGeldigheid":"2024-03-19","eindeGeldigheid":"2024-07-10","concept":false,"besluittypen":[],"informatieobjectcategorie":"Test + category","trefwoord":[],"omschrijvingGeneriek":{"informatieobjecttypeOmschrijvingGeneriek":"","definitieInformatieobjecttypeOmschrijvingGeneriek":"","herkomstInformatieobjecttypeOmschrijvingGeneriek":"","hierarchieInformatieobjecttypeOmschrijvingGeneriek":"","opmerkingInformatieobjecttypeOmschrijvingGeneriek":""},"zaaktypen":["http://localhost:8003/catalogi/api/v1/zaaktypen/1f41885e-23fc-4462-bbc8-80be4ae484dc"],"beginObject":"2024-03-19","eindeObject":"2024-07-10"}' + headers: + API-version: + - 1.3.1 + Allow: + - GET, PUT, PATCH, DELETE, HEAD, OPTIONS + Content-Length: + - '899' + Content-Type: + - application/json + Cross-Origin-Opener-Policy: + - same-origin + ETag: + - '"cf350f1b55d7eb0ccd17cceb88c1c6c8"' + Referrer-Policy: + - same-origin + Vary: + - Accept, origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY status: code: 200 message: OK diff --git a/src/openforms/registrations/contrib/zgw_apis/tests/test_validators.py b/src/openforms/registrations/contrib/zgw_apis/tests/test_validators.py index aaab934353..dbdb72e8c9 100644 --- a/src/openforms/registrations/contrib/zgw_apis/tests/test_validators.py +++ b/src/openforms/registrations/contrib/zgw_apis/tests/test_validators.py @@ -48,6 +48,19 @@ def test_no_zgw_api_group(self): self.assertFalse(is_valid) self.assertIn("zgw_api_group", serializer.errors) + def test_bad_case_type_document_type_api_roots(self): + data = { + "zgw_api_group": self.zgw_group.pk, + "zaaktype": "https://other-host.local/api/v1/zt/123", + "informatieobjecttype": "https://other-host.local/api/v1/iot/456", + } + serializer = ZaakOptionsSerializer(data=data) + is_valid = serializer.is_valid() + + self.assertFalse(is_valid) + self.assertIn("zaaktype", serializer.errors) + self.assertIn("informatieobjecttype", serializer.errors) + def test_existing_provided_variable_in_specific_zaaktype(self): data = { "zgw_api_group": self.zgw_group.pk, @@ -89,9 +102,13 @@ def test_provided_variable_does_not_exist_in_specific_zaaktype(self): self.assertFalse(is_valid) self.assertIn("property_mappings", serializer.errors) + self.assertIn(0, serializer.errors["property_mappings"]) + self.assertIn("eigenschap", serializer.errors["property_mappings"][0]) + + error_msg = serializer.errors["property_mappings"][0]["eigenschap"] self.assertEqual( - "Could not find a property with the name 'wrong variable' related to the zaaktype.", - serializer.errors["property_mappings"][0], + error_msg, + "Could not find a property with the name 'wrong variable' in the case type", ) def test_validate_zaaktype_within_configured_ztc_service(self): diff --git a/src/openforms/registrations/contrib/zgw_apis/typing.py b/src/openforms/registrations/contrib/zgw_apis/typing.py new file mode 100644 index 0000000000..4a311e5515 --- /dev/null +++ b/src/openforms/registrations/contrib/zgw_apis/typing.py @@ -0,0 +1,41 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Literal, NotRequired, TypedDict + +if TYPE_CHECKING: + from .models import ZGWApiGroupConfig + + +class CatalogueOption(TypedDict): + domain: str + rsin: str + + +class PropertyMapping(TypedDict): + component_key: str + eigenschap: str + + +class RegistrationOptions(TypedDict): + zgw_api_group: ZGWApiGroupConfig + catalogue: NotRequired[CatalogueOption] + zaaktype: str + informatieobjecttype: str + organisatie_rsin: NotRequired[str] + zaak_vertrouwelijkheidaanduiding: NotRequired[ + Literal[ + "openbaar", + "beperkt_openbaar", + "intern", + "zaakvertrouwelijk", + "vertrouwelijk", + "confidentieel", + "geheim", + "zeer_geheim", + ] + ] + medewerker_roltype: NotRequired[str] + objecttype: NotRequired[str] + objecttype_version: NotRequired[int] + content_json: NotRequired[str] + property_mappings: NotRequired[list[PropertyMapping]]