It makes complete sense to be able to merge structs. Merging a struct and a reference can also work, but makes a bit less sense (existing keys in a struct are like added reference keys ('+' key syntax).
Merging two references makes no sense (especially if they are referencing different protos).
Merging protos also doesn't make sense (these aren't concrete structs anyway).
It does make sense to have two references with the same name, referring to different protos, turning those into concrete structs and then merging those structs if able.
Try moving the call to mergeNested after resolveReferences.
It makes complete sense to be able to merge structs. Merging a struct and a reference can also work, but makes a bit less sense (existing keys in a struct are like added reference keys ('+' key syntax).
Merging two references makes no sense (especially if they are referencing different protos). Merging protos also doesn't make sense (these aren't concrete structs anyway).
It does make sense to have two references with the same name, referring to different protos, turning those into concrete structs and then merging those structs if able.
Try moving the call to
mergeNested
afterresolveReferences
.