What is the intended design of the emissionPhaseObjectGraphVisitorFactories? #894
Unanswered
stijnherreman
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
While working on some changes to facilitate #807 and #677 I'm looking into the
emissionPhaseObjectGraphVisitorFactories
inside the serializer builders. I'm trying to understand the intended design here, but the code is leaving me confused.There are 4 chained visitors:
CustomSerializationObjectGraphVisitor
(outermost)This visitor may write YAML and prevent inner visitors from running in
bool Enter()
.AnchorAssigningObjectGraphVisitor
This visitor may emit events and prevent inner visitors from running in
bool Enter()
. It also ignores inner visitor implementations ofVisitMappingStart()
,VisitSequenceStart()
andVisitScalar()
.DefaultValuesObjectGraphVisitor
This visitor may prevent inner visitors from running in
bool EnterMapping()
.CommentsObjectGraphVisitor
(innermost)This visitor may emit events in
bool EnterMapping()
.I don't understand why the visitors are writing YAML or emiting events in the
bool
methods. It feels like the visitors must know about the implementation of eachother and their position in the chain, and are forced to incorrectly implementIObjectGraphVisitor
to work around the other visitors.Some of the relevant code traces back to the early days of the library, so maybe the intended design was lost along the way? Can anyone shed some light?
Beta Was this translation helpful? Give feedback.
All reactions