Somehow, creating the `FieldType` as a type messes with the macros used
in `NimYAML`. Inline `GetFieldType` to avoid the problem.
https://github.com/status-im/nimbus-eth2/pull/5043#issuecomment-1584219098
```
./nimbus-eth2/tests/consensus_spec/test_fixture_light_client_sync.nim(126, 8) template/generic instantiation of `test` from here
./nimbus-eth2/tests/consensus_spec/test_fixture_light_client_sync.nim(146, 20) template/generic instantiation of `load` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(1368, 14) template/generic instantiation of `construct` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(1343, 19) template/generic instantiation of `constructChild` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(1168, 20) template/generic instantiation of `constructObject` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(927, 25) template/generic instantiation of `constructObjectDefault` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(921, 31) template/generic instantiation of `ensureAllFieldsPresent` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(681, 29) Error: type mismatch: got <NimNode>
but expected one of:
proc none(T: typedesc): Option[T]
first type mismatch at position: 1
required type for T: typedesc
but expression 'nil' is of type: NimNode
proc none[T](): Option[T]
first type mismatch at position: 1
extra argument given
template none(O: type Opt; T: type): Opt[T]
first type mismatch at position: 1
required type for O: typedesc[Opt]
but expression 'nil' is of type: NimNode
expression: none(nil)
make: *** [consensus_spec_tests_minimal] Error 1
```
Transitioning the case of a case object without full reinitialization
leads to undefined behaviour. Don't do such transitions implicitly,
and require explicit `readValue` override for such types in those cases.
The README file was describing an outdated way of defining serialization
formats. It was updated accordingly to match the current API.
- New format declaration using `setReader` and `setWriter`
and mandatory `PreferredOutput` type declaration,
as introduced in f9a1121b87.
- Removal of `fileExt` declaration, which was never implemented.
- Removal of format-specific `dontSerialize` pragma
as well as the `serialize` pragma, which were never implemented.
- Rename `serializedFields` macro to `setSerializedFields`,
to keep up with 60613bac5d.
- Remove rename functionality in `setSerializedFields`,
which was never implemented.
- A couple updated argument lists and typo corrections.
Other changes:
* The format declarations have been broken down in multiple
parts. This makes it possible to structure the implementation
libraries in a way such that the format name is accessible even
when importing only reader or writer modules.
* Flavors lead to more complicated Reader and Writer types.
Instead of requiring the user to write down long type names
such as `JsonReader[DefaultFlavor]`, it's now possible to refer
to the reader and writer type of each format using expressions
such as `Json.Reader` and `Json.Writer`.
* Fixed a typo (PreferredOutput)