Skip to content

Commit

Permalink
fix: allow models without field declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
ymc9 committed Oct 11, 2023
1 parent a5d15a3 commit f340a7d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/language/src/generated/grammar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2060,7 +2060,7 @@ export const ZModelGrammar = (): Grammar => loadedZModelGrammar ?? (loadedZModel
}
}
],
"cardinality": "+"
"cardinality": "*"
},
{
"$type": "Keyword",
Expand Down
2 changes: 1 addition & 1 deletion packages/language/src/zmodel.langium
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ DataModel:
'{' (
fields+=DataModelField
| attributes+=DataModelAttribute
)+
)*
'}';

DataModelField:
Expand Down
19 changes: 19 additions & 0 deletions packages/schema/tests/schema/abstract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,23 @@ describe('Abstract Schema Tests', () => {
});
await loadModel(content);
});

it('empty inheritance', async () => {
await loadModel(`
datasource db {
provider = 'postgresql'
url = env('DATABASE_URL')
}
generator js {
provider = 'prisma-client-js'
}
abstract model Base {
id Int @id @default(autoincrement())
}
model Foo extends Base {}
`);
});
});

0 comments on commit f340a7d

Please sign in to comment.