forked from VNG-Realisatie/vng-api-common
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow input with all empty values for non-required gegevensgroup #13
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if you have a number field where
0
is the value? thebool(0)
will give False, but it's not empty. Emptiness should typically be compared against the field-specific data type & empty check.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sergei-maertens Could you maybe help me with how to do it in the most meaningful way?
The problem:
In Catalogi API
ZaakType
will have optional gegevensgroupsbronzaaktype
andbroncatalogus
(here is OAS - https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/VNG-Realisatie/catalogi-api/1.2.1/src/openapi.yaml#tag/zaaktypen/operation/zaaktype_retrieve)So when you request zaaktype via API of export catalogus you will see gegevensgroups with empty items inside.
But when you try to import it or use it for PUT for example there would be validation error, because some items inside these gegevensgroups are not optional.
I want to avoid it. The best idea I came up with - to treat the gegevensgroup with all empty items like the empty one.
Do you perhaps have an idea how to do it better way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the API spec I read:
bronzaaktype
key is optionalbronzaaktype
key is included, it may not be nullbronzaaktype
key is included, the object provided must have all nested keys specified, but the values may be empty strings (no min length specified)the idea of some items inside a gegevensgroep being optional goes directly against the (initial) concept of gegevensgroep which was created to validate all or none are provided. I feel that gegevensgroep is being misused if that's not the case, instead it would make more sense to directly define a nested serializer with the appropriate field
source
set.so maybe something like this could work: