Closed provokateurin closed 1 year ago
Not a bug. We should improve the models though, since you need to pass the data always twice which is annoying (and leads to mistakes like this.
Let's keep this open so I can remember. I wanted to restructure this anyways (allof => inherritance; oneOf ^ anyOf cleanup).
I mean we could make the one ^ anyOf dart3 records (type1?, type2? , type3? , ...?) once built_value supports serializing them. then we might be able to completely ditch our current approach.
Then in the builder we could obviously add our assert checking that at least one of them is not null.
The serializer checks if the
data
field inside the data object is not null, but that check is wrong. It should check if the data object itself is not null (but that is not possible due to non-nullable type constraints in the constructor).See https://github.com/provokateurin/nextcloud-neon/blob/2b78134efaf37b96805b2dffad2b592510f2453c/packages/nextcloud/lib/src/nextcloud.openapi.g.dart#L27716 for example