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
{{ message }}
Repository navigation
Ensure cyclic aliases are serialized with a scope reference #930
Currently, because JSON for a cyclic type references only its alias like $a, if two scopes had differing definitions for the same cyclic alias, caching could break.
Really this should use the id that is precomputed when parsing a node, but I want to ensure that is done in a way that doesn't arbitrarily introduce unnecessary barriers to serialization.
Maybe scopes should should have a globally unique id, then an alias could be ${scodeId}$${alias} or similar.
Failing test case:
it("intersect cyclic reference with repeat name",()=>{consttypes=scope({arf: {a: "bork"},bork: {b: "arf&bork"}}).export()constresolveRef: string=(types.bork.raw.firstReferenceOfKindOrThrow("alias").jsonasany).resolveattest(types.bork.json).snap({required: [{key: "b",value: {resolve: resolveRef,alias: "$arf&bork"}}],domain: "object"})attest(types.arf.json).snap({required: [{key: "a",value: types.bork.json}],domain: "object"})attest(types.arf({a: {b: {}}}).toString()).snap(`a.b.a must be { b: arf&bork } (was missing) a.b.b must be arf&bork (was missing)`)})
Activity
fix(schema): identify an alias by its context id
fix(schema): compare cyclic types by bisimulation
fix(schema): parse a cyclic type's json back
test(type): trim cyclic.test to one case per behavior
docs(type): cite the issues the release fixes and add the entries it …
ssalbdivad commentedon Nov 18, 2026
Fixed in 3.0.0-beta.0 (#1728). Try it with
npm i arktype@next.