This is because phantom keys are parsed from the parent object, which means that FromJSON will attempt to parse { a: Int } and { a: Bool } from the same object. In other words, these schemas will never successfully parse.
Unsure how important this is; would love to see an example of someone running afoul of this, and how long it took to debug.
The following schemas compile, but would always fail at runtime:
This is because phantom keys are parsed from the parent object, which means that
FromJSON
will attempt to parse{ a: Int }
and{ a: Bool }
from the same object. In other words, these schemas will never successfully parse.Unsure how important this is; would love to see an example of someone running afoul of this, and how long it took to debug.