-
Notifications
You must be signed in to change notification settings - Fork 26
Description
This is a uber-ticket to track work for CST validation when converting between (both to and from) Recap schemas and other serdes (Avro, JSON schema, Proto).
The idea is to define a test directory like:
- /tests/converters/0000
- from.avsc
- from.proto
- from.json
- recap.yaml
- /tests/converters/0001
- to.avsc
- to.proto
- to.json
- recap.yaml
- /tests/converters/0002
- to.avsc
- to.proto
- to.json
- recap.yaml
- from.avsc
The test harness would iterate over every test subdir and verify that using a serde's converter and types.py's to_dict/from_dict would result in the expected structures.
For example, in 0000, the test harness would load the from.avsc into a dict, then use AvroConverter.to_recap to convert the Avro schema to a Recap StructType (the Recap AST). It'd then use recap.types.to_dict to convert the Recap AST to the Recap CST (dict). Finally, it'd load the recap.yaml and compare it to the Recap CST--they should be identical. It'd then do the same thing for the .proto and .json files.
In the second directory example it'd do the inverse. In the third directory example (0002) it'd do both to and from checks for the Avro schemas. The reason for splitting to/from is that you might not get the same schema when converting to Recap as when converting from Recap since some conversions are lossy or require coercion.
@mjperrone LMK if this makes sense.