You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Recorder does not offer a clean API. Inside the Comparator we have calls like this: AppendValidationErrorSignal("number of fields does not match") where the message is defined as a method parameter, and then we have methods like this inside the DefaultRecorder itself: recorder.logResult.WriteString(fmt.Sprintf("%s <-- ignoring field\n", indent)).
It would be better for all methods to receive the jsonPath, fieldName and fieldValue from the comparator, and all messages (text) that are used to create the recorder log should be defined inside the Recorder implementation itself (in our case, the DefaultRecorder). This will offer a much cleaner way for other Recorder implementations to change the way the output looks and offer them full control.
Also, the Recorder uses fmt.Sprintf(...) internally in some cases which should not happen at all, since we are using a strings.Builder (!)
Action Points
refactor API as mentioned above (I imagine we will have specific methods for different validation cases)
remove the fmt.Sprintf(...) completely and only use the strings.Builder API
write a dedicated test for the DefaultRecorder (currently it is tested inside the Comparator tests)
The text was updated successfully, but these errors were encountered:
The
Recorder
does not offer a clean API. Inside theComparator
we have calls like this:AppendValidationErrorSignal("number of fields does not match")
where the message is defined as a method parameter, and then we have methods like this inside theDefaultRecorder
itself:recorder.logResult.WriteString(fmt.Sprintf("%s <-- ignoring field\n", indent))
.It would be better for all methods to receive the
jsonPath
,fieldName
andfieldValue
from the comparator, and all messages (text) that are used to create the recorder log should be defined inside theRecorder
implementation itself (in our case, theDefaultRecorder
). This will offer a much cleaner way for otherRecorder
implementations to change the way the output looks and offer them full control.Also, the Recorder uses
fmt.Sprintf(...)
internally in some cases which should not happen at all, since we are using a strings.Builder (!)Action Points
fmt.Sprintf(...)
completely and only use the strings.Builder APIComparator
tests)The text was updated successfully, but these errors were encountered: