@sap/cds-compiler 5.9.4 → 6.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +104 -319
- package/README.md +1 -1
- package/bin/cds_update_identifiers.js +3 -5
- package/bin/cdsc.js +22 -8
- package/bin/cdshi.js +1 -1
- package/bin/cdsse.js +4 -4
- package/doc/CHANGELOG_BETA.md +11 -0
- package/doc/CHANGELOG_DEPRECATED.md +29 -0
- package/lib/api/main.js +8 -5
- package/lib/api/options.js +12 -10
- package/lib/base/builtins.js +1 -0
- package/lib/base/message-registry.js +190 -96
- package/lib/base/messages.js +29 -20
- package/lib/base/model.js +14 -24
- package/lib/checks/actionsFunctions.js +10 -20
- package/lib/checks/annotationsOData.js +1 -1
- package/lib/checks/elements.js +30 -10
- package/lib/checks/enums.js +31 -0
- package/lib/checks/foreignKeys.js +2 -2
- package/lib/checks/hasPersistedElements.js +5 -0
- package/lib/checks/invalidTarget.js +1 -1
- package/lib/checks/managedWithoutKeys.js +5 -4
- package/lib/checks/queryNoDbArtifacts.js +10 -8
- package/lib/checks/types.js +5 -5
- package/lib/checks/validator.js +6 -4
- package/lib/compiler/assert-consistency.js +12 -9
- package/lib/compiler/checks.js +18 -50
- package/lib/compiler/define.js +6 -6
- package/lib/compiler/extend.js +2 -1
- package/lib/compiler/generate.js +14 -17
- package/lib/compiler/populate.js +8 -31
- package/lib/compiler/propagator.js +21 -35
- package/lib/compiler/resolve.js +35 -22
- package/lib/compiler/shared.js +7 -1
- package/lib/compiler/tweak-assocs.js +1 -1
- package/lib/compiler/utils.js +1 -1
- package/lib/edm/annotations/edmJson.js +20 -15
- package/lib/edm/annotations/genericTranslation.js +7 -8
- package/lib/edm/csn2edm.js +46 -50
- package/lib/edm/edm.js +8 -7
- package/lib/edm/edmPreprocessor.js +33 -83
- package/lib/edm/edmUtils.js +2 -2
- package/lib/gen/BaseParser.js +55 -44
- package/lib/gen/CdlGrammar.checksum +1 -1
- package/lib/gen/CdlParser.js +1133 -1150
- package/lib/json/from-csn.js +70 -43
- package/lib/json/to-csn.js +6 -8
- package/lib/language/multiLineStringParser.js +3 -2
- package/lib/main.d.ts +58 -24
- package/lib/model/csnUtils.js +28 -39
- package/lib/model/xprAsTree.js +23 -9
- package/lib/modelCompare/compare.js +5 -4
- package/lib/optionProcessor.js +21 -17
- package/lib/parsers/AstBuildingParser.js +63 -11
- package/lib/parsers/XprTree.js +57 -3
- package/lib/parsers/identifiers.js +1 -1
- package/lib/parsers/index.js +0 -3
- package/lib/render/manageConstraints.js +25 -25
- package/lib/render/toCdl.js +173 -170
- package/lib/render/toHdbcds.js +126 -128
- package/lib/render/toRename.js +7 -7
- package/lib/render/toSql.js +128 -125
- package/lib/render/utils/common.js +47 -22
- package/lib/render/utils/delta.js +25 -25
- package/lib/render/utils/operators.js +2 -2
- package/lib/render/utils/pretty.js +5 -5
- package/lib/render/utils/sql.js +13 -13
- package/lib/render/utils/standardDatabaseFunctions.js +115 -103
- package/lib/render/utils/unique.js +4 -4
- package/lib/transform/db/applyTransformations.js +1 -1
- package/lib/transform/db/assertUnique.js +2 -2
- package/lib/transform/db/associations.js +6 -7
- package/lib/transform/db/assocsToQueries/utils.js +4 -5
- package/lib/transform/db/backlinks.js +12 -9
- package/lib/transform/db/cdsPersistence.js +8 -7
- package/lib/transform/db/constraints.js +13 -10
- package/lib/transform/db/expansion.js +7 -3
- package/lib/transform/db/flattening.js +4 -14
- package/lib/transform/db/processSqlServices.js +2 -1
- package/lib/transform/db/temporal.js +5 -7
- package/lib/transform/db/views.js +2 -4
- package/lib/transform/draft/db.js +8 -8
- package/lib/transform/draft/odata.js +10 -7
- package/lib/transform/forOdata.js +10 -5
- package/lib/transform/forRelationalDB.js +5 -75
- package/lib/transform/localized.js +1 -1
- package/lib/transform/odata/createForeignKeys.js +11 -10
- package/lib/transform/odata/flattening.js +8 -4
- package/lib/transform/odata/foreignKeyRefsInXprAnnos.js +96 -0
- package/lib/transform/odata/typesExposure.js +3 -3
- package/lib/transform/transformUtils.js +4 -8
- package/lib/transform/translateAssocsToJoins.js +14 -7
- package/lib/transform/universalCsn/universalCsnEnricher.js +10 -4
- package/lib/utils/objectUtils.js +0 -17
- package/package.json +10 -13
- package/share/messages/def-upcoming-virtual-change.md +1 -1
- package/LICENSE +0 -37
- package/bin/cds_remove_invalid_whitespace.js +0 -138
- package/doc/CHANGELOG_ARCHIVE.md +0 -3604
- package/lib/gen/genericAntlrParser.js +0 -3
- package/lib/gen/language.checksum +0 -1
- package/lib/gen/language.interp +0 -456
- package/lib/gen/language.tokens +0 -180
- package/lib/gen/languageLexer.interp +0 -439
- package/lib/gen/languageLexer.js +0 -1483
- package/lib/gen/languageLexer.tokens +0 -167
- package/lib/gen/languageParser.js +0 -24941
- package/lib/language/antlrParser.js +0 -205
- package/lib/language/errorStrategy.js +0 -646
- package/lib/language/genericAntlrParser.js +0 -1572
- package/lib/parsers/CdlGrammar.g4 +0 -2070
|
@@ -35,22 +35,49 @@
|
|
|
35
35
|
|
|
36
36
|
'use strict';
|
|
37
37
|
|
|
38
|
-
const { CompilerAssertion } = require('./error');
|
|
39
|
-
const {
|
|
38
|
+
const { CompilerAssertion } = require( './error' );
|
|
39
|
+
const { isDeprecatedEnabled } = require( './model' );
|
|
40
|
+
|
|
41
|
+
const configurableForValidValues = {
|
|
42
|
+
__proto__: null,
|
|
43
|
+
// can always be downgraded, we do not really care:
|
|
44
|
+
true: () => true,
|
|
45
|
+
// like `true`, but is intended to be removed or made 'deprecated' with v7:
|
|
46
|
+
v7: () => true,
|
|
47
|
+
// only configurable if option deprecated.downgradableErrors is set:
|
|
48
|
+
deprecated: options => isDeprecatedEnabled( options, 'downgradableErrors' ),
|
|
49
|
+
// still allow to produce output in tests:
|
|
50
|
+
test: options => options.testMode != null,
|
|
51
|
+
};
|
|
40
52
|
|
|
53
|
+
const validModules = [ // for configurableFor and errorFor
|
|
54
|
+
'v7', // pseudo module in errorFor: planned as error
|
|
55
|
+
'compile',
|
|
56
|
+
'for.odata',
|
|
57
|
+
'to.edmx',
|
|
58
|
+
'to.hdbcds',
|
|
59
|
+
'to.hdi',
|
|
60
|
+
'to.sql',
|
|
61
|
+
'to.sql.migration',
|
|
62
|
+
'to.sql.migration-script',
|
|
63
|
+
'to.rename',
|
|
64
|
+
'for.effective',
|
|
65
|
+
];
|
|
41
66
|
/**
|
|
42
67
|
* Central register of messages and their configuration.
|
|
43
68
|
* Group by id-category.
|
|
44
69
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
70
|
+
* Message with severity 'Error' can have a configurableFor property. Its value
|
|
71
|
+
* is either array of modules (see validModules) where the error can be
|
|
72
|
+
* downgraded, or a value in configurableForValidValues.
|
|
73
|
+
*
|
|
74
|
+
* Messages with another severity can have an errorFor property. Its value is an
|
|
75
|
+
* array of modules (see validModules) where the message is turned into an error.
|
|
50
76
|
*
|
|
51
77
|
* @type {Object<string, MessageConfig>}
|
|
52
78
|
*/
|
|
53
79
|
const centralMessages = {
|
|
80
|
+
'api-deprecated-hdbcds': { severity: 'Error', configurableFor: true },
|
|
54
81
|
'anno-definition': { severity: 'Warning' },
|
|
55
82
|
'anno-duplicate': { severity: 'Error', configurableFor: true }, // does not hurt us
|
|
56
83
|
'anno-duplicate-unrelated-layer': { severity: 'Error', configurableFor: true }, // does not hurt us
|
|
@@ -76,9 +103,7 @@ const centralMessages = {
|
|
|
76
103
|
|
|
77
104
|
'type-invalid-items': { severity: 'Error' }, // not supported yet
|
|
78
105
|
'assoc-as-type': { severity: 'Error' }, // TODO: allow more, but not all
|
|
79
|
-
|
|
80
|
-
'assoc-incomplete-to-many': { severity: 'Warning', errorFor: [ 'v6' ] },
|
|
81
|
-
'def-unexpected-nested-proj': { severity: 'Error', configurableFor: 'v4' },
|
|
106
|
+
'def-unexpected-nested-proj': { severity: 'Error' },
|
|
82
107
|
'def-unexpected-paramview-assoc': { severity: 'Error' },
|
|
83
108
|
'def-unexpected-calcview-assoc': { severity: 'Error' },
|
|
84
109
|
'chained-array-of': { severity: 'Error' },
|
|
@@ -100,7 +125,7 @@ const centralMessages = {
|
|
|
100
125
|
'ref-unexpected-self': { severity: 'Error' },
|
|
101
126
|
'ref-invalid-include': { severity: 'Error' },
|
|
102
127
|
'type-unexpected-typeof': { severity: 'Error' },
|
|
103
|
-
'type-unexpected-null': { severity: '
|
|
128
|
+
'type-unexpected-null': { severity: 'Error', configurableFor: true },
|
|
104
129
|
'type-ignoring-argument': { severity: 'Error', configurableFor: true },
|
|
105
130
|
'type-expected-builtin': { severity: 'Error', configurableFor: true },
|
|
106
131
|
'type-expecting-service-target': { severity: 'Error', configurableFor: true },
|
|
@@ -109,7 +134,7 @@ const centralMessages = {
|
|
|
109
134
|
'ref-invalid-source': { severity: 'Error' },
|
|
110
135
|
'ref-invalid-target': { severity: 'Error' },
|
|
111
136
|
'ref-missing-self-counterpart': { severity: 'Error', configurableFor: true },
|
|
112
|
-
'ref-sloppy-target': { severity: 'Error', configurableFor: '
|
|
137
|
+
'ref-sloppy-target': { severity: 'Error', configurableFor: 'deprecated' },
|
|
113
138
|
|
|
114
139
|
'extend-repeated-intralayer': { severity: 'Warning' },
|
|
115
140
|
'extend-unrelated-layer': { severity: 'Info' },
|
|
@@ -137,10 +162,11 @@ const centralMessages = {
|
|
|
137
162
|
'ref-undefined-element': { severity: 'Error' },
|
|
138
163
|
'anno-undefined-element': { severity: 'Error' },
|
|
139
164
|
'ref-unknown-var': { severity: 'Info' },
|
|
140
|
-
'ref-obsolete-parameters': { severity: 'Error', configurableFor: '
|
|
165
|
+
'ref-obsolete-parameters': { severity: 'Error', configurableFor: 'deprecated' },
|
|
141
166
|
// does not hurt us, but makes it tedious to detect parameter refs
|
|
142
167
|
'ref-undefined-param': { severity: 'Error' },
|
|
143
168
|
'ref-undefined-enum': { severity: 'Warning', errorFor: [ 'to.sql', 'to.hdbcds', 'to.hdi' ] },
|
|
169
|
+
'ref-unexpected-enum': { severity: 'Warning', errorFor: [ 'to.sql', 'to.hdbcds', 'to.hdi' ] },
|
|
144
170
|
'anno-undefined-param': { severity: 'Error' },
|
|
145
171
|
'ref-rejected-on': { severity: 'Error' },
|
|
146
172
|
'ref-expected-element': { severity: 'Error' },
|
|
@@ -155,60 +181,62 @@ const centralMessages = {
|
|
|
155
181
|
|
|
156
182
|
'expr-unexpected-operator': { severity: 'Error', configurableFor: true },
|
|
157
183
|
|
|
158
|
-
'syntax-deprecated-auto-union': { severity: 'Error', configurableFor: 'v4' },
|
|
159
184
|
// Published! Used in @sap/cds-lsp; if renamed, add to oldMessageIds and contact colleagues
|
|
160
185
|
// Also used by other projects that rely on double-quotes for delimited identifiers.
|
|
161
186
|
'syntax-deprecated-ident': { severity: 'Error', configurableFor: true },
|
|
162
|
-
'syntax-deprecated-property': { severity: 'Error', configurableFor: '
|
|
163
|
-
'syntax-deprecated-value': { severity: 'Error', configurableFor: '
|
|
187
|
+
'syntax-deprecated-property': { severity: 'Error', configurableFor: 'test' }, // v0 prop
|
|
188
|
+
'syntax-deprecated-value': { severity: 'Error', configurableFor: 'test' }, // v0 prop
|
|
164
189
|
// 'syntax-duplicate-annotate' came late with v3 - make it configurable as
|
|
165
190
|
// fallback, but then parse.cdl is not supposed to work correctly (it can
|
|
166
191
|
// then either issue an error or produce a CSN missing some annotations):
|
|
167
192
|
'syntax-duplicate-annotate': { severity: 'Error' },
|
|
168
|
-
'syntax-duplicate-clause': { severity: 'Error'
|
|
193
|
+
'syntax-duplicate-clause': { severity: 'Error' },
|
|
169
194
|
// remark: a hard syntax error in new parser for `null` together with `not null`
|
|
170
|
-
'syntax-duplicate-equal-clause': { severity: 'Warning'
|
|
171
|
-
'syntax-invalid-name': { severity: 'Error'
|
|
195
|
+
'syntax-duplicate-equal-clause': { severity: 'Warning' },
|
|
196
|
+
'syntax-invalid-name': { severity: 'Error' },
|
|
172
197
|
'syntax-missing-as': { severity: 'Error', configurableFor: true },
|
|
173
198
|
'syntax-missing-proj-semicolon': { severity: 'Warning' },
|
|
174
|
-
'syntax-unexpected-after': { severity: '
|
|
175
|
-
'syntax-unexpected-filter': { severity: '
|
|
176
|
-
'syntax-unexpected-many-one': { severity: 'Error'
|
|
177
|
-
'syntax-deprecated-ref-virtual': { severity: '
|
|
199
|
+
'syntax-unexpected-after': { severity: 'Error' },
|
|
200
|
+
'syntax-unexpected-filter': { severity: 'Error', configurableFor: true },
|
|
201
|
+
'syntax-unexpected-many-one': { severity: 'Error' },
|
|
202
|
+
'syntax-deprecated-ref-virtual': { severity: 'Error' },
|
|
178
203
|
'syntax-unexpected-reserved-word': { severity: 'Error', configurableFor: true },
|
|
179
204
|
'syntax-unknown-escape': { severity: 'Error', configurableFor: true },
|
|
180
205
|
'syntax-unsupported-masked': { severity: 'Error', configurableFor: 'deprecated' },
|
|
181
206
|
'syntax-unexpected-sql-clause': { severity: 'Error' }, // TODO: configurableFor:'tests'?
|
|
182
|
-
'syntax-invalid-space': { severity: 'Error', configurableFor:
|
|
207
|
+
'syntax-invalid-space': { severity: 'Error', configurableFor: true },
|
|
183
208
|
'syntax-expecting-space': { severity: 'Error' },
|
|
184
209
|
'syntax-unexpected-anno': { severity: 'Error' },
|
|
185
210
|
'migration-unsupported-key-change': { severity: 'Error', configurableFor: [ 'to.sql.migration', 'to.sql.migration-script' ] },
|
|
186
|
-
'type-missing-enum-value': { severity: 'Error', configurableFor: '
|
|
211
|
+
'type-missing-enum-value': { severity: 'Error', configurableFor: 'deprecated' },
|
|
187
212
|
|
|
188
213
|
'def-missing-element': { severity: 'Error' },
|
|
214
|
+
'def-missing-virtual': { severity: 'Error', configurableFor: true },
|
|
189
215
|
'def-expected-structured': { severity: 'Error', configurableFor: true },
|
|
190
216
|
'def-unsupported-calc-elem': { severity: 'Error', configurableFor: true },
|
|
191
217
|
|
|
192
218
|
'def-invalid-key-cardinality': { severity: 'Error' },
|
|
193
|
-
|
|
194
|
-
'odata-
|
|
195
|
-
|
|
196
|
-
'odata-
|
|
197
|
-
|
|
198
|
-
'odata-
|
|
199
|
-
'odata-
|
|
200
|
-
'odata-
|
|
201
|
-
|
|
202
|
-
'odata-
|
|
203
|
-
|
|
204
|
-
'odata-
|
|
205
|
-
'odata-
|
|
206
|
-
'odata-
|
|
207
|
-
'odata-
|
|
208
|
-
'odata-
|
|
209
|
-
'odata-
|
|
210
|
-
'odata-
|
|
211
|
-
'odata-
|
|
219
|
+
|
|
220
|
+
'odata-unexpected-array': { severity: 'Warning' },
|
|
221
|
+
'odata-unexpected-assoc': { severity: 'Warning' },
|
|
222
|
+
'odata-incomplete-constraints': { severity: 'Info' },
|
|
223
|
+
'odata-invalid-name': { severity: 'Error', configurableFor: true },
|
|
224
|
+
'odata-invalid-vocabulary-alias': { severity: 'Error', configurableFor: true },
|
|
225
|
+
'odata-invalid-qualifier': { severity: 'Error', configurableFor: true },
|
|
226
|
+
'odata-invalid-service-name': { severity: 'Warning' },
|
|
227
|
+
'odata-invalid-param-type': { severity: 'Warning' },
|
|
228
|
+
'odata-invalid-return-type': { severity: 'Warning' },
|
|
229
|
+
'odata-missing-type': { severity: 'Error', configurableFor: true },
|
|
230
|
+
'odata-invalid-scale': { severity: 'Error', configurableFor: true },
|
|
231
|
+
'odata-unexpected-edm-facet': { severity: 'Error', configurableFor: true },
|
|
232
|
+
'odata-invalid-external-type': { severity: 'Error', configurableFor: true },
|
|
233
|
+
'odata-unexpected-edm-type': { severity: 'Error', configurableFor: true },
|
|
234
|
+
'odata-unknown-edm-type': { severity: 'Error', configurableFor: true },
|
|
235
|
+
'odata-missing-key': { severity: 'Error', configurableFor: true },
|
|
236
|
+
'odata-unexpected-arrayed-key': { severity: 'Error', configurableFor: true },
|
|
237
|
+
'odata-unexpected-nullable-key': { severity: 'Error', configurableFor: true },
|
|
238
|
+
'odata-invalid-key-type': { severity: 'Warning' },
|
|
239
|
+
'odata-invalid-property-name': { severity: 'Warning' },
|
|
212
240
|
'odata-anno-preproc': { severity: 'Warning' },
|
|
213
241
|
'odata-anno-dict': { severity: 'Warning' },
|
|
214
242
|
'odata-anno-vocref': { severity: 'Warning' },
|
|
@@ -216,7 +244,11 @@ const centralMessages = {
|
|
|
216
244
|
'odata-anno-value': { severity: 'Warning' },
|
|
217
245
|
'odata-anno-type': { severity: 'Warning' },
|
|
218
246
|
'odata-anno-def': { severity: 'Info' },
|
|
247
|
+
'odata-duplicate-definition': { severity: 'Error' },
|
|
248
|
+
'odata-duplicate-proxy': { severity: 'Warning' },
|
|
249
|
+
|
|
219
250
|
'query-ignoring-assoc-in-union': { severity: 'Info' },
|
|
251
|
+
|
|
220
252
|
// for to.sql.migration - cannot be supplied by the user!
|
|
221
253
|
'migration-unsupported-precision-change': { severity: 'Error', configurableFor: [ 'to.sql.migration-script' ] },
|
|
222
254
|
'migration-unsupported-element-drop': { severity: 'Error', configurableFor: [ 'to.sql.migration-script' ] },
|
|
@@ -231,26 +263,46 @@ const centralMessages = {
|
|
|
231
263
|
// We keep them in a separate array for easier access. No need to go through all
|
|
232
264
|
// existing messages and search for the old one in `oldNames` property.
|
|
233
265
|
// The keys will be added to `oldNames` of the new message, which is used for reclassification.
|
|
234
|
-
const oldMessageIds =
|
|
266
|
+
const oldMessageIds = {
|
|
267
|
+
__proto__: null,
|
|
268
|
+
|
|
235
269
|
'old-anno-duplicate': 'anno-duplicate', // Example
|
|
270
|
+
|
|
236
271
|
'assoc-in-array': 'type-invalid-items',
|
|
237
272
|
'duplicate-autoexposed': 'def-duplicate-autoexposed',
|
|
238
273
|
'expr-no-filter': 'expr-unexpected-filter',
|
|
239
274
|
'check-proper-type': 'def-missing-type',
|
|
240
|
-
|
|
275
|
+
|
|
276
|
+
// All odata messages were renamed in v6. Some were split up into separate ones.
|
|
277
|
+
'odata-spec-violation-array': 'odata-unexpected-array',
|
|
278
|
+
'odata-spec-violation-assoc': 'odata-unexpected-assoc',
|
|
279
|
+
'odata-spec-violation-constraints': 'odata-incomplete-constraints',
|
|
280
|
+
'odata-spec-violation-id': [ 'odata-invalid-name', 'odata-invalid-vocabulary-alias', 'odata-invalid-qualifier' ],
|
|
281
|
+
'odata-spec-violation-namespace': 'odata-invalid-service-name',
|
|
282
|
+
'odata-spec-violation-param': 'odata-invalid-param-type',
|
|
283
|
+
'odata-spec-violation-returns': 'odata-invalid-return-type',
|
|
284
|
+
'odata-spec-violation-type': [ 'odata-unexpected-edm-facet', 'odata-missing-type', 'odata-invalid-scale', 'odata-unexpected-edm-type', 'odata-invalid-external-type' ],
|
|
285
|
+
'odata-spec-violation-type-unknown': 'odata-unknown-edm-type',
|
|
286
|
+
'odata-spec-violation-no-key': 'odata-missing-key',
|
|
287
|
+
'odata-spec-violation-key-array': 'odata-unexpected-arrayed-key',
|
|
288
|
+
'odata-spec-violation-key-type': 'odata-invalid-key-type',
|
|
289
|
+
'odata-spec-violation-key-null': 'odata-unexpected-nullable-key',
|
|
290
|
+
'odata-spec-violation-property-name': 'odata-invalid-property-name',
|
|
291
|
+
'odata-definition-exists': [ 'odata-duplicate-definition', 'odata-duplicate-proxy' ],
|
|
292
|
+
};
|
|
241
293
|
|
|
242
294
|
// Set up the old-to-new message ID mapping in the message registry.
|
|
243
295
|
for (const oldName in oldMessageIds) {
|
|
244
|
-
const newName = oldMessageIds[oldName];
|
|
245
296
|
if (centralMessages[oldName])
|
|
246
297
|
throw new CompilerAssertion(`Mapping from ${ oldName } not possible: ID is still used in message registry.`);
|
|
247
|
-
if (!centralMessages[newName])
|
|
248
|
-
throw new CompilerAssertion(`Mapping from ${ oldName } to new message ID ${ newName } does not exist!`);
|
|
249
298
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
299
|
+
const newNames = Array.isArray(oldMessageIds[oldName]) ? oldMessageIds[oldName] : [ oldMessageIds[oldName] ];
|
|
300
|
+
for (const newName of newNames) {
|
|
301
|
+
if (!centralMessages[newName])
|
|
302
|
+
throw new CompilerAssertion(`Mapping from ${ oldName } to new message ID ${ newName } does not exist!`);
|
|
303
|
+
centralMessages[newName].oldNames ??= [ ];
|
|
253
304
|
centralMessages[newName].oldNames.push(oldName);
|
|
305
|
+
}
|
|
254
306
|
}
|
|
255
307
|
|
|
256
308
|
|
|
@@ -259,9 +311,7 @@ for (const oldName in oldMessageIds) {
|
|
|
259
311
|
// If you change it, keep in sync with scripts/eslint/rules/message-text.js
|
|
260
312
|
|
|
261
313
|
const centralMessageTexts = {
|
|
262
|
-
'api-deprecated-
|
|
263
|
-
std: 'Support for generating hdbcds output is deprecated with @sap/cds-compiler v5 and later',
|
|
264
|
-
},
|
|
314
|
+
'api-deprecated-hdbcds': 'Support for generating hdbcds output is deprecated with @sap/cds-compiler v5 and later',
|
|
265
315
|
'api-invalid-option': {
|
|
266
316
|
std: 'Invalid option $(NAME)!',
|
|
267
317
|
deprecated: 'Option $(NAME) is no longer supported! Use latest API options instead',
|
|
@@ -270,10 +320,12 @@ const centralMessageTexts = {
|
|
|
270
320
|
value2: 'Expected option $(OPTION) to have value $(VALUE) or $(RAWVALUE); found: $(OTHERVALUE)',
|
|
271
321
|
type: 'Expected option $(OPTION) to be of type $(VALUE). Found: $(OTHERVALUE)',
|
|
272
322
|
forbidden: 'Option $(OPTION) can\'t be used with API function $(MODULE)',
|
|
323
|
+
odataV2json: 'OData JSON output is not available for OData V2',
|
|
273
324
|
},
|
|
274
325
|
'def-upcoming-virtual-change': {
|
|
275
|
-
std: 'This select item
|
|
326
|
+
std: 'This select item is a new element in cds-compiler v6, but only supported with the new parser',
|
|
276
327
|
},
|
|
328
|
+
'query-invalid-virtual-struct': 'For a virtual structure in a query, use a defined structure type, or add $(CODE) when you meant to specify references',
|
|
277
329
|
|
|
278
330
|
'api-invalid-variable-replacement': {
|
|
279
331
|
std: 'Option $(OPTION) does not support $(NAME)',
|
|
@@ -282,12 +334,18 @@ const centralMessageTexts = {
|
|
|
282
334
|
noDollar: 'Option $(OPTION) does not know $(NAME). Did you forget a leading $(CODE)?',
|
|
283
335
|
},
|
|
284
336
|
|
|
337
|
+
'api-invalid-version': {
|
|
338
|
+
std: 'Invalid CSN version: $(VERSION)',
|
|
339
|
+
migrationComparison: 'Incompatible CSN versions: $(VALUE) is a major downgrade from $(OTHERVALUE). Is @sap/cds-compiler version $(VERSION) outdated?',
|
|
340
|
+
},
|
|
341
|
+
|
|
285
342
|
'api-invalid-combination': {
|
|
286
343
|
std: 'Invalid option combination found: $(OPTION) and $(PROP)', // unused
|
|
287
344
|
'valid-structured': 'Structured OData is only supported with OData version v4',
|
|
288
345
|
'sql-dialect-and-naming': 'sqlDialect $(NAME) can\'t be combined with sqlMapping $(PROP)',
|
|
289
346
|
'tenant-and-naming': 'Option $(OPTION) can\'t be combined with sqlMapping $(PROP) - expected sqlMapping $(VALUE)',
|
|
290
347
|
'dry-and-script': 'script:true must be combined with dry:true, found $(VALUE)',
|
|
348
|
+
'hana-migration': 'SQL dialect $(VALUE) is not supported with API function "to.sql.migration" - use HDI via "to.hdi" and "to.hdi.migration"',
|
|
291
349
|
'effectiveServiceName-and-type-resolution': 'Option $(NAME) can\'t be used without $(PROP)',
|
|
292
350
|
},
|
|
293
351
|
'api-unexpected-combination': {
|
|
@@ -448,6 +506,8 @@ const centralMessageTexts = {
|
|
|
448
506
|
std: 'You have already provided this clause',
|
|
449
507
|
cardinality: 'You have already provided a target cardinality $(CODE) instead, at line $(LINE), column $(COL)',
|
|
450
508
|
notNull: 'You have already provided $(CODE) instead, at line $(LINE), column $(COL) below',
|
|
509
|
+
orderByLimit: 'You have already provided $(CODE) before',
|
|
510
|
+
setForCsn: 'You have provided property $(PROP)/$(SIBLINGPROP) inside and outside $(PARENTPROP)',
|
|
451
511
|
},
|
|
452
512
|
'syntax-duplicate-equal-clause': {
|
|
453
513
|
std: 'You have already provided the same clause',
|
|
@@ -611,6 +671,7 @@ const centralMessageTexts = {
|
|
|
611
671
|
// to help users for `… from E:toF { toF[…].x }`
|
|
612
672
|
tableAlias: 'A filter can only be provided when navigating along associations, but found table alias',
|
|
613
673
|
from: 'A filter can only be provided for the source entity or associations',
|
|
674
|
+
'model-only': 'A filter can\'t be provided for a to-many association without ON-condition',
|
|
614
675
|
},
|
|
615
676
|
|
|
616
677
|
// multi-line strings: --------------------------------------------------------
|
|
@@ -632,6 +693,12 @@ const centralMessageTexts = {
|
|
|
632
693
|
|
|
633
694
|
// Messages for erroneous references -----------------------------------------
|
|
634
695
|
// location at erroneous reference (if possible)
|
|
696
|
+
'ref-cyclic': {
|
|
697
|
+
std: 'Illegal circular reference to $(ART)',
|
|
698
|
+
element: 'Illegal circular reference to element $(MEMBER) of $(ART)',
|
|
699
|
+
target: 'Illegal circular reference to target $(ART)',
|
|
700
|
+
type: 'Illegal recursive type definition to $(TYPE)',
|
|
701
|
+
},
|
|
635
702
|
'ref-deprecated-orderby': 'Replace source element reference $(ID) by $(NEWCODE); auto-corrected',
|
|
636
703
|
'ref-missing-self-counterpart' : {
|
|
637
704
|
std: 'Expected to find a matching element in $self-comparison for foreign key $(PROP) of association $(NAME)',
|
|
@@ -690,7 +757,13 @@ const centralMessageTexts = {
|
|
|
690
757
|
self: 'Variable $(ID) has not been found. Use $(ALIAS) to refer an element with the same name',
|
|
691
758
|
value: 'No value found for variable $(ID). Use option $(OPTION) to specify a value for $(ID)',
|
|
692
759
|
},
|
|
693
|
-
'ref-undefined-enum'
|
|
760
|
+
'ref-undefined-enum': 'Enum symbol $(ID) is not defined in $(TYPE)',
|
|
761
|
+
'ref-unexpected-enum': {
|
|
762
|
+
std: 'Unexpected enum reference $(ENUM)',
|
|
763
|
+
symbolDef: 'References to other values are not allowed as enum values',
|
|
764
|
+
untyped: 'Unexpected enum reference $(ENUM); no type can be inferred for it',
|
|
765
|
+
invalidType: 'Unexpected enum reference $(ENUM) as value for a non-enum type $(TYPE)',
|
|
766
|
+
},
|
|
694
767
|
'ref-unknown-var': {
|
|
695
768
|
std: 'No replacement found for special variable $(ID)',
|
|
696
769
|
},
|
|
@@ -738,6 +811,13 @@ const centralMessageTexts = {
|
|
|
738
811
|
'managed-filter': 'Unexpected managed association $(NAME) in filter expression of $(ID)',
|
|
739
812
|
'unmanaged-filter': 'Unexpected unmanaged association $(NAME) in filter expression of $(ID)',
|
|
740
813
|
},
|
|
814
|
+
'ref-unexpected-assoc-type': {
|
|
815
|
+
std: 'An association is not allowed as this artifact\'s type', // Not used
|
|
816
|
+
'action-param': 'An association is not allowed as action\'s parameter type',
|
|
817
|
+
'function-param': 'An association is not allowed as function\'s parameter type',
|
|
818
|
+
'action-returns': 'An association is not allowed as action\'s return type',
|
|
819
|
+
'function-returns': 'An association is not allowed as function\'s return type',
|
|
820
|
+
},
|
|
741
821
|
'ref-unexpected-calculated': {
|
|
742
822
|
std: 'Unexpected reference to calculated element',
|
|
743
823
|
on: 'Calculated elements (on-read) can\'t be used in ON-conditions of unmanaged associations',
|
|
@@ -771,6 +851,7 @@ const centralMessageTexts = {
|
|
|
771
851
|
hana: 'Type $(TYPE) is only supported for SQL dialect $(VALUE), not $(OTHERVALUE)',
|
|
772
852
|
hdbcds:'Type $(TYPE) is not supported in HDBCDS',
|
|
773
853
|
odata: 'Type $(TYPE) is not supported for OData $(VERSION)',
|
|
854
|
+
key: 'Type $(TYPE) can\'t be used as primary key in element $(NAME)',
|
|
774
855
|
},
|
|
775
856
|
'ref-unexpected-var': {
|
|
776
857
|
std: 'Variable $(NAME) can\'t be used here',
|
|
@@ -918,6 +999,7 @@ const centralMessageTexts = {
|
|
|
918
999
|
},
|
|
919
1000
|
'def-unexpected-localized-struct': '$(KEYWORD) is not fully supported for structures',
|
|
920
1001
|
'def-unexpected-localized-anno': 'Annotations can\'t have localized elements',
|
|
1002
|
+
'def-unexpected-virtual': 'Unexpected $(KEYWORD): an element can\'t be virtual and an association/composition',
|
|
921
1003
|
'type-unexpected-structure': {
|
|
922
1004
|
std: 'Unexpected structured type', // unused variant
|
|
923
1005
|
calc: 'A structured type can\'t be used for calculated elements',
|
|
@@ -1070,6 +1152,7 @@ const centralMessageTexts = {
|
|
|
1070
1152
|
std: 'Using nested projections next to calculated elements is not supported, yet',
|
|
1071
1153
|
inside: 'Using calculated elements in nested projections is not supported, yet',
|
|
1072
1154
|
},
|
|
1155
|
+
'query-unsupported-asterisk': 'Unsupported asterisk in $(CODE) inside a nested projection',
|
|
1073
1156
|
'query-mismatched-element': {
|
|
1074
1157
|
std: 'Specified element $(NAME) differs from inferred element in property $(PROP)',
|
|
1075
1158
|
type: 'Expected type of specified element $(NAME) to be the same as the inferred element\'s type',
|
|
@@ -1158,6 +1241,12 @@ const centralMessageTexts = {
|
|
|
1158
1241
|
targetVal: 'Target minimum cardinality must not be greater than target maximum cardinality',
|
|
1159
1242
|
},
|
|
1160
1243
|
|
|
1244
|
+
'type-invalid-self': 'An association that uses $(NAME) in its ON-condition can\'t be compared to $(NAME)',
|
|
1245
|
+
'type-invalid-foreign-key': {
|
|
1246
|
+
std: 'Unexpected type $(TYPE) in foreign key',
|
|
1247
|
+
items: 'Unexpected arrayed element as foreign keys',
|
|
1248
|
+
},
|
|
1249
|
+
|
|
1161
1250
|
'i18n-different-value': 'Different translation for key $(PROP) of language $(OTHERPROP) in unrelated layers',
|
|
1162
1251
|
|
|
1163
1252
|
'expr-missing-foreign-key': {
|
|
@@ -1184,58 +1273,58 @@ const centralMessageTexts = {
|
|
|
1184
1273
|
// OData Message section starts here
|
|
1185
1274
|
// -----------------------------------------------------------------------------------
|
|
1186
1275
|
// OData version dependent messages
|
|
1187
|
-
'odata-
|
|
1188
|
-
'odata-
|
|
1189
|
-
'odata-
|
|
1190
|
-
'odata-
|
|
1191
|
-
'odata-
|
|
1192
|
-
'odata-
|
|
1276
|
+
'odata-unexpected-array': 'Unexpected array type for OData $(VERSION)',
|
|
1277
|
+
'odata-invalid-param-type' : 'Expected parameter to be typed with either scalar or structured type for OData $(VERSION)',
|
|
1278
|
+
'odata-invalid-return-type': 'Expected $(KIND) to return one or many values of scalar, complex, entity or view type for OData $(VERSION)',
|
|
1279
|
+
'odata-unexpected-assoc': 'Unexpected association in structured type for OData $(VERSION)',
|
|
1280
|
+
'odata-incomplete-constraints': 'Partial referential constraints produced for OData $(VERSION)',
|
|
1281
|
+
'odata-invalid-name': {
|
|
1193
1282
|
std: 'Expected OData name $(ID) to start with an alphabetic character or underscore, followed by a maximum of 127 alphabetic characters, digits, or underscores',
|
|
1194
1283
|
v2firstChar: 'Unexpected first character $(PROP) of OData name $(ID) for OData $(VERSION)',
|
|
1195
|
-
qualifier: 'Expected OData annotation qualifier $(ID) to start with an alphabetic character or underscore, followed by a maximum of 127 alphabetic characters, digits, or underscores',
|
|
1196
|
-
vocRefAlias: 'Expected value $(VALUE) of OData vocabulary reference attribute $(ID) to start with an alphabetic character or underscore, followed by a maximum of 127 alphabetic characters, digits, or underscores',
|
|
1197
1284
|
},
|
|
1285
|
+
'odata-invalid-vocabulary-alias': 'Expected value $(VALUE) of OData vocabulary reference attribute $(ID) to start with an alphabetic character or underscore, followed by a maximum of 127 alphabetic characters, digits, or underscores',
|
|
1286
|
+
'odata-invalid-qualifier': 'Expected OData annotation qualifier $(ID) to start with an alphabetic character or underscore, followed by a maximum of 127 alphabetic characters, digits, or underscores',
|
|
1198
1287
|
// version independent messages
|
|
1199
|
-
'odata-
|
|
1200
|
-
std: 'Unexpected array type for primary key $(NAME)',
|
|
1201
|
-
assoc: 'Unexpected target cardinality $(VALUE) for primary key $(NAME)',
|
|
1202
|
-
},
|
|
1203
|
-
'odata-spec-violation-key-null': {
|
|
1288
|
+
'odata-unexpected-nullable-key': {
|
|
1204
1289
|
std: 'Expected key element $(NAME) to be not nullable', // flat
|
|
1205
1290
|
scalar: 'Expected key element $(NAME) to be not nullable', // structured
|
|
1206
1291
|
},
|
|
1207
|
-
'odata-
|
|
1292
|
+
'odata-unexpected-arrayed-key': {
|
|
1293
|
+
std: 'Unexpected array type for primary key $(NAME)',
|
|
1294
|
+
assoc: 'Unexpected target cardinality $(VALUE) for primary key $(NAME)',
|
|
1295
|
+
},
|
|
1296
|
+
'odata-invalid-key-type': {
|
|
1208
1297
|
std: 'Unexpected $(TYPE) mapped to $(ID) as type for key element $(NAME)', // structured
|
|
1209
1298
|
scalar: 'Unexpected $(TYPE) mapped to $(ID) as type for key element', // flat
|
|
1210
1299
|
},
|
|
1211
|
-
'odata-
|
|
1212
|
-
'odata-
|
|
1213
|
-
'odata-
|
|
1214
|
-
std: '
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
'odata-
|
|
1224
|
-
|
|
1300
|
+
'odata-missing-key': 'Expected entity to have a primary key',
|
|
1301
|
+
'odata-unknown-edm-type': 'Unknown EDM Type $(TYPE)',
|
|
1302
|
+
'odata-unexpected-edm-type': {
|
|
1303
|
+
std: 'Unexpected EDM Type $(TYPE) for OData $(VERSION)',
|
|
1304
|
+
anno: 'Unexpected EDM Type $(TYPE) for OData $(VERSION) in $(ANNO)',
|
|
1305
|
+
},
|
|
1306
|
+
'odata-missing-type': 'Expected element to have a type',
|
|
1307
|
+
'odata-unexpected-edm-facet': {
|
|
1308
|
+
std: 'Unexpected EDM Type facet $(NAME) of type $(TYPE) for OData $(VERSION)',
|
|
1309
|
+
anno: 'Unexpected EDM Type facet $(NAME) of type $(TYPE) for OData $(VERSION) in $(ANNO)',
|
|
1310
|
+
},
|
|
1311
|
+
'odata-invalid-external-type': 'Referenced type $(TYPE) marked as $(ANNO) can\'t be rendered as $(CODE) in service $(NAME) for OData $(VERSION)',
|
|
1312
|
+
'odata-invalid-scale': {
|
|
1313
|
+
std: 'Expected scale $(NUMBER) to be less than or equal to precision $(RAWVALUE)',
|
|
1314
|
+
anno: 'Expected scale $(NUMBER) to be less than or equal to precision $(RAWVALUE) in $(ANNO)',
|
|
1315
|
+
},
|
|
1316
|
+
'odata-invalid-property-name': 'Expected element name to be different from declaring $(META)',
|
|
1317
|
+
'odata-invalid-service-name': {
|
|
1225
1318
|
std: 'Expected service name not to be one of the reserved names $(NAMES)',
|
|
1226
1319
|
length: 'Expected service name not to exceed 511 characters',
|
|
1227
1320
|
},
|
|
1228
1321
|
// Other odata/edm errors
|
|
1229
|
-
'odata-
|
|
1322
|
+
'odata-duplicate-proxy': 'No proxy entity created due to name collision with existing definition $(NAME) of kind $(KIND)',
|
|
1323
|
+
'odata-duplicate-definition': {
|
|
1230
1324
|
std: 'Entity can\'t be created due to name collision with existing definition $(NAME)',
|
|
1231
|
-
proxy: 'No proxy entity created due to name collision with existing definition $(NAME) of kind $(KIND)',
|
|
1232
1325
|
anno: 'Name of annotation definition $(ANNO) conflicts with existing service definition',
|
|
1233
|
-
termredef: 'Unexpected redefinition of annotation $(ANNO)',
|
|
1234
|
-
},
|
|
1235
|
-
'odata-navigation': {
|
|
1236
|
-
std: 'No OData navigation property generated, target $(TARGET) is outside of service $(SERVICE)',
|
|
1237
|
-
oncond: 'No OData navigation property generated for association with arbitrary ON-condition and target $(TARGET) outside of service $(SERVICE)',
|
|
1238
1326
|
},
|
|
1327
|
+
'odata-navigation': 'No OData navigation property generated, target $(TARGET) is outside of service $(SERVICE)',
|
|
1239
1328
|
'odata-parameter-order': 'Unexpected mandatory after optional parameter',
|
|
1240
1329
|
'odata-key-recursive': 'Unexpected recursive key $(NAME)',
|
|
1241
1330
|
'odata-key-uuid-default-anno': 'Expected element of type $(TYPE) to be annotated with $(ANNO) when used as primary key in $(ID)',
|
|
@@ -1291,8 +1380,8 @@ const centralMessageTexts = {
|
|
|
1291
1380
|
enum: 'Value $(VALUE) is not one out of $(RAWVALUES) for $(ANNO) of type $(TYPE)',
|
|
1292
1381
|
std: 'Unexpected value $(VALUE) for $(ANNO) of type $(TYPE)',
|
|
1293
1382
|
incompval: 'Unexpected $(STR) value for $(ANNO) of type $(TYPE)',
|
|
1294
|
-
|
|
1295
|
-
|
|
1383
|
+
nestedCollection: 'Nested collections are not supported for $(ANNO)',
|
|
1384
|
+
enuminCollection: 'Enum inside collection is not supported for $(ANNO)',
|
|
1296
1385
|
multexpr: 'EDM JSON code contains more than one dynamic expression: $(RAWVALUES) for $(ANNO)',
|
|
1297
1386
|
},
|
|
1298
1387
|
'odata-anno-type': {
|
|
@@ -1394,7 +1483,6 @@ const centralMessageTexts = {
|
|
|
1394
1483
|
* If not `true` then an array is expected with specified modules in which the error is downgradable.
|
|
1395
1484
|
* Only has an effect if default severity is 'Error'.
|
|
1396
1485
|
* 'deprecated': severity can only be changed with deprecated.downgradableErrors.
|
|
1397
|
-
* TODO: Value `true` is temporary. Use an array instead.
|
|
1398
1486
|
* @property {string[]} [errorFor] Array of module names where the message shall be reclassified to an error.
|
|
1399
1487
|
* @property {boolean} [throughMessageCall]
|
|
1400
1488
|
* If set, it means that a message-id was added to the registry in test-mode through a `message.<severity>()`
|
|
@@ -1405,4 +1493,10 @@ const centralMessageTexts = {
|
|
|
1405
1493
|
|
|
1406
1494
|
// console.log('FOO')
|
|
1407
1495
|
|
|
1408
|
-
module.exports = {
|
|
1496
|
+
module.exports = {
|
|
1497
|
+
centralMessages,
|
|
1498
|
+
configurableForValidValues,
|
|
1499
|
+
validModules,
|
|
1500
|
+
centralMessageTexts,
|
|
1501
|
+
oldMessageIds,
|
|
1502
|
+
};
|