fast-json-stringify icon indicating copy to clipboard operation
fast-json-stringify copied to clipboard

fix: merged schemas cache key

Open DamienVicet opened this issue 1 year ago • 2 comments

Hello, this PR fixes #724.

When diving in the bug, I found that the context.mergedSchemasIds Map, added by @ivan-tymoshenko, is using objects as keys. This caused the schema to infinitely try to build and results into Maximum call stack size exceeded error. So I replaced the key by a hash of the object, then I got another problem : anyOf inside allOf test failed because, to my understanding, we try to cache different merged schemas using the same key in context.mergedSchemasIds (like merged schemas from buildOneOf and from buildAllOf functions).

I am not sure of the solution. Thank you for your review !

DamienVicet avatar Jun 26 '24 14:06 DamienVicet

I found the problem. I'm working on the solution. Unfortunatelly merging schemas with recurcive references is the most complecated part of this library and take tons of time every time when we need to fix the bug.

ivan-tymoshenko avatar Jul 02 '24 22:07 ivan-tymoshenko

hi @ivan-tymoshenko , any progress on this? Can I maybe try to take it from wherever you've got to?

grreeenn avatar Feb 14 '25 22:02 grreeenn