Coding 2020-10-24
Okay, I sort of took today easy, so this is going to just be a quick sketch of what I'm going to try to accomplish.
This is all based off the camel library. My minimum requirements are:
- No multi-dumpers.
- Always use the highest version. This is None if None is present in the dumper dict, and the maximum value otherwise.
- Warn if the parameter annotations don't match the type.
- Expect a container type as the output
- If a list, add its parameter
- If a union, add each parameter
- If a typeddict (the normal case), add the type of each field
- Keep track of which types were seen; the values should form some kind of DAG, but the type system doesn't have to enforce that (even if it usually will)
Basically, most types should just be recursed on immediately, but we need special casing for lists, unions (and probably optionals), dicts, and typed dicts. Basically, we need typed dict special casing because that's what most of the data will use for serialization, and we need special casing for all supported generics because we need to consider each runtime type separately.
Another requirement that I'm not yet sure how to accomplish: no two registries should implement loaders or dumpers for the same type. (If one registry implements a dumper for a type that isn't needed by the types that bring in that registry, then that dumper won't be checked, unless I just declare that every dumper in a every registry gets checked.)
I'm tired and I don't think I can make this make much more sense for now, so I'm calling it here.
Good night.