You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by lebogg March 14, 2023
Even when we use optional for a proto field (see example below), the storage will save the respective tuple with a zero value of this field (e.g. empty string in the raw field). When we then call ListEvidences, e.g., we (in theory) can have a validation error since we have filled the field raw with empty string but now validation rules apply (min length 1 in this example). Thus, we would get errors when we check these evidences with corresponding validation methods. e.g. with the validation on the response (func (m *ListEvidencesResponse) Validate()). This currently happens in the new tests of #999, where we use the response validation method.
The question is: Do we just ignore it; adjust the .proto files; or adjust storage operations to make nil entries if that is even possible.
This seems strange because the database can handle NULL fields, so sin this case null/nil should be stored in the DB instead of "". Maybe we need to set a different "default value" (see https://gorm.io/docs/models.html#Fields-Tags, tag default).
The text was updated successfully, but these errors were encountered:
Discussed in #1010
Originally posted by lebogg March 14, 2023
Even when we use optional for a proto field (see example below), the storage will save the respective tuple with a zero value of this field (e.g. empty string in the raw field). When we then call
ListEvidences
, e.g., we (in theory) can have a validation error since we have filled the fieldraw
with empty string but now validation rules apply (min length 1 in this example). Thus, we would get errors when we check these evidences with corresponding validation methods. e.g. with the validation on the response (func (m *ListEvidencesResponse) Validate()
). This currently happens in the new tests of #999, where we use the response validation method.The question is: Do we just ignore it; adjust the .proto files; or adjust storage operations to make nil entries if that is even possible.
Example:
clouditor/api/evidence/evidence.proto
Line 57 in a718fcf
This seems strange because the database can handle
NULL
fields, so sin this casenull
/nil
should be stored in the DB instead of""
. Maybe we need to set a different "default value" (see https://gorm.io/docs/models.html#Fields-Tags, tagdefault
).The text was updated successfully, but these errors were encountered: