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
to make programs more type safe and prevent errors due to field name or type, the following would be very useful:
typeDoc=object
kind: string
nimid: int# badfield not present
badtype: int
ommittedfield: string# not all fields need to be present for validate to succeedlet doc =%*{
"kind": "foo",
"nimid": 32,
"badfield": 123,
"badtype": 12.3, # float instead of int
}
doc.validate(Doc) # CT failure because of badfield and badtype
serialization/deserialization
similar to above but I don't think it can be reduced to a common use case in Bson which is to specify only a subset of fields
var doc: Bson=...# see abovevar doc2: Doc= doc.to(Doc)
var doc3: Bson= doc2.to(Bson)
doAssert doc3 == doc
Note: this is implemented in D in vibe.d
The text was updated successfully, but these errors were encountered:
validation at CT
to make programs more type safe and prevent errors due to field name or type, the following would be very useful:
serialization/deserialization
similar to above but I don't think it can be reduced to a common use case in Bson which is to specify only a subset of fields
Note: this is implemented in D in vibe.d
The text was updated successfully, but these errors were encountered: