maykinmedia / zgw-consumers

Django app to store ZGW API configuration
MIT License
1 stars 2 forks source link

ZGW Consumers can't handle missing values, even if they're optional #49

Closed alextreme closed 2 years ago

alextreme commented 2 years ago

As discussed zgw-consumers errors when a ZGW server doesn't return all the expected fields in the api model:

missing 9 required positional arguments: 'omschrijving_generiek', 'toelichting', 'trefwoorden', 'publicatietekst', 'verantwoordingsrelatie', 'eigenschappen', 'deelzaaktypen', 'einde_geldigheid', and 'concept'

This came up in OIP: https://taiga.maykinmedia.nl/project/open-inwoner/issue/773 and is patched in OIP using derived dataclasses: https://github.com/maykinmedia/open-inwoner/pull/305/files

As mentioned in Slack on today / 5 sept:

volgens de semantics van OAS 3 is het niet verplicht om niet-required velden terug te geven beste route hier is om zgw-consumers te patchen met een default factory voor optionele velden, lijkt me

A broader issue is that DRF translates blank=False to required=True in the OAS