This removes entirely the intermittent traits and case classes for handling oneofs in RdfTriple, RdfQuad, and RdfGraphStart. Although in theory I could achieve this with scalameta, I decided to just copy and modify the generated code, as this should be less finnicky. The code works, it is also much shorter in Scala, but almost the same after bytecode compilation – I use a lot of Scala 3 inlining.
One issue with this is that it's very easy to introduce proto encoding/decoding errors this way. We should definitely add more tests, like:
Test all possible combinations of terms possible in S, P, O, G positions.
Test reading a proto (or: several protos) saved by previous versions of the library.
Run some kind of protoc command to check if the generated protos are compliant with rdf.proto and the proto specification itself.
I will do these once I confirm that it is indeed worth the effort. For now, I'm 99% sure it works.
This removes entirely the intermittent traits and case classes for handling oneofs in RdfTriple, RdfQuad, and RdfGraphStart. Although in theory I could achieve this with scalameta, I decided to just copy and modify the generated code, as this should be less finnicky. The code works, it is also much shorter in Scala, but almost the same after bytecode compilation – I use a lot of Scala 3 inlining.
One issue with this is that it's very easy to introduce proto encoding/decoding errors this way. We should definitely add more tests, like:
I will do these once I confirm that it is indeed worth the effort. For now, I'm 99% sure it works.