Validate edge reference declarations directly
This commit is contained in:
Vendored
+1
-1
@@ -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"}
|
{"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"}
|
||||||
Vendored
+2
-3
@@ -511,9 +511,8 @@ const classSchemaFromType = (type, sourceFile, defaults, operationServices) => {
|
|||||||
if (!declaredToEndpoint.projection) {
|
if (!declaredToEndpoint.projection) {
|
||||||
throw new Error(`Edge field ${type.fullName}.${field.name} requires other_endpoint.projection or inverse`);
|
throw new Error(`Edge field ${type.fullName}.${field.name} requires other_endpoint.projection or inverse`);
|
||||||
}
|
}
|
||||||
const sourceType = typeRefForField(field, defaults.schemaVersion);
|
const sourceProtoType = field.resolvedType?.fullName?.replace(/^\./, "");
|
||||||
if (sourceType.symbol?.namespace !== "camino" ||
|
if (sourceProtoType !== "camino.Ref") {
|
||||||
sourceType.symbol.name !== "Ref") {
|
|
||||||
throw new Error(`Edge field ${type.fullName}.${field.name} must use camino.Ref`);
|
throw new Error(`Edge field ${type.fullName}.${field.name} must use camino.Ref`);
|
||||||
}
|
}
|
||||||
const isMany = isManyCardinality(declaredFromEndpoint.cardinality);
|
const isMany = isManyCardinality(declaredFromEndpoint.cardinality);
|
||||||
|
|||||||
@@ -718,11 +718,8 @@ const classSchemaFromType = (
|
|||||||
`Edge field ${type.fullName}.${field.name} requires other_endpoint.projection or inverse`,
|
`Edge field ${type.fullName}.${field.name} requires other_endpoint.projection or inverse`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const sourceType = typeRefForField(field, defaults.schemaVersion);
|
const sourceProtoType = field.resolvedType?.fullName?.replace(/^\./, "");
|
||||||
if (
|
if (sourceProtoType !== "camino.Ref") {
|
||||||
sourceType.symbol?.namespace !== "camino" ||
|
|
||||||
sourceType.symbol.name !== "Ref"
|
|
||||||
) {
|
|
||||||
throw new Error(`Edge field ${type.fullName}.${field.name} must use camino.Ref`);
|
throw new Error(`Edge field ${type.fullName}.${field.name} must use camino.Ref`);
|
||||||
}
|
}
|
||||||
const isMany = isManyCardinality(declaredFromEndpoint.cardinality);
|
const isMany = isManyCardinality(declaredFromEndpoint.cardinality);
|
||||||
|
|||||||
Reference in New Issue
Block a user