File tree Expand file tree Collapse file tree 4 files changed +32
-3
lines changed
tests/integration/tests/regression Expand file tree Collapse file tree 4 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -94,10 +94,10 @@ export function isReferenceTarget(item: unknown): item is ReferenceTarget {
9494 return reflection . isInstance ( item , ReferenceTarget ) ;
9595}
9696
97- export type RegularID = 'abstract' | 'attribute' | 'datasource' | 'enum' | 'in' | 'model' | 'plugin' | 'sort' | string ;
97+ export type RegularID = 'abstract' | 'attribute' | 'datasource' | 'enum' | 'import' | ' in' | 'model' | 'plugin' | 'sort' | 'view ' | string ;
9898
9999export function isRegularID ( item : unknown ) : item is RegularID {
100- return item === 'model' || item === 'enum' || item === 'attribute' || item === 'datasource' || item === 'plugin' || item === 'abstract' || item === 'in' || item === 'sort' || ( typeof item === 'string' && ( / [ _ a - z A - Z ] [ \w _ ] * / . test ( item ) ) ) ;
100+ return item === 'model' || item === 'enum' || item === 'attribute' || item === 'datasource' || item === 'plugin' || item === 'abstract' || item === 'in' || item === 'sort' || item === 'view' || item === 'import' || ( typeof item === 'string' && ( / [ _ a - z A - Z ] [ \w _ ] * / . test ( item ) ) ) ;
101101}
102102
103103export type TypeDeclaration = DataModel | Enum ;
Original file line number Diff line number Diff line change @@ -2771,6 +2771,14 @@ export const ZModelGrammar = (): Grammar => loadedZModelGrammar ?? (loadedZModel
27712771 {
27722772 "$type": "Keyword",
27732773 "value": "sort"
2774+ },
2775+ {
2776+ "$type": "Keyword",
2777+ "value": "view"
2778+ },
2779+ {
2780+ "$type": "Keyword",
2781+ "value": "import"
27742782 }
27752783 ]
27762784 },
Original file line number Diff line number Diff line change @@ -229,7 +229,7 @@ QualifiedName returns string:
229229// https://github.com/langium/langium/discussions/1012
230230RegularID returns string:
231231 // include keywords that we'd like to work as ID in most places
232- ID | 'model' | 'enum' | 'attribute' | 'datasource' | 'plugin' | 'abstract' | 'in' | 'sort';
232+ ID | 'model' | 'enum' | 'attribute' | 'datasource' | 'plugin' | 'abstract' | 'in' | 'sort' | 'view' | 'import' ;
233233
234234// internal attribute
235235InternalAttributeName returns string:
Original file line number Diff line number Diff line change 1+ import { loadSchema } from '@zenstackhq/testtools' ;
2+
3+ describe ( 'Regression: issue 735' , ( ) => {
4+ it ( 'regression' , async ( ) => {
5+ await loadSchema (
6+ `
7+ model MyModel {
8+ id String @id @default(cuid())
9+ view String
10+ import Int
11+ }
12+
13+ model view {
14+ id String @id @default(cuid())
15+ name String
16+ }
17+ ` ,
18+ { pushDb : false }
19+ ) ;
20+ } ) ;
21+ } ) ;
You can’t perform that action at this time.
0 commit comments