From 69441e94659f3176c30e91e7be06fbf53d4f9710 Mon Sep 17 00:00:00 2001 From: "Timothy J. Aveni" Date: Thu, 3 Sep 2026 09:47:35 -0700 Subject: [PATCH] Validate edge reference declarations directly --- dist/schema-compiler.d.ts.map | 2 +- dist/schema-compiler.js | 5 ++--- src/schema-compiler.ts | 7 ++----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/dist/schema-compiler.d.ts.map b/dist/schema-compiler.d.ts.map index aa1fdd9..9f30bdf 100644 --- a/dist/schema-compiler.d.ts.map +++ b/dist/schema-compiler.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"schema-compiler.d.ts","sourceRoot":"","sources":["../src/schema-compiler.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,KAAK,EAeV,mBAAmB,EAIpB,MAAM,gBAAgB,CAAC;AAw2BxB,eAAO,MAAM,oBAAoB,GAC/B,YAAY,MAAM,KACjB,OAAO,CAAC;IAAE,kBAAkB,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAA;CAAE,CAqC7D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,YAAY,MAAM,KACjB,OAAO,CAAC,mBAAmB,CAsC7B,CAAC"} \ No newline at end of file +{"version":3,"file":"schema-compiler.d.ts","sourceRoot":"","sources":["../src/schema-compiler.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,KAAK,EAeV,mBAAmB,EAIpB,MAAM,gBAAgB,CAAC;AAq2BxB,eAAO,MAAM,oBAAoB,GAC/B,YAAY,MAAM,KACjB,OAAO,CAAC;IAAE,kBAAkB,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAA;CAAE,CAqC7D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,YAAY,MAAM,KACjB,OAAO,CAAC,mBAAmB,CAsC7B,CAAC"} \ No newline at end of file diff --git a/dist/schema-compiler.js b/dist/schema-compiler.js index 54f4f5b..da3187b 100644 --- a/dist/schema-compiler.js +++ b/dist/schema-compiler.js @@ -511,9 +511,8 @@ const classSchemaFromType = (type, sourceFile, defaults, operationServices) => { if (!declaredToEndpoint.projection) { throw new Error(`Edge field ${type.fullName}.${field.name} requires other_endpoint.projection or inverse`); } - const sourceType = typeRefForField(field, defaults.schemaVersion); - if (sourceType.symbol?.namespace !== "camino" || - sourceType.symbol.name !== "Ref") { + const sourceProtoType = field.resolvedType?.fullName?.replace(/^\./, ""); + if (sourceProtoType !== "camino.Ref") { throw new Error(`Edge field ${type.fullName}.${field.name} must use camino.Ref`); } const isMany = isManyCardinality(declaredFromEndpoint.cardinality); diff --git a/src/schema-compiler.ts b/src/schema-compiler.ts index ee10ce7..e5d2c02 100644 --- a/src/schema-compiler.ts +++ b/src/schema-compiler.ts @@ -718,11 +718,8 @@ const classSchemaFromType = ( `Edge field ${type.fullName}.${field.name} requires other_endpoint.projection or inverse`, ); } - const sourceType = typeRefForField(field, defaults.schemaVersion); - if ( - sourceType.symbol?.namespace !== "camino" || - sourceType.symbol.name !== "Ref" - ) { + const sourceProtoType = field.resolvedType?.fullName?.replace(/^\./, ""); + if (sourceProtoType !== "camino.Ref") { throw new Error(`Edge field ${type.fullName}.${field.name} must use camino.Ref`); } const isMany = isManyCardinality(declaredFromEndpoint.cardinality);