mu-haskell/test-schema.sh
Alejandro Serrano 1d8319ef98 [protobuf] Fix parsing of oneof fields (#302)
Closes #297 

In protobuf, unions themselves are optional, so while parsing if any value fails
to parse, its default must not be considered. When the default is considered and
first value in the union is not specified, the union still gets parsed as the
default of the first value. So, in this instance:

oneof foo {
  int32 foo_int = 1;
  string foo_str = 2;
}

foo_str will never be parsed, as foo_int will have a default, i.e. 0 and so
foo_str "blah" will always wrongly parse as foo_int 0.

Co-authored-by: Akshay Mankar <itsakshaymankar@gmail.com>
2021-04-30 13:17:11 +02:00

20 lines
778 B
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
echo "BUILDING"
stack build mu-avro mu-protobuf
mkdir -p dist
echo "\nAVRO\n====\n"
echo "python/generate"
python3 adapter/avro/test/avro/generate.py adapter/avro/test/avro/example.avsc dist/avro-python.avro
stack test-avro dist/avro-haskell.avro dist/avro-python.avro
echo "ptyhon/consume"
python3 adapter/avro/test/avro/consume.py adapter/avro/test/avro/example.avsc dist/avro-haskell.avro
# if protobuf is not installed, do so with 'pip install protobuf'
echo "\nPROTOBUF\n========\n"
echo "python/generate"
python2 adapter/protobuf/test/protobuf/generate.py dist/protobuf-python.pbuf
stack exec test-protobuf dist/protobuf-haskell.pbuf dist/protobuf-python.pbuf
echo "python/consume"
python2 adapter/protobuf/test/protobuf/consume.py dist/protobuf-haskell.pbuf