Skip to content

Commit 4efba44

Browse files
committed
update
1 parent bff4ce6 commit 4efba44

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/language/src/validators/datamodel-validator.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ export default class DataModelValidator implements AstValidator<DataModel> {
272272

273273
// Use name because the current document might be updated
274274
let oppositeFields = getModelFieldsWithBases(oppositeModel, false).filter(
275-
(f) => f !== field && f.type.reference?.ref?.name === contextModel.name,
275+
(f) =>
276+
f.name !== field.name && // exclude self
277+
f.type.reference?.ref?.name === contextModel.name,
276278
);
277279
oppositeFields = oppositeFields.filter((f) => {
278280
const fieldRel = this.parseRelation(f);

tests/e2e/prisma-consistency/zmodel-validation.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { execSync } from 'child_process';
2+
import { randomUUID } from 'crypto';
23
import { existsSync, mkdirSync, rmSync, writeFileSync } from 'fs';
34
import { tmpdir } from 'os';
45
import { dirname, join } from 'path';
@@ -94,7 +95,7 @@ describe('ZenStack validation consistency with Prisma', () => {
9495
let tempDir: string;
9596

9697
beforeEach(() => {
97-
tempDir = join(tmpdir(), 'zenstack-validation-test-' + Date.now());
98+
tempDir = join(tmpdir(), 'zenstack-validation-test-' + randomUUID());
9899
tester = new ZenStackValidationTester(tempDir);
99100
});
100101

0 commit comments

Comments
 (0)