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 {
94
94
return reflection . isInstance ( item , ReferenceTarget ) ;
95
95
}
96
96
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 ;
98
98
99
99
export 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 ) ) ) ;
101
101
}
102
102
103
103
export type TypeDeclaration = DataModel | Enum ;
Original file line number Diff line number Diff line change @@ -2771,6 +2771,14 @@ export const ZModelGrammar = (): Grammar => loadedZModelGrammar ?? (loadedZModel
2771
2771
{
2772
2772
"$type": "Keyword",
2773
2773
"value": "sort"
2774
+ },
2775
+ {
2776
+ "$type": "Keyword",
2777
+ "value": "view"
2778
+ },
2779
+ {
2780
+ "$type": "Keyword",
2781
+ "value": "import"
2774
2782
}
2775
2783
]
2776
2784
},
Original file line number Diff line number Diff line change @@ -229,7 +229,7 @@ QualifiedName returns string:
229
229
// https://github.com/langium/langium/discussions/1012
230
230
RegularID returns string:
231
231
// 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' ;
233
233
234
234
// internal attribute
235
235
InternalAttributeName 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