Looks like details needs to be a repeated message with its own schema and you have it set to required and string.
On Tue, Nov 29, 2022 at 7:30 PM 'SUDHAVANI SUNKARA' via Protocol Buffers < [email protected]> wrote: > Hi > > I am trying to use BQ subscription to write into BQ table. I am using > pubsub schema and trying to use protocol buffer option. > Here is my schema > > syntax = "proto2"; > > message SkuCostAudit { > message costs{ > required string calculatedDateTime = 1; > required int64 sku = 2; > required int64 vendor = 3; > required int64 location = 4; > required string locationType = 5; > required float cost = 6; > required string effectiveBeginDateTime = 7; > required string effectiveEndDateTime = 8; > required string transactionType = 9; > required string details = 10; > } > > repeated costs xyz = 11; > } > > I am trying to test my schema with this pubsub message.. > > { > "costs":[ > { > "calculatedDateTime":"2022-11-29T15:38:47Z", > "sku":122222222, > "vendor":111111, > "location":1234, > "locationType":"", > "cost":200.1200, > "effectiveBeginDateTime":"2019-12-25T07:00:00Z", > "effectiveEndDateTime":"2022-11-17T06:59:59Z", > "transactionType":"INSERT", > "details":[ > { > "type":"PERMANENT", > "cost":200.1200, > "effective":true > } > ] > }, > { > "calculatedDateTime":"2022-11-29T15:38:47Z", > "sku":222222222, > "vendor":222222, > "location":2222, > "locationType":"", > "cost":45, > "effectiveBeginDateTime":"2022-11-17T07:00:00Z", > "effectiveEndDateTime":"2023-11-24T06:59:59Z", > "transactionType":"INSERT", > "details":[ > { > "type":"PERMANENT", > "cost":45, > "effective":true > } > ] > }, > { > "calculatedDateTime":"2022-11-29T15:38:47Z", > "sku":3333333333, > "vendor":44444444, > "location":2222, > "locationType":"", > "cost":200.1200, > "effectiveBeginDateTime":"2019-12-25T07:00:00Z", > "effectiveEndDateTime":"9999-12-30T23:59:59Z", > "transactionType":"DELETE", > "details":[ > { > "type":"PERMANENT", > "cost":200.1200, > "effective":true > } > ] > } > ] > } > > I am getting error "Message is invalid against schema" . My pubsub message > is correct. Can someone guide me to fix my schema? > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/protobuf/de950a92-ffe3-4796-b1c4-ba22f290d70an%40googlegroups.com > <https://groups.google.com/d/msgid/protobuf/de950a92-ffe3-4796-b1c4-ba22f290d70an%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/CAD7-yfvYkdDqbfA%3DKM79%3DvzS_myAv0QkNZyYvNHHLnm87N9sxA%40mail.gmail.com.
