@sap/cds-compiler 2.13.8 → 3.0.0

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.
Files changed (127) hide show
  1. package/CHANGELOG.md +155 -1594
  2. package/bin/cdsc.js +144 -66
  3. package/doc/CHANGELOG_ARCHIVE.md +1592 -0
  4. package/doc/CHANGELOG_BETA.md +3 -4
  5. package/doc/CHANGELOG_DEPRECATED.md +35 -1
  6. package/doc/{DeprecatedOptions.md → DeprecatedOptions_v2.md} +3 -1
  7. package/doc/Versioning.md +20 -1
  8. package/lib/api/.eslintrc.json +2 -2
  9. package/lib/api/main.js +237 -122
  10. package/lib/api/options.js +17 -88
  11. package/lib/api/validate.js +12 -16
  12. package/lib/base/keywords.js +216 -109
  13. package/lib/base/message-registry.js +152 -37
  14. package/lib/base/messages.js +145 -83
  15. package/lib/base/model.js +44 -2
  16. package/lib/base/optionProcessorHelper.js +19 -0
  17. package/lib/checks/actionsFunctions.js +7 -5
  18. package/lib/checks/annotationsOData.js +11 -32
  19. package/lib/checks/arrayOfs.js +1 -34
  20. package/lib/checks/cdsPersistence.js +1 -0
  21. package/lib/checks/elements.js +6 -6
  22. package/lib/checks/invalidTarget.js +1 -1
  23. package/lib/checks/nonexpandableStructured.js +1 -1
  24. package/lib/checks/queryNoDbArtifacts.js +2 -1
  25. package/lib/checks/selectItems.js +5 -1
  26. package/lib/checks/types.js +4 -2
  27. package/lib/checks/utils.js +2 -2
  28. package/lib/checks/validator.js +4 -5
  29. package/lib/compiler/assert-consistency.js +16 -10
  30. package/lib/compiler/base.js +1 -0
  31. package/lib/compiler/builtins.js +98 -9
  32. package/lib/compiler/checks.js +22 -70
  33. package/lib/compiler/define.js +61 -13
  34. package/lib/compiler/extend.js +79 -14
  35. package/lib/compiler/finalize-parse-cdl.js +46 -29
  36. package/lib/compiler/index.js +100 -37
  37. package/lib/compiler/moduleLayers.js +7 -0
  38. package/lib/compiler/populate.js +19 -18
  39. package/lib/compiler/propagator.js +7 -4
  40. package/lib/compiler/resolve.js +297 -234
  41. package/lib/compiler/shared.js +107 -102
  42. package/lib/compiler/tweak-assocs.js +16 -11
  43. package/lib/compiler/utils.js +5 -0
  44. package/lib/edm/annotations/genericTranslation.js +93 -21
  45. package/lib/edm/csn2edm.js +230 -115
  46. package/lib/edm/edm.js +305 -226
  47. package/lib/edm/edmPreprocessor.js +509 -438
  48. package/lib/edm/edmUtils.js +31 -45
  49. package/lib/gen/Dictionary.json +98 -22
  50. package/lib/gen/language.checksum +1 -1
  51. package/lib/gen/language.interp +10 -30
  52. package/lib/gen/language.tokens +105 -114
  53. package/lib/gen/languageLexer.interp +1 -34
  54. package/lib/gen/languageLexer.js +889 -1007
  55. package/lib/gen/languageLexer.tokens +95 -106
  56. package/lib/gen/languageParser.js +20786 -22199
  57. package/lib/json/csnVersion.js +10 -11
  58. package/lib/json/from-csn.js +59 -51
  59. package/lib/json/to-csn.js +10 -10
  60. package/lib/language/antlrParser.js +2 -2
  61. package/lib/language/docCommentParser.js +62 -39
  62. package/lib/language/errorStrategy.js +52 -40
  63. package/lib/language/genericAntlrParser.js +348 -229
  64. package/lib/language/language.g4 +629 -653
  65. package/lib/language/multiLineStringParser.js +14 -42
  66. package/lib/language/textUtils.js +44 -0
  67. package/lib/main.d.ts +46 -43
  68. package/lib/main.js +108 -79
  69. package/lib/model/csnRefs.js +34 -7
  70. package/lib/model/csnUtils.js +337 -332
  71. package/lib/model/enrichCsn.js +1 -0
  72. package/lib/model/revealInternalProperties.js +30 -10
  73. package/lib/model/sortViews.js +32 -31
  74. package/lib/modelCompare/compare.js +6 -6
  75. package/lib/optionProcessor.js +73 -46
  76. package/lib/render/.eslintrc.json +1 -1
  77. package/lib/render/DuplicateChecker.js +4 -7
  78. package/lib/render/manageConstraints.js +70 -2
  79. package/lib/render/toCdl.js +1042 -882
  80. package/lib/render/toHdbcds.js +195 -245
  81. package/lib/render/toRename.js +44 -22
  82. package/lib/render/toSql.js +225 -241
  83. package/lib/render/utils/common.js +145 -15
  84. package/lib/render/utils/sql.js +20 -19
  85. package/lib/sql-identifier.js +6 -0
  86. package/lib/transform/db/.eslintrc.json +4 -3
  87. package/lib/transform/db/associations.js +2 -2
  88. package/lib/transform/db/cdsPersistence.js +5 -15
  89. package/lib/transform/db/constraints.js +4 -2
  90. package/lib/transform/db/expansion.js +22 -16
  91. package/lib/transform/db/flattening.js +109 -80
  92. package/lib/transform/db/transformExists.js +7 -7
  93. package/lib/transform/db/views.js +9 -6
  94. package/lib/transform/draft/.eslintrc.json +2 -2
  95. package/lib/transform/draft/db.js +6 -6
  96. package/lib/transform/draft/odata.js +6 -7
  97. package/lib/transform/forHanaNew.js +62 -48
  98. package/lib/transform/forOdataNew.js +49 -50
  99. package/lib/transform/localized.js +31 -20
  100. package/lib/transform/odata/toFinalBaseType.js +16 -14
  101. package/lib/transform/odata/typesExposure.js +146 -198
  102. package/lib/transform/odata/utils.js +1 -38
  103. package/lib/transform/transformUtilsNew.js +67 -84
  104. package/lib/transform/translateAssocsToJoins.js +7 -3
  105. package/lib/transform/universalCsn/.eslintrc.json +2 -2
  106. package/lib/transform/universalCsn/coreComputed.js +16 -9
  107. package/lib/transform/universalCsn/universalCsnEnricher.js +60 -10
  108. package/lib/utils/file.js +3 -3
  109. package/lib/utils/moduleResolve.js +13 -6
  110. package/lib/utils/timetrace.js +20 -21
  111. package/package.json +35 -4
  112. package/share/messages/message-explanations.json +2 -1
  113. package/share/messages/syntax-expected-integer.md +37 -0
  114. package/doc/ApiMigration.md +0 -237
  115. package/doc/CommandLineMigration.md +0 -58
  116. package/doc/ErrorMessages.md +0 -175
  117. package/doc/FioriAnnotations.md +0 -94
  118. package/doc/ODataTransformation.md +0 -273
  119. package/lib/backends.js +0 -529
  120. package/lib/fix_antlr4-8_warning.js +0 -56
  121. package/lib/transform/odata/attachPath.js +0 -96
  122. package/lib/transform/odata/expandStructKeysInAssociations.js +0 -59
  123. package/lib/transform/odata/generateForeignKeyElements.js +0 -261
  124. package/lib/transform/odata/referenceFlattener.js +0 -296
  125. package/lib/transform/odata/sortByAssociationDependency.js +0 -105
  126. package/lib/transform/odata/structuralPath.js +0 -72
  127. package/lib/transform/odata/structureFlattener.js +0 -171
package/CHANGELOG.md CHANGED
@@ -7,27 +7,178 @@
7
7
  Note: `beta` fixes, changes and features are usually not listed in this ChangeLog but [here](doc/CHANGELOG_BETA.md).
8
8
  The compiler behavior concerning `beta` features can change at any time without notice.
9
9
 
10
+ ## Version 3.0.0 - 2022-06-23
11
+
12
+ ### Added
13
+
14
+ - Instead of requiring all files on startup, they are required on an as-needed basis to reduce startup times.
15
+ - Allow `*` as argument in SQL functions `count`, `min`, `max`, `sum`, `avg`, `stddev`, `var`.
16
+
17
+ ### Changed
18
+
19
+ - cds-compiler now requires Node 14.
20
+ - `compile()` and its derivates now use `fs.realpath.native()` instead of `fs.realpath()`.
21
+ - Multi-line doc comments without leading `*` were inconsistently trimmed.
22
+ - `@cds.persistence.skip` and `@cds.persistence.exists` are both copied to generated child artifacts
23
+ such as localized convenience views, texts entities and managed compositions.
24
+ - As before, a structure value for an annotation assignment in a CDL source is flattened,
25
+ i.e. `@Anno: { foo: 1, @bar: 2 }` becomes `@Anno.foo: 1 @Anno.@bar: 2`.
26
+ Now, the structure property name `$value` is basically ignored:
27
+ `@Anno: { $value: 1, @bar: 2 }` becomes `@Anno: 1 @Anno.@bar: 2`.
28
+ The advantage is that overwriting or appending the annotation value works as expected.
29
+ - Update OData vocabularies 'Common', 'UI'.
30
+ - Keywords `not null` is only valid after `many String enum {...}` and no longer after `String`.
31
+ - (Sub-)Elements of localized convenience views can now be annotated, e.g. `annotate localized.E:elem`.
32
+ - `getArtifactCdsPersistenceName` now enforces the `csn` argument and can optionally have the `sqlDialect` passed in.
33
+ - `getElementCdsPersistenceName` can optionally have the `sqlDialect` passed in.
34
+
35
+ ### Removed
36
+
37
+ - All v2 deprecated flags.
38
+ - Keyword `masked`.
39
+ - `*` as generic argument to SQL functions/expressions.
40
+ - All non-SNAPI options.
41
+
42
+ ## Version 2.15.4 - 2022-06-09
43
+
44
+ ### Fixed
45
+
46
+ - for.odata:
47
+ + Fix derived type to scalar type resolution with intermediate `many`.
48
+ - to.edm(x):
49
+ + (V4 structured) Fix key paths in combination with `--odata-foreign-keys`.
50
+ + Add `Edm.PrimitiveType` to `@odata.Type`.
51
+ + (V4 JSON) Render constant expressions for `Edm.Stream` and `Edm.Untyped`.
52
+ + Fix a bug in target path calculation for `NavigationPropertyBinding`s to external references.
53
+ + Render inner annotations even if `$value` is missing.
54
+ - Update OData vocabularies 'Common', 'UI'.
55
+ - to.sql/to.hdbcds/to.hdi: "type of"s in `cast()`s could lead to type properties being lost.
56
+
57
+ ## Version 2.15.2 - 2022-05-12
58
+
59
+ ### Fixed
60
+
61
+ - Option `cdsHome` can be used instead of `global.cds.home` to specify the path to `@sap/cds/`.
62
+ - to.edm(x):
63
+ + Set anonymous nested proxy key elements to `Nullable:false` until first named type is reached.
64
+ + Enforce `odata-spec-violation-key-null` on explicit foreign keys of managed primary key associations.
65
+ + Proxies/service cross references are no longer created for associations with arbitrary ON conditions.
66
+ Only managed or `$self` backlink association targets are proxy/service cross reference candidates.
67
+ + Explicit foreign keys of a managed association that are not a primary key in the target are exposed in the the proxy.
68
+ + If an association is primary key, the resulting navigation property is set to `Nullable:false` in structured mode.
69
+
70
+ ## Version 2.15.0 - 2022-05-06
71
+
72
+ ### Added
73
+
74
+ - A new warning is emitted if `excluding` is used without a wildcard, since this does
75
+ not have any effect.
76
+ - All scalar types can now take named arguments, e.g. `MyString(length: 10)`.
77
+ For custom scalar types, one unnamed arguments is interpreted as length, two arguments are interpreted
78
+ as precision and scale, e.g. `MyDecimal(3,3)`.
79
+ - If the type `sap.common.Locale` exists, it will be used as type for the `locale` element
80
+ of generated texts entities. The type must be a `cds.String`.
81
+ - to.cdl: Extend statements (from `extensions`) can now be rendered.
82
+ - Add OData vocabulary 'Hierarchy'.
83
+ - CDL: New associations can be published in queries, e.g. `assoc : Association to Target on assoc.id = id`
84
+
85
+ ### Changed
86
+
87
+ - to.edm(x):
88
+ + perform inbound qualification and spec violation checks as well as most/feasible EDM preprocessing steps
89
+ on requested services only.
90
+ + Open up `@odata { Type, MaxLength, Precision, Scale, SRID }` annotation.
91
+ The annotations behavior is defined as follows:
92
+ + The element/parameter must have a scalar CDS type. The annotation is not applied on named types
93
+ (With the V2 exception where derived type chains terminating in a scalar type are resolved).
94
+ + The value of `@odata.Type` must be a valid `EDM` type for the rendered protocol version.
95
+ + If `@odata.Type` can be applied, all canonic type facets (`MaxLength`, `Precision`, `Scale`, `SRID`) are
96
+ removed from the Edm Node and the new facets `@odata { MaxLength, Precision, Scale, SRID }` are applied.
97
+ Non Edm type conformant facets are ignored (eg. `@odata { Type: 'Edm.Decimal', MaxLength: 10, SRID: 0 }`).
98
+ + Type facet values are not evaluated.
99
+ + V2: Propagate `@Core.MediaType` annotation from stream element to entity type if not set.
100
+ - to.edm: Render constant expressions in short notation.
101
+ - Update OData Vocabularies: 'Common', 'Graph', 'Validation'.
102
+
103
+ ### Fixed
104
+
105
+ - to.cdl:
106
+ + Annotations of elements of action `returns` are now rendered as `annotate` statements.
107
+ + Annotations on columns (query sub-elements) were not always rendered.
108
+ + Doc comments on bound actions were rendered twice.
109
+ + Unapplied annotations for action parameters were not rendered.
110
+ + Unions and joins are correctly put into parentheses.
111
+ + Add parentheses around certain expressions in function bodies that require it, such as `fct((1=1))`.
112
+ - to.edm(x):
113
+ + Fix a bug in top level and derived type `items` exposure leading to undefined type rendering.
114
+ + Fix a naming bug in type exposure leading to false reuse types, disguising invididual type
115
+ modifications (such as annotations, (auto-)redirections, element extensions).
116
+ + Ignore `@Aggregation.default`.
117
+ + Consolidate message texts and formatting.
118
+ + Fix navigation property binding in cross service rendering mode.
119
+ + Remove partner attribute in proxy/cross service navigations.
120
+ - Core engine (function `compile`):
121
+ + Annotations for new columns inside `extend projection` blocks were not used.
122
+ + Extending an unknown select item resulted in a crash.
123
+ + Extending a context/service with columns now correctly emits an error.
124
+ + Unmanaged `redirected to` in queries did not check whether the source is an association.
125
+ - parseCdl: `extend <art> with enum {...}` incorrectly threw a compiler error.
126
+ - API: `compile()` used a synchronous call `fs.realpathSync()` on the input filename array.
127
+ Now the asynchronous `fs.realpath()` is used.
128
+ - On-conditions in localized convenience views may be incorrectly rewritten if an element
129
+ has the same as a localized entity.
130
+ - to.sql/hdi/hdbcds:
131
+ + No referential constraint is generated for an association if its parent
132
+ or target entity are annotated with `@cds.persistence.exists: true`.
133
+ + Fix rendering of virtual elements in subqueries
134
+ + Correctly process subqueries in JOINs
135
+ - to.sql/hdi: Queries with `UNION`, `INTERSECT` and similar in expressions are now enclosed in parentheses.
136
+
137
+ ## Version 2.14.0 - 2022-04-08
138
+
139
+ ### Added
140
+
141
+ - cdsc:
142
+ + `--quiet` can now be used to suppress compiler output, including messages.
143
+ + `--options <file.json>` can be used to load compiler options. A JSON file is expected. Is compatible to CDS `package.json`
144
+ and `.cdsrc.json` by first looking for `cdsc` key in `cds`, then for a `cdsc` key and otherwise uses the full JSON file.
145
+ + `--[error|warn|info|debug] id1,id2` can be used to reclassify specific messages.
146
+ - Add OData Vocabularies: 'DataIntegration', 'JSON'.
147
+
148
+ ### Changed
149
+
150
+ - Update OData Vocabularies: 'UI'.
151
+
152
+ ### Fixed
153
+
154
+ - to.cdl:
155
+ + Delimited identifiers as the last elements of arrays in annotation values are now
156
+ rendered with spaces in between, to avoid accidentally escaping `]`.
157
+ + Identifiers in includes and redirection targets were not quoted if they are reserved keywords.
158
+ - to.edm(x): Correctly rewrite `@Capabilities.ReadRestrictions.ReadByKeyRestrictions` into
159
+ `@Capabilities.NavigationPropertyRestriction` in containment mode.
160
+
10
161
  ## Version 2.13.8 - 2022-03-29
11
162
 
12
163
  ### Fixed
13
164
 
14
165
  - to.hdbcds/hdi/sql: Correctly handle `localized` in conjunction with `@cds.persistence.exists` and `@cds.persistence.skip`
15
166
 
16
- ## Version 2.13.6 - 2022-25-03
167
+ ## Version 2.13.6 - 2022-03-25
17
168
 
18
169
  ### Fixed
19
170
 
20
171
  - to.hdbcds/hdi/sql: Correctly handle `localized` in conjunction with `@cds.persistence.exists`
21
172
 
22
- ## Version 2.13.4 - 2022-22-03
173
+ ## Version 2.13.4 - 2022-03-22
23
174
 
24
175
  No changes compared to Version 2.13.0; fixes latest NPM tag
25
176
 
26
- ## Version 2.13.2 - 2022-22-03
177
+ ## Version 2.13.2 - 2022-03-22
27
178
 
28
179
  No changes compared to Version 2.13.0; fixes latest NPM tag
29
180
 
30
- ## Version 2.13.0 - 2022-22-03
181
+ ## Version 2.13.0 - 2022-03-22
31
182
 
32
183
  ### Added
33
184
 
@@ -165,1596 +316,6 @@ No changes compared to Version 2.13.0; fixes latest NPM tag
165
316
  - to.cdl: Annotation paths containing special characters such as spaces or `@` are now quoted, e.g. `@![some@annotation]`.
166
317
  - compiler: A warning is emitted for elements of views with localized keys as the localized property is ignored for them.
167
318
 
168
- ## Version 2.11.4 - 2021-12-21
169
-
170
- ### Fixed
171
-
172
- - CDL parser: in many situations, improve message when people use reserved keywords as identifier
173
- - Improve error text and error location for ambiguous auto-redirection target
174
- - to.sql/hdi/hdbcds:
175
- + Correctly detect `exists` in projections
176
- + Correctly handle elements starting with `$` in the on-condition of associations
177
- + Correctly handle sub queries in an entity defined with `projection on`
178
- + Correctly handle associations in sub queries in a `from` of a sub query
179
- + foreign key constraints: respect @assert.integrity: false for compositions
180
- - to.hdbcds: Correctly quote elements named `$self` and `$projection`
181
- - to.cdl: `when` was added to the keyword list for smart quoting
182
- - Compiler support for code completion for `$user` and `$session` now respect user
183
- provided variables in `options.variableReplacements`.
184
- - API: `deduplicateMessages()` no longer removes messages for `duplicate` artifact/annotation errors.
185
- Prior to this version, only one of the duplicated artifacts had a message, leaving the user to
186
- guess where the other duplicates were.
187
-
188
-
189
- ## Version 2.11.2 - 2021-12-06
190
-
191
- ### Fixed
192
-
193
- - to.sql/hdi/hdbcds:
194
- + No foreign key constraint will be rendered for managed `composition of one` if annotated with `@assert.integrity: false`
195
- + Correctly handle managed associations with other managed associations as foreign keys in conjunction with `exists`
196
-
197
- ## Version 2.11.0 - 2021-12-02
198
-
199
- ### Added
200
-
201
- - Option `defaultBinaryLength` to set a `length` type facet for all definitions with type `cds.Binary`. This option
202
- overrides the default binary length in the database backends and is also used as `MaxLength` attribute in Odata.
203
- - If doc-comments are ignored by the compiler, an info message is now emitted. A doc-comment is ignored,
204
- if it can't be assigned to an artifact. For example for two subsequent doc-comments, the first doc-comment
205
- is ignored. To suppress these info messages, explicitly set option `docComment` to `false`.
206
- - `cdsc`:
207
- + `cdsc explain list` can now be used to get a list of message IDs with explanation texts.
208
- + `cdsc` now respects the environment variable `NO_COLOR`. If set, no ANSI escape codes will be used.
209
- Can be overwritten by `cdsc --color always`.
210
- - to.sql/hdi: Support SQL Window Functions
211
- - to.sql/hdi/hdbcds:
212
- + Support configuration of `$session` and `$user` via option `variableReplacements`.
213
- + Restricted support for SQL foreign key constraints if option `assertIntegrityType` is set to `"DB"`.
214
- The behavior of this feature might change in the future.
215
-
216
- ### Changed
217
-
218
- - Updated OData vocabularies 'Common' and 'UI'.
219
- - to.sql/hdi/hdbcds: The default length of `cds.Binary` is set to `5000` similar to `cds.String`.
220
-
221
- ### Removed
222
-
223
- - to.hdbcds: Doc comments on view columns are not rendered anymore. Doc comments on string literals will make the deployment fail
224
- as the SAP HANA CDS compiler concatenates the doc comment with the string literal. Besides that, doc comments on view columns
225
- are not transported to the database by SAP HANA CDS.
226
- - to.hdbcds/sql/hdi: Forbid associations in filters after `exists` (except for nested `exists`), as the final behavior is not yet specified.
227
-
228
- ### Fixed
229
-
230
- - CSN parser: doc-comment extensions are no longer ignored.
231
- - Properly check for duplicate annotation definitions.
232
- - Correctly apply annotations on inherited enum symbols.
233
- - Correctly apply annotations on elements in an inherited structure array.
234
- - Fix a bug in API `defaultStringLength` value evaluation.
235
- - Fix crash if named arguments are used in a function that's inside a `CASE` statement.
236
- - to.sql/hdi/hdbcds:
237
- + Properly flatten ad-hoc defined elements in `returns` / `params` of `actions` and `functions`.
238
- + Correctly handle `*` in non-first position.
239
- + Correctly handle action return types
240
- + Correctly handle mixin association named `$self`
241
- - to.cdl: doc-comments are no longer rendered twice.
242
- - to.edm(x):
243
- + Fix a bug in V2/V4 partner ship calculation.
244
- + Remove warning of unknown types for Open Types in `@Core.Dictionary`.
245
- + An empty CSN no longer results in a JavaScript type error
246
-
247
- ## Version 2.10.4 - 2021-11-05
248
-
249
- ### Fixed
250
-
251
- - to.sql/hdi/hdbcds:
252
- + Correctly complain about `exists` in conjunction with non-associations/compositions
253
- + Don't resolve types in action returns, as this causes issues with $self-resolution
254
-
255
- - to.edm(x): Be robust against transitively untyped keys in stacked view hierarchies
256
-
257
- ## Version 2.10.2 - 2021-10-29
258
-
259
- ### Fixed
260
-
261
- - to.sql/hdi/hdbcds: Correctly handle `exists` in conjunction with mixin-associations
262
-
263
- ## Version 2.10.0 - 2021-10-28
264
-
265
- ### Added
266
-
267
- - Support arbitrary paths after `$user` - similar to `$session`.
268
- - Support scale `floating` and `variable` for `cds.Decimal` in CDL and CSN. Backend specific handling is descibed in their sections.
269
- - Allow select item wildcard (`*`) in a `select`/`projection` at any position, not just the first.
270
-
271
- - to.edm(x):
272
- + In Odata V4 generate transitive navigation property binding paths along containment hierarchies and terminate on the
273
- first non-containment association. The association target is either an explicit Edm.EntitySet in the same EntityContainer
274
- or in a referred EntityContainer (cross service references) or an implicit EntitySet identified by the containment path
275
- originating from an explicit EntitySet. This enhancement has an observable effect only in structured format with containment
276
- turned on.
277
- + Support for scales `variable` and `floating`:
278
- + V4: `variable` and `floating` are rendered as `Scale="variable"`. Since V4 does not support `floating`, it is aproximated as `variable`.
279
- + V2: `variable` and `floating` are announced via property annotation `sap:variable-scale="true"`
280
-
281
- - to.sql/hdi/hdbcds:
282
- + Reject scale `floating` and `variable`.
283
- + Reject arbitrary `$user` or `$session` paths that cannot be translated to valid SQL.
284
- + Following a valid `exists`, further `exists` can be used inside of the filter-expression: `exists assoc[exists another[1=1]]`
285
- + `exists` can now be followed by more than one association step.
286
- `exists assoc.anotherassoc.moreassoc` is semantically equivalent to `exists assoc[exists anotherassoc[exists moreassoc]]`
287
-
288
- ### Changed
289
-
290
- - to.odata: Inform when overwriting draft action annotations like `@Common.DraftRoot.ActivationAction`.
291
-
292
- ## Version 2.9.0 - 2021-10-15
293
-
294
- ### Changed
295
-
296
- - to.edm(x): Raise `odata-spec-violation-type` to a downgradable error.
297
-
298
- ### Fixed
299
-
300
- - to.edm(x):
301
- + Fix a bug in annotation propagation to foreign keys.
302
- + Don't render annotations for not rendered stream element in V2.
303
- - to.hdi:
304
- + for naming mode "hdbcds" and "quoted" parameter definitions are not quoted anymore.
305
- - to.hdi/sql/hdbcds:
306
- + Correctly handle explicit and implicit alias during flattening.
307
- + Raise an error for `@odata.draft.enabled` artifacts with elements without types - instead of crashing with internal assertions.
308
-
309
- ## Version 2.8.0 - 2021-10-07
310
-
311
- ### Added
312
-
313
- - Allow defining unmanaged associations in anonymous aspects of compositions.
314
- - Enable extensions of anonymous aspects for managed compositions of aspects.
315
- - When the option `addTextsLanguageAssoc` is set to true and
316
- the model contains an entity `sap.common.Languages` with an element `code`,
317
- all generated texts entities additionally contain an element `language`
318
- which is an association to `sap.common.Languages` using element `local`.
319
- - for.odata:
320
- + In `--odata-format=flat`, structured view parameters are flattened like elements.
321
- - to.hdbcds
322
- + Use "smart quotes" for naming mode "plain" - automatically quote identifier which are reserved keywords or non-regular.
323
-
324
- ### Changed
325
-
326
- - for.odata:
327
- + In `--data-format=structured`, anonymous sub elements of primary keys and parameters are set to `notNull:true`,
328
- an existing `notNull` attribute is _not_ overwritten. Referred named types are _not_ modified.
329
- - to.edm(x):
330
- + Improve specification violation checks of (nested) keys:
331
- + All (sub-)elements must be `Nullable: false` (error).
332
- + Must represent a single value (error).
333
- + In V4 must be a specification compliant Edm.PrimitiveType (warning).
334
- - to.hdi/hdbcds/sql: $user.\<xy\> now has \<xy\> added as alias - "$user.\<xy\> as \<xy\>"
335
-
336
- ### Fixed
337
-
338
- - Properly generate auto-exposed entities for associations in parameters.
339
- - Correctly apply extensions to anonymous array item types.
340
- - Correctly apply/render annotations to anonymous action return types.
341
- - With CSN flavor `plain` (`gensrc`), correctly render annotations on elements
342
- of referred structure types as `annotate` statements in the CSN's `extensions` property.
343
- - to.cdl:
344
- + Correctly render extensions on array item types
345
- + Correctly render annotations on action return types
346
- - to/for: Correctly handle CSN input where the prototype of objects is not the "default"
347
- - to.hdi:
348
- + for naming mode "hdbcds" and "quoted" parameter definitions are now quoted.
349
- + for naming mode "plain", smart quotation is applied to parameter definitions if they are reserved words.
350
- - to.hdi/hdbcds/sql:
351
- + Ensure that cdl-style casts to localized types do not lose their localized property
352
- + Fix a small memory leak during rendering of SQL/HDBCDS.
353
- - to.edm(x): Remove ambiguous `Partner` attribute from `NavigationProperty`. A forward association referred
354
- to by multiple backlinks (`$self` comparisons) is no longer partner to an arbitrary backlink.
355
-
356
- ## Version 2.7.0 - 2021-09-22
357
-
358
- ### Added
359
-
360
- - to.hdi.migration:
361
- + Support changes to HANA comments.
362
-
363
- ### Changed
364
-
365
- - Updated OData vocabularies 'Common', 'Core'
366
-
367
- ### Fixed
368
-
369
- - Fix memory issue: do not keep reference to last-compiled model.
370
- - Fix dump which occured when trying to report that the user has defined an element to be both `key` and `localized` if
371
- `localized` was inherited via the provided type, or in the generated entity for a managed composition of aspect.
372
- - Properly auto-expose targets of associations in parameters and `many`.
373
- - for.Odata:
374
- + Fix handling of annotation `@cds.odata.valuelist` in conjunction with associations in structures using flat-mode and sqlMapping set to plain.
375
- + Set correctly the $localized property in the OData backend resulting CSN for artifacts that have localized convenience views.
376
- - to.edm(x):
377
- + Fix rendering of structured referential constraints and nested partnerships in combination with `$self` comparisons.
378
- + Fix merging of `@Capabilities` annotations while transforming them into `NavigationCapabilities` from the containee into the container.
379
- - to.sql/hdi/hdbcds:
380
- + Fix a bug in Association to Join translation in multi-level association redirection in combination with `$self`.
381
- + Correctly flatten paths with filters or parameters.
382
- + Improve error message in case of invalid `exists`.
383
-
384
- ## Version 2.6.2 - 2021-08-26
385
-
386
- ### Fixed
387
-
388
- - to.sql/hdi/hdbcds/edm(x)/for.odata: Correctly handle tuple expansion in subqueries of Unions.
389
-
390
- ## Version 2.6.0 - 2021-08-23
391
-
392
- ### Added
393
-
394
- - Support managed associations without foreign keys. Associations targeting a definition without primary keys or with an
395
- explicit empty foreign key tuple or with empty structured elements as foreign keys and their corresponding `$self`
396
- comparisons do not describe the relationship between the source and the target entity.
397
- These associations can be used to establish API navigations but cannot be used to access elements in the target
398
- entity as they cannot be transformed into a valid JOIN expression.
399
- Consequently, these associations are not added to the `WITH ASSOCIATIONS` clause or forwarded to HANA CDS.
400
- - to.sql/hdi/hdbcds/edm(x)/for.odata: Structure/managed association comparisons (tuple comparisons) are now
401
- also expanded in infix filters, all expressions and all on-conditions.
402
- - to.hdbcds: Better locations for messages - mostly concerning keywords and duplicates
403
-
404
- ### Changed
405
-
406
- - to.sql/hdi/hdbcds: Invalid (i.e. not expandable) usage of structures is now checked - an error is raised
407
-
408
- ### Removed
409
-
410
- - The internal non-enumerable CSN property `$env` has been removed from the compiled CSN.
411
-
412
- ### Fixed
413
-
414
- - Make `;` optional before `}` in all circumstances (was not the case with `many`).
415
- - to.sql/hdi/hdbcds/edm(x): More graceful handling of CSN input where associations do not have `keys` or an `on`-condition
416
-
417
- ## Version 2.5.2 - 2021-08-10
418
-
419
- ### Fixed
420
-
421
- - to.hdbcds: Fixed a bug introduced with 2.5.0 that caused virtual elements to be rendered in views.
422
-
423
- ## Version 2.5.0 - 2021-07-28
424
-
425
- ### Added
426
-
427
- - Allow to extend existing array annotation values via the ellipsis operator `...`.
428
- An ellipsis may appear exactly once at an arbitrary position in the top level array
429
- of an `annotate` directive. Only array values can be merged into arrays and unapplied
430
- ellipses are removed from the final array value. Annotation layering rules remain unaffected.
431
- - to.sql/hdi/hdbcds:
432
- + Doc comments are translated into HANA comments (or into `@Comment` annotation for `to.hdbcds`).
433
- Such comments are possible on entities, views, elements of entities and `to.hdbcds` also supports comments on view columns.
434
- Generation can be disabled via option `disableHanaComments`. Entites/views (and their elements/columns)
435
- annotated with `@cds.persistence.journal` for `to.hdi`/`to.sql` will not have comments rendered.
436
- + Generation of temporal `WHERE` clause can be suppressed by annotating the `validFrom`/`validTo` elements of the projection with `false` or `null`.
437
- - to.sql/hdi/hdbcds/edm(x)/for.odata: Structure/managed association comparisons (tuple comparisons) are now
438
- also expanded in `WHERE` and `HAVING` - this was previously only supported in on-conditions.
439
- - `cdsc` now internally uses SNAPI.
440
- - to.hdi.migration:
441
- + Validate that the two supplied CSNs are compatible.
442
- + Improve delta-mechanism to not render superflous [ALTER|DROP|ADD] statements for unchanged SQL.
443
-
444
- ### Changed
445
-
446
- - If the first source provided to the compile command has a `$sources` property
447
- (whether enumerable or not) which is an array of strings,
448
- use that instead of calculating one.
449
- - Updated OData vocabularies 'Aggregation', 'Analytics', 'Authorization', 'Capabilities',
450
- 'CodeList', 'Common', 'Communication', 'Core', 'Graph', 'HTML5', 'Measures', 'ODM', 'PersonalData',
451
- 'Repeatability', 'Session', 'UI', 'Validation'
452
-
453
- ### Removed
454
-
455
- - Removed internal property `$viaTransform` from CSN produced by OData/HANA transformation
456
-
457
- ### Fixed
458
-
459
- - Remove warnings 'Ignoring annotation “@odata.draft.enabled” as the artifact is not part of a service'
460
- and 'Ignoring draft node for composition target ... because it is not part of a service'
461
- - Doc comments are no longer ignored after enum values and on view columns in parseCdl mode.
462
- - to.cdl:
463
- + Doc comments for enum values are correctly rendered.
464
- + Enum value and doc comments are now correctly rendered if the enum is called `doc`.
465
- + Doc comments at type references are correctly rendered.
466
- + Empty doc comments are correctly rendered and not left out.
467
- + Doc comments on view columns are correctly rendered.
468
- - to.edm(x):
469
- + OData V2: Ignore `@odata.singleton`.
470
- + OData V4: Do not render an `edm:NavigationPropertyBinding` to a singleton if the association has
471
- cardinality 'to-many'.
472
- - forOData:
473
- + Fix automatic renaming of shortcut annotation (eg. `@label`) with value `null`.
474
- - CSN parser:
475
- + Empty doc comments are correctly parsed and not complained about.
476
-
477
- ## Version 2.4.4 - 2021-07-02
478
-
479
- ### Fixed
480
-
481
- - Do not remove parentheses around single literals and references on the right-hand side of an `in` and `not in` operator.
482
-
483
- ## Version 2.4.2 - 2021-07-01
484
-
485
- - Only changes to beta features. Refer to the [beta ChangeLog](doc/CHANGELOG_BETA.md#version-242) for more.
486
-
487
- ## Version 2.4.0 - 2021-06-28
488
-
489
- ### Added
490
-
491
- - to.edm(x):
492
- + Warn if an `edm:Property` has no `Type` attribute.
493
- + Warn about using the protected names 'Edm', 'odata', 'System', 'Transient' as `edm:Schema` `Namespace` values.
494
- + Allow `$edmJson` inline annotations in `edm:Collection` and nested annotations.
495
- - to.hdi/sql/hdbcds: Transform a `exists <association>` into a `exists <subselect>`, where the subselect
496
- selects from the target of `<association>` and establishes the same relation as `<association>` would via the WHERE clause.
497
- Infix-filters of `<association>` are added to the WHERE clause.
498
-
499
- ### Changed
500
-
501
- - Do not inherit `@cds.persistence.skip` when `@cds.persistence.table` is set on entity.
502
- - to.cdl: Opening and closing braces of empty services and contexts are now on the same line.
503
-
504
- ### Fixed
505
-
506
- - `cdsc`: Option `--direct-backend` can now be combined with `toCsn`'s option `--with-localized`
507
- - The option `testSortCsn` was erroneously ignored in some compiler backends.
508
-
509
- ## Version 2.3.2 - 2021-06-14
510
-
511
- ### Fixed
512
-
513
- - for.odata: Propagate the `virtual` attribute correctly while flattening structures.
514
- - If internal relational types are used directly in CDL (e.g. `cds.Association`), an error is emitted.
515
- In CSN, all artifacts of relational types need a `target` (/`targetAspect`) as well.
516
- - In Association to Join translation don't produce a JOIN node for exposed (transitive) associations in
517
- combination with their exposed foreign keys. Also resolve foreign keys correctly against the target
518
- entity allowing to expose renamed foreign keys when aliased.
519
- - The option `testSortCsn` (`--test-sort-csn` in `cdsc`) can be used to sort CSN definitions alphabetically.
520
- This option is only intended for tests. This will restore the pre-v2.3.0 ordering in EDMX.
521
- - to.sql:
522
- + for SQL-dialect `sqlite`, render the string-format-time function (`strftime()`)
523
- + `$at.from` with date-format: `'%Y-%m-%dT%H:%M:%S.000Z'`
524
- + `$at.to` with date-format: `'%Y-%m-%dT%H:%M:%S.001Z'` (**+1ms** compared to `$at.from`)
525
- + for SQL-dialect `hana` wrap `SESSION_CONTEXT('VALID-TO')` and `SESSION_CONTEXT('VALID-FROM')` in `TO_TIMESTAMP(..)` function
526
- - to.hdbcds:
527
- + Wrap `SESSION_CONTEXT('VALID-TO')` and `SESSION_CONTEXT('VALID-FROM')` in `TO_TIMESTAMP(..)` function
528
-
529
- ## Version 2.3.0 - 2021-06-02
530
-
531
- ### Added
532
-
533
- - `cdsc` got a new option `--fallback-parser <cdl|csn>` that is used
534
- if an unknown or no file extension is used.
535
- - to.hdi/sql: Allow association publishing in UNIONs - this was previously forbidden, but this limitation only applies to HANA CDS.
536
- - to.edm(x): Support dynamic expressions as $edmJson inline code
537
-
538
- ### Changed
539
-
540
- - Type `DecimalFloat` is no longer proposed for code-completion.
541
- - Non-string enums without values for their enum elements are warned about.
542
- - OData CSN is no longer sorted by definition names
543
- - to.edm(x): Update OData vocabularies 'Aggregation', 'Analytics', 'CodeList', 'Common', 'Measures', 'Session', 'UI'
544
-
545
- ### Removed
546
-
547
- - to.hdbcds: Association publishing in subqueries is not supported by HANA CDS - an error is raised during compile time, instead of waiting for a deployment error.
548
-
549
- ### Fixed
550
-
551
- - Correct auto-exposure in model with unscoped projection on deep scoped entity
552
- (from managed aspect compositions: component in component, like they are common in ODM).
553
- - Internal types `cds.Association` and `cds.Composition` are no longer proposed for code-completion.
554
- - Fix various issues with Association to Join translation:
555
- + Substitute `$self.alias` expressions and respect prefix paths in foreign key accesses.
556
- - to.hdbcds: In naming mode "hdbcds", correctly resolve $self backlinks with aliased foreign keys.
557
- - to.cdl:
558
- + Correctly traverse subelements when rendering annotations for them.
559
- + Quote element names (if required) in `annotate with` statements.
560
- - for.odata: Fix regression with detecting collision when generating foreign keys.
561
- - to.edmx: Correctly render final base types in EDMX V2 when called with transformed OData CSN for V4.
562
-
563
- ## Version 2.2.8 - 2021-05-20
564
-
565
- ### Fixed
566
-
567
- - Fix regression: also for associations _defined_ in a service, try to
568
- implicitly redirect the provided model target.
569
-
570
- ## Version 2.2.6 - 2021-05-12
571
-
572
- ### Fixed
573
-
574
- - to.edmx(x):
575
- + The reverted change "`array of` elements are now allowed for OData V2, too." introduced with v2.2.0 has caused
576
- regressions in various scenarios that used OData V4 processed CSN for OData V2 EDMX rendering. Therefore
577
- the error has been lowered to a 'odata-spec-violation-array-of' warning.
578
- + The fix 'Render constraints only if all principal keys are used in association' introduced with v2.2.2 has
579
- caused regressions in mocking scenarios. With option `--odata-v2-partial-constr` partial constraint generation
580
- can be reactivated. A 'odata-spec-violation-constraints' warning is raised.
581
-
582
- ### 2.5.0 Addendum to Changed
583
-
584
- - Replace outdated option `length` with `defaultStringLength` which is usable in `for.*` and `to.*` APIs.
585
-
586
-
587
- ## Version 2.2.4 - 2021-05-06
588
-
589
- No changes compared to Version 2.2.2; fixes latest NPM tag
590
-
591
- ## Version 2.2.2 - 2021-05-04
592
-
593
- ### Fixed
594
-
595
- - Usually reserved names like `in` in references used as annotation values can now really
596
- be provided without delimited identifiers (if the name is not `true`, `false` or `null`).
597
- - Fixed the implicit redirection of associations to scoped targets (like texts entities).
598
- - Fix regression: Allow virtual structured elements.
599
- - to.edm(x):
600
- + OData V2:
601
- + Remove warning about scalar return types.
602
- + Render constraints only if all principal keys are used in association.
603
- + OData V4: Don't remove `@Capabilities` annotations from containee.
604
- + Allow `@Core.MediaType` on all types and raise a warning for those (scalar) types that can't be mapped to `Edm.String` or `Edm.Binary`.
605
- - to.cdl: Also handle subelement-annotations by rendering a `annotate X with Y`.
606
- - to.hdi/sql/hdbcds: Fixed the DB name (with naming mode `quoted`/`hdbcds`) and the `to.hdi` file name of scoped definitions (like `texts` entities) in services.
607
- - Empty enums no longer result in a syntax error.
608
-
609
- ## Version 2.2.0 - 2021-04-28
610
-
611
- ### Added
612
-
613
- - The compiler now takes the “definition scope” of associations and compositions into account
614
- when implicitly redirecting the target and auto-exposing entities.
615
- - odata: The warning `enum-value-ref` is no longer reclassified to an error.
616
- However, references to other enum values are still not supported.
617
-
618
- ### Changed
619
-
620
- - Remove special handling for implicit redirection to auto-exposed entity; consistently
621
- do not overwrite user-specified target in a service anymore, also in this special case.
622
- - Structured/Arrayed types for enums are now an error and not just a warning.
623
- - to.cdl: Keywords in annotation paths are no longer escaped
624
-
625
- ### Removed
626
-
627
- - Consistently reject references to auto-exposed entities except for `annotate`
628
- (it might have worked before, depending on the sequence of definitions);
629
- expose an entity manually if you want to refer to it.
630
-
631
- ### Fixed
632
-
633
- - Do not omit indirectly annotated or redirected sub elements
634
- during propagation of expanded sub elements.
635
- - Also auto-expose composition targets of projected compositions,
636
- not just those target which were used at the original definition of the composition.
637
- - Improve checks for keys which are `array of` or of SAP HANA spatial type (`ST_POINT` & `ST_GEOMETRY`)
638
- with checking also inside of used user-defined structured type.
639
- - to.edm(x):
640
- + V2: `OnDelete=Cascade` was set on dependent instead on principal role.
641
- + V4: ReferentialConstraints Property and ReferencedProperty for managed composition to one were swapped.
642
-
643
- ### 2.2.6 Addendum to Changed
644
-
645
- - to.edm(x): Revert 2.1.0 change: "`array of` elements are now allowed for OData V2, too."
646
- OData V2 does not allow elements to be typed with `Collection()`. Any `many`
647
- predicate in element definitions is rejected. The only two positions where the `many` predicate
648
- is allowed are `association to many` and `returns many`.
649
-
650
- ## Version 2.1.6 - 2021-04-14
651
-
652
- ### Fixed
653
-
654
- - Do not unjustified complain about `$self` comparisons.
655
- - Auto-exposed entities are represented as projections in the CSN.
656
- - to.sql/to.hdi:
657
- + Revert change "Default values are no longer propagated from the principal to the generated foreign key element." from version 2.1.0
658
- + Fix regression where localized convenience views for temporal entities used keys in the from clause that did not exist on the texts-entity
659
- + Mixin associations are properly removed and are not rendered into views anymore
660
- - to.hdi(.migration): Ensure filenames for `.hdbindex` files stay compatible to V1
661
- - for.odata: An association as a type of action's parameter or return type now signals an error
662
- - to.edm(x):
663
- + `@Capabilities` annotations remain on the containees entity type
664
- + In containment mode don't render foreign keys of the containment constituting 'up' association in the containee
665
- as primary key refs.
666
- + Revert change "Default values are no longer propagated from the principal to the generated foreign key element." from version 2.1.0
667
- + Allow `--odata-proxies` and/or `--odata-x-service-refs` in combination with `--odata-format=flat` and `--version=v4`
668
-
669
- ## Version 2.1.4 - 2021-03-31
670
-
671
- ### Fixed
672
-
673
- - The postinstall step now never fails with an exit code != 0. As the postinstall step is optional, it should not break any `npm install` steps.
674
-
675
- ## Version 2.1.2 - 2021-03-29
676
-
677
- ### Fixed
678
-
679
- - ensure `postinstall` script is part of the shipped `package.json`
680
-
681
- ## Version 2.1.0 - 2021-03-26
682
-
683
- ### Added
684
-
685
- - Inferred sub elements of a referred structure type can be individually annotated.
686
- - All primitive types except for binary are now allowed as enum value types.
687
- - Allow users to define `A.B` even if there is a definition `A` which is not a context or service.
688
- - You can now provide almost all annotation assignments without delimited identifiers:
689
- the use of `.`, `@` and `#` is fine for annotation names,
690
- property names of structures, and in references used as annotation values.
691
- - for.odata:
692
- + All the artifacts that have localized fields get a `$localized: true` property.
693
- + Allow the user to define draft actions for annotation purposes
694
- + `draftPrepare(SideEffectsQualifier: String) returns <ET>`,
695
- + `draftActivate() returns <ET>`,
696
- + `draftEdit(PreserveChanges: Boolean) returns <ET>`
697
- - to.edm(x):
698
- + Warn about non-applicable annotations.
699
- + Render property default values (only OData V4).
700
- + Option `odataProxies` exposes association targets outside of the current service.
701
- These `EntityType`s do only expose their primary keys have no accompanying `EntitySet`.
702
- The added navigation targets are exposed under their namespace or if not available under namespace `root`.
703
- `odataProxies` is only available with `--format=structured`.
704
- + Option `odataXServiceRefs` renders an `edm:Reference` to the service for those navigation targets
705
- that are defined in another service. `odataXServiceRefs` is only available with `--format=structured`.
706
- + Duplicate EntityContainer entries with same name will raise an error.
707
- + `array of` elements are now allowed for OData V2, too.
708
- - to.sql/hdi/hdbcds: Explicitly render the implicit alias for functions without arguments, e.g. `current_date`.
709
- - to.sql:
710
- + Sort the SQL statements according to the deployment order.
711
- + New sql dialect `plain`, which now is the default.
712
- synchronously.
713
- - API:
714
- + `compileSync()` is now compatible to `compile()`:
715
- the function can also receive a file cache and will resolve all `using`s
716
- + New API functions `parse.cql` (prefer it to deprecated `parseToCqn`) and
717
- `parse.expr` (prefer it to deprecated `parseToExpr`)
718
- + function `getArtifactCdsPersistenceName` now accepts a CSN as a third parameter (used to be a namespace). With a CSN provided,
719
- the name can be correctly constructed for naming modes `quoted` and `hdbcds`. Without a CSN, the name is possibly wrong
720
- if it contains dots. If the CSN is not provided or the third parameter is not a CSN, the old, deprecated, implementation is used.
721
- - `cdsc` and other client tools:
722
- + Added `--with-localized` to the command `toCsn` which adds convenience views for localized entities to the output.
723
- + A script `bin/cds_update_identifiers.js` was added. You can use it to update the delimited identifier style in your CDS sources.
724
- + A script `bin/cdscv2m.js` was added.
725
- It's command `ria` adds `@cds.redirection.target: false` annotate statements
726
- for all ambiguous redirection errors.
727
- - Added `deprecated` options; setting any of them disables all `beta` options.
728
-
729
- ### Changed
730
-
731
- - CSN representation:
732
- + CSN Version is set to `2.0`
733
- + CSN `definitions` are not sorted anymore
734
- + `$syntax` is non-enumerable
735
- + increase the use of JS numbers in the CSN for numbers in CDL, especially noticable in annotation values
736
- + Annotation definitions are to be found in the top-level property `vocabularies`.
737
- + Introduce `kind: 'aspect'` to replace `kind: 'type', $syntax: 'aspect'` and
738
- `kind: 'entity', abstract: true` (the deprecated variants are still accepted as input).
739
- + Projections are rendered via `projection` instead of `query.SELECT`.
740
- + Parentheses are represented structurally and unnecessary parentheses are omitted.
741
- + Use `.` instead of `_` for the name suffix of generated texts entities and the calculated entity for managed compositions.
742
- + The CSN returned by `compile()` does not include localized convenience views anymore.
743
- - Core engine (function `compile`):
744
- + An assignment `@Foo.Bar` is always `@Foo.Bar`, we do not try to search anymore
745
- for a local definition of `Foo` probably having a different full name.
746
- + Localized convenience views are no longer generated by the core compiler but added by the `for.odata`
747
- and `to.sql/hdi/hdbcds` processing on demand.
748
- + Minimize name clashes when calculating names for autoexposed entities,
749
- extends the v1 option `dependentAutoexposed` to sub artifacts of entites (see “Added”).
750
- + Ambiguities when redirecting associations now always lead to compile errors;
751
- you might want to use the new annotation `@cds.redirection.target` to solve them.
752
- + The association `up_` in the calculated entity for managed compositions is now managed.
753
- _Limitation_: Nested managed compositions are not activatable via `to.hdbcds --names=hdbcds`.
754
- + Bound actions and functions are no longer propagated from the main query source to the resulting view or projection.
755
- + Remove annotation `@cds.autoexpose` from generated `.texts` entity
756
- + Require `order by` references to start with a table alias when referring to source elements.
757
- + Infer the type of a `select` item from the type of a top-level `cast`.
758
- - Localized convenience views now also contain `masked` elements of the original artifact.
759
- - for.odata:
760
- + Even with `--format: structured`, (flat) foreign keys for managed associations are generated.
761
- + An `entity` or an `aspect` defined outside the current service cannot be used as action parameter or return types.
762
- + Structured elements are expanded in-place.
763
- + Foreign keys for managed associations are created in-place.
764
- - to.edm(x):
765
- + An `Edm.TypeDefinition` is rendered for a derived scalar type and used as type reference instead of
766
- rendering the final scalar type, including the `array of`/`many` predicates.
767
- + `enum` type definition as service member is rendered as `edm:TypeDefinition` instead of `edm:EnumType`.
768
- + Set default source cardinality of compositions to exact one. This is observable in V2 EDM only.
769
- + Key must not be `nullable=true`, this includes all sub elements of used structured types.
770
- + Default values are no longer propagated from the principal to the generated foreign key element.
771
- + `array of array` is rejected, nested Collections `Collection(Collection(...))` are illegal.
772
- + Temporal rendering:
773
- + `@cds.valid.from` is not `Edm.KeyRef` anymore.
774
- + `@cds.valid.key` is rendered as `@Core.AlternateKeys`.
775
- + Downgrade message "`<Term>` is not applied" from warning to info.
776
- + Update Vocabularies 'Aggregation', 'Capabilities', 'Core', 'Validation'.
777
- - to.sql/to.hdi/to.hdbcds:
778
- + Reject using associations or compositions in query elements starting with `$self` or `$projection`.
779
- + Virtual elements are not rendered.
780
- + Structured elements are expanded in-place.
781
- + Foreign keys for managed associations are created in-place.
782
- + Implicit/CDL-style casts are not rendered as SQL CASTs.
783
- + All association usages in queries are always translated into JOIN expressions
784
- (except for to.hdbcds `--names=hdbcds`).
785
- - to.sql/to.hdi:
786
- + Downgrade message `to-many-no-on` from error to warning.
787
- + Default values are no longer propagated from the principal to the generated foreign key element.
788
- - to.sql:
789
- + Changed type mappings for `--dialect=sqlite`:
790
- + `cds.Date` -> `DATE_TEXT`
791
- + `cds.Time` -> `TIME_TEXT`
792
- + `cds.Timestamp` -> `TIMESTAMP_TEXT`
793
- + `cds.DateTime` -> `TIMESTAMP_TEXT`
794
- + `cds.Binary` -> `BINARY_BLOB`
795
- + `cds.hana.Binary` -> `BINARY_BLOB`
796
- + Don't check missing type facets.
797
- - to.hdbcds:
798
- + References to derived, primitive types are replaced by their final type.
799
- The derived type definitions are not rendered anymore for hdbcds naming mode.
800
- + Don't check missing type facets in views.
801
- - to.cdl:
802
- + Render maximum cardinality as 'to one' or 'to many'.
803
- + Return at most two files. The first one (named `model.cds`) contains all definitions, simply rendered in order,
804
- without namespaces or usings. Contexts and services are NOT nested. The second file (named `<namespace>.cds`)
805
- represents the CSN `namespace` property, simply defining such a namespace and requiring the first file.
806
- - API changes:
807
- + The API functions `compile()` and `compileSync()` return a CSN and not an XSN,
808
- `compactModel()` returns the first argument.
809
- + If `options` does not provide a `messages` property, all messages are printed to standard error.
810
- + The `options.messages` is kept throughout the compiler and contains all messages from the compiler and all backends.
811
- + Messages are not sorted anymore; use the API function `sortMessages` to have it sorted.
812
-
813
- ### Removed
814
-
815
- - Core engine (function `compile`):
816
- + Referential integrity issues now always lead to compile errors.
817
- + The `type of` operator (without `:` in the reference) cannot be used
818
- for parameters and inside queries anymore.
819
- + Using `"…"` for delimited identifiers leads to a compile error.
820
- + Issue an error for “smart artifact references”, i.e.
821
- when using `Definition.elem` instead of `Definition:elem`
822
- + The definition of annotations is no longer allowed in `context`s and `service`s.
823
- + Providing an alias name without `as` leads to a compile error or warning.
824
- + Providing unexpected kind of definitions for `type` or other references leads to a compile error.
825
- + The ancient CSN 0.1.0 format generation has been removed.
826
- + The compiler does no longer look for modules whose file extension is `.csn.json`,
827
- both `.csn` and `.json` is still checked.
828
- - for.odata:
829
- + With `--format: structured`, the property `$generatedFieldName` in keys of
830
- managed associations has been removed.
831
- + Artificially exposed types that are required to make a service self contained are
832
- removed from the OData processed CSN.
833
- + Localized convenience views are no longer part of the OData CSN.
834
- - API changes:
835
- + The deprecated XSN based transformers `forHana`, `forOdata`, `toSwagger`, `toSql`, `toCsn`, `toCdl`
836
- have now been removed from the code base.
837
- + Remove `collectSources()` as well as `options.collectSources`.
838
- + A `CompilationError` usually does not have the property `model` anymore,
839
- to avoid potential memory issues.
840
- + CSN compiler messages no longer have a `location` property. Use `$location` instead.
841
- - The following `cdsc` options have been removed:
842
- + `--old-transformers`.
843
- + `--hana-flavor` with all corresponding rudimentarily implemented language constructs.
844
- + `--new-resolve` (the new resolver is now the default).
845
-
846
- ### Fixed
847
-
848
- - Core engine (function `compile`):
849
- + Managed composition in sub elements are now properly redirected,
850
- even if the sub structure comes from a referred type.
851
- + Do not dump with sub queries in the `on` condition of `join`s.
852
- + Properly report that managed aspect composition inside types and as sub elements
853
- are not supported yet.
854
- + Make sure that including elements with managed aspect compositions only
855
- use the provided target aspect, but not the generated target entity.
856
- + Properly handle the extra keywords in the third argument of the HANA SQL function `round`.
857
- - to.edm(x):
858
- + Return all warnings to the user.
859
- + Don't render references and annotations for unexposed associations.
860
- + Rendering of `@Validation.AllowedValue` for elements of type enum annotated with `@assert.range`:
861
- + Add `@Core.Description`, if the enum symbol has a `@Core.Description`, `@description` or document comments.
862
- + Primary key aliases are now the path basenames, colliding aliases are numbered.
863
- + Fix a bug in constraint calculation if principal has no primary keys.
864
- + Illegal OData identifiers which are not exposed in the generated edmx schema are not causing errors anymore.
865
- + Improve non-enum value handling on term definitions based on an enum type by raising a warning and rendering
866
- the value with appropriate scalar EDM type.
867
- + Render annotion qualifier in JSON format.
868
- - to.sql/hdi/hdbcds:
869
- + Reject structured view parameters for HANA.
870
- + Types are not rendered anymore for HANA in quoted mode.
871
- + Structured elements in subqueries are now properly expanded.
872
- + Actions, functions, annotations and events do not have DB specific checks run on them, as
873
- they will not be part of the resulting artifacts anyways
874
- + With `--names=quoted` or `hdbcds`, some `.` in artifact names are turned into `_`.
875
- In general, this happens when part of the name prefix is "shadowed" by a non-context/service;
876
- any `.` after that point is turned into `_`. This change also affects the filenames and the
877
- `@cds.persistence.name` annotation in the CSN returned by `to.hdi.migration` and `for.odata`.
878
- - to.sql/hdi:
879
- + Fixed a bug which led to an exception if elements were referenced as types.
880
- + For the SQLite dialect, date, time and timestamp are rendered as simple string literals instead of function calls.
881
- + For naming mode "plain", date, time and timestamps are rendered as SQL-compliant literals.
882
- - to.sql/hdbcds: Fix issue which led to wrong ON conditions for naming mode `hdbcds`.
883
- - to.sql:
884
- + SRID of SAP HANA spatial type (`ST_POINT` & `ST_GEOMETRY`) is not rendered as the length of `CHAR`
885
- for SQL-dialects other than `hana`. The resulting `CHAR` has a default length of 2000.
886
- - to.hdbcds:
887
- + Nullability constraints on view parameters are not rendered anymore.
888
- + CDS and HANA CDS types inside cast expressions are mapped to their SQL-counterparts, as the CDS types can't be used in a cast.
889
- - to.cdl: Correctly render `event` typed as `projection`.
890
- - to.hdi.migration: Don't generate `ALTER` for type change from association to composition or vice versa (if the rest stays the same),
891
- as the resulting SQL is identical.
892
-
893
- ## Version 1.50.10 - 2021-07-30
894
-
895
- ### Fixed
896
-
897
- - to.hdi.migration: Check for incompatible CSN versions to avoid wrongly generated ALTER|DROP|ADD statements.
898
-
899
- ## Version 1.50.8 - 2021-07-01
900
-
901
- ### Fixed
902
-
903
- - to.hdi.migration: Don't generate `ALTER` for type change from association to composition or vice versa (if the rest stays the same), as the resulting SQL is identical.
904
-
905
- ## Version 1.50.6 - 2021-05-05
906
-
907
- ### Fixed
908
-
909
- - to.edm(x):
910
- + OData V2: Render constraints only if all principal keys are used in association.
911
- + OData V4: Don't remove `@Capabilities` annotations from containee.
912
- + Allow `@Core.MediaType` on all types and raise a warning for those (scalar) types that can't be mapped to `Edm.String` or `Edm.Binary`.
913
-
914
- ## Version 1.50.4 - 2021-04-06
915
-
916
- ### Fixed
917
-
918
- - to.hdbcds: CDS and HANA CDS types inside cast expressions are mapped to their SQL-counterparts, as the CDS types can't be used in a cast.
919
-
920
- ## Version 1.50.2 - 2021-03-19
921
-
922
- ### Fixed
923
-
924
- - Correct calculation of dependent autoexposed entity name
925
- (fixing a potential regression with v1.50.0)
926
- - to.hdi.migration: Correctly handle "temporal" and other cases when rendering expressions
927
- - to.edm(x):
928
- + Improve non-enum value handling on Oasis enum term definitions by raising a warning and rendering
929
- the value with appropriate scalar EDM type.
930
- + Render annotion qualifier in JSON format.
931
- - Update OData vocabularies
932
- 'Aggregation', 'Analytics', 'Capabilities', 'CodeList', 'Common', 'Communication',
933
- 'Core', 'Graph', 'HTML5', 'ODM', 'PersonalData', 'Session', 'UI'
934
-
935
- ## Version 1.50.0 - 2021-02-25
936
-
937
- ### Added
938
-
939
- - Introduce annotation `@cds.redirection.target`.
940
- With value `false`, the projection is not considered an implicit redirection target;
941
- with value `true`, is is considered a “preferred” redirection target.
942
-
943
- ## Version 1.49.2 - 2021-02-16
944
-
945
- ### Fixed
946
-
947
- - to.edm(x): Illegal OData identifiers which are not exposed in the generated edmx schema are not causing errors anymore.
948
- - to.cdl: Annotations are now rendered with the new delimited Identifier syntax
949
- - to.sql/hdi:
950
- + Fixed a bug which led to an exception if elements were referenced as types.
951
- + For the SQLite dialect, date, time and timestamp are rendered as simple string literals instead of function calls.
952
- + For naming mode "plain", date, time and timestamps are rendered as SQL-compliant literals.
953
-
954
- ## Version 1.49.0 - 2021-01-29
955
-
956
- ### Added
957
-
958
- - to.hdi/sql:
959
- + Updated the list of reserved keywords for HANA and SQLite
960
- + Use "smart quoting" for naming mode "plain" - automatically quote reserved keywords
961
- - to.hdi.migration:
962
- + Supports various kinds of entity changes: entity addition/deletion/change (the latter including element additions/deletions/type changes).
963
- + Provides option to render any element type change as `ALTER TABLE DROP` to prevent deployment issues due to incompatible data
964
- (default for length reductions or association/composition changes).
965
- - to.cdl: Smart artifact references are now rendered explicitly via `:` notation
966
-
967
- ### Changed
968
-
969
- - OData/EDMX:
970
- Change the `EntityType` precedence of the OData term definition `AppliesTo=` attribute. If `AppliesTo` contains
971
- both `EntityType` and `EntitySet`, the annotation was assigned to the entity type. Extending an
972
- `AppliesTo=[EntitySet]` with `EntityType` would be OData compliant but incompatible for clients
973
- which still expect the annotation at the set and do not perform the full lookup.
974
- With this change, `EntitySet` and `EntityType` are treated individually, effectively annotating the type and
975
- (if available) the set. This fixes both extendability and client behavior.
976
-
977
- ### Fixed
978
-
979
- - Structured foreign key and forward association reference paths used in ON condition definitions
980
- are now translatable into the correct short form ON condition paths in Association to Join translation.
981
- - to.hdbcds: Aliased mixin-associations are now handled correctly
982
-
983
- ## Version 1.48.0 - 2021-01-15
984
-
985
- ### Changed
986
-
987
- - to.hdbcds/hdi/sql: Reject using associations or compositions in query elements starting with `$self` or `$projection`.
988
- - OData: Update vocabularies 'Common', 'PersonalData', 'UI'.
989
-
990
- ### Fixed
991
-
992
- - Using a hex literal like `x'D028'` (in a CSN input) could lead to an error.
993
- - for.odata:
994
- + Fix a bug in constraint calculation if principal has no primary keys.
995
- + Don't overwrite user defined `@Core.Computed` annotation.
996
- - to.hdi/sql/hdbcds: Fixed a bug during processing of skipped/otherwise not db-relevant artifacts.
997
-
998
- ## Version 1.47.0 - 2020-12-11
999
-
1000
- ### Changed
1001
-
1002
- - Update vocabularies 'Aggregation', 'Common'
1003
-
1004
- ### Fixed
1005
-
1006
- - to.hdbcds/hdi/sql:
1007
- + Types are not rendered anymore for SAP HANA in quoted mode.
1008
- + Aliases are now respected when resolving $self
1009
- + Association clones are now pre-pended with three underscores (`_`) instead of two
1010
- to prevent shadowing of context names or usings
1011
-
1012
- ## Version 1.46.6 - 2020-12-01
1013
-
1014
- ### Fixed
1015
-
1016
- - OData identifiers can now include all unicode characters which are described in the OData specification.
1017
-
1018
- ## Version 1.46.4 - 2020-11-28
1019
-
1020
- ### Fixed
1021
-
1022
- - Association to Join translation: Fix using forward association target as table alias in ON condition.
1023
-
1024
- ## Version 1.46.2 - 2020-11-20
1025
-
1026
- ### Fixed
1027
-
1028
- - to.edm(x) Fix a bug in the alias calculation for key references in structured OData.
1029
-
1030
- ## Version 1.46.0 - 2020-11-20
1031
-
1032
- ### Changed
1033
-
1034
- - to.edm(x):
1035
- + V4 structured key ref path aliases are now the basenames, colliding aliases are numbered.
1036
- + Lower level to `info` for "‹Term› is not applied" message if an annotation cannot be applied.
1037
- - OData:
1038
- + Update vocabulary 'UI'
1039
- + Correctly handle `not null` during flattening. Only if the parent and all subelements in the chain
1040
- are `not null`, make the corresponding flat leaf element `not null`.
1041
-
1042
- ### Fixed
1043
-
1044
- - Do not consider events to be potential targets for implicit redirections:
1045
- strange warnings for multiple projections or other strange errors disappear.
1046
- - to.hdbcds/hdi/sql:
1047
- + Reject structured view parameters for HANA.
1048
- + Correctly handle `not null` during flattening.
1049
- Only if the parent and all subelements in the chain are `not null`, make the corresponding flat leaf element `not null`.
1050
- - to.edm(x): Render @assert.range enum annotations correctly (enum symbol as value and don't omit zero value).
1051
- - Fixed CDS module resolution with option `newResolve` on Windows where a superfluous `\` was prepended to absolute paths.
1052
-
1053
- ## Version 1.45.0 - 2020-10-30
1054
-
1055
- ### Added
1056
-
1057
- - OData: Warn about non-applicable annotations.
1058
-
1059
- ### Changed
1060
-
1061
- - A warning is emitted for annotation definitions inside services/contexts as this won't be
1062
- allowed in the next major cds-compiler release.
1063
- - OData: Update vocabularies 'Analytics' and 'Common'.
1064
-
1065
- ### Fixed
1066
-
1067
- - Association to Join translation: Fill empty select blocks with aliased columns.
1068
- - to.edm(x):
1069
- + Some EDM(x) warnings were not properly passed to the user.
1070
- + Don't render references and annotations for unexposed associations.
1071
- - to.hdbcds: Warnings during rendering of the hdbcds were not raised to the user.
1072
- - Issue which led to wrong on-conditions for `hdbcds` naming mode.
1073
-
1074
- ## Version 1.44.4 - 2020-10-16
1075
-
1076
- ### Fixed
1077
-
1078
- - to.hdbcds/hdi/sql: The processing of managed associations as foreign keys now works regardless of the order in which the possible chains are resolved.
1079
- - OData: Namespaces are brought back into the exposed types. Dots are replaced with underscores in the name.
1080
-
1081
- ## Version 1.44.2 - 2020-10-09
1082
-
1083
- ### Added
1084
-
1085
- - OData: The annotations `@assert.format` and `@assert.range` now result in adding the
1086
- `@Validation.Pattern` and `@Validation.AllowedValues` in the resulting EDMX.
1087
- - A new compiler option `newResolve` is added (`--new-resolve` for `cdsc`). When set to `true` a new
1088
- module resolver is used which needs fewer file lookups. It will become the default in the future.
1089
- - Event definitions can be typed with a reference to an event.
1090
- - When the new option `withLocation` is set,
1091
- the property `$location` in the CSN is enumerable instead of non-enumerable;
1092
- the value of `$location` is an object with sub properties `file`, `line` and `col`
1093
- which describes the source position of all definitions, elements and other members.
1094
-
1095
- ### Changed
1096
-
1097
- - OData:
1098
- + The `namespace` is now not part of the exposed type's name.
1099
- + Update vocabularies 'Aggregation', 'UI' and 'Validation'.
1100
-
1101
- ## Version 1.43.0 - 2020-10-02
1102
-
1103
- ### Added
1104
-
1105
- - The magic variable `$session` is now supported. All element accesses are unchecked.
1106
- - Reference paths as annotation values can now contain identifiers starting with `@`.
1107
-
1108
- ### Changed
1109
-
1110
- - OData:
1111
- + Raise message level for illegal OData identifiers from warning to error.
1112
- + Update vocabularies 'Aggregation' and 'Common'.
1113
-
1114
- ### Fixed
1115
-
1116
- - to.hdi/hdbcds/sql: Correctly process the elements of subqueries in localized view variants
1117
-
1118
- ### Removed
1119
-
1120
- ### Fixed
1121
-
1122
- - OData: put default value validation under `beta:odataDefaultValues`
1123
-
1124
- ## Version 1.42.2 - 2020-09-29
1125
-
1126
- ### Fixed
1127
-
1128
- - CDL: Action blocks can now be empty, e.g. `entity E {…} actions { }`.
1129
- - An info message is emitted if builtin types are annotated. Use a custom type instead.
1130
- Annotating builtins in CDL is possible but when transformed into CSN the annotation was silently lost.
1131
- It is now put into the "extensions" property of the CSN.
1132
- - Fixed `cast()` for simple values like numbers and strings.
1133
-
1134
- - to.sql:
1135
- + Remove simple default value checks and allow the database to reject default values upon activation.
1136
- + Render empty actual parameter list when selecting from a view with parameters which are fully covered with
1137
- default values and no actual parameters are provided in the query itself.
1138
-
1139
- - OData:
1140
- + Correctly render unary operator of default values in EDM.
1141
-
1142
- ## Version 1.42.0 - 2020-09-25
1143
-
1144
- ### Added
1145
-
1146
- - The compiler now supports the `cast(element as Type)` function in queries.
1147
- Using this function will also result in a `CAST` SQL function call.
1148
- - A top-level property `i18n` is now supported. The property can contain translated texts.
1149
- The compiler expects its entries to be objects where each text value is a string.
1150
- - CDL: Empty selection lists in views/projections are now allowed and make it possible to extend
1151
- empty projections. Note that views/projections without any elements are not deployable.
1152
- - For CSNs as input, the compiler returns properties as they are (without checks)
1153
- if their name does not match the regexp `/[_$]?[a-zA-Z]+[0-9]*/` and does not start with `@`.
1154
- With more than one CSN input,
1155
- the compiler only returns the top-level CSN properties of the first source.
1156
-
1157
- ### Changed
1158
-
1159
- - to.cdl: Smart type references are now explicitly rendered via ":"-syntax
1160
-
1161
- ### Removed
1162
-
1163
- ### Fixed
1164
-
1165
- - Annotating an _unknown_ element _twice_ now results in a duplicate annotation error instead
1166
- of silently loosing the annotation.
1167
- - Service/context extensions that reference a non-service/non-context now result in a compiler error
1168
- instead of silently loosing the context/service extension.
1169
- - to.hdbcds/sql/hdi:
1170
- + fix a bug, which resulted in a malformed on-condition, if an association key
1171
- was another association pointing to an entitiy with a structured key.
1172
- + in conjunction with assoc-to-joins, the internal CSN reference broke
1173
- causing missing locations and even internal errors when logging messages
1174
- + managed associations in UNION are now correctly processed
1175
- - The parseCdl mode now correctly resolves type arguments of "many" types.
1176
- - OData: The annotation `@Capabilities.Readable` is now correctly
1177
- translated to `@Capabilities.ReadRestrictions.Readable`.
1178
-
1179
- ## Version 1.41.4 - 2020-09-18
1180
-
1181
- ### Removed
1182
-
1183
- - The length of HANA identifiers are not checked anymore: no more warnings are issued for long identifiers.
1184
-
1185
- ### Fixed
1186
-
1187
- - The check for ignored "localized" keywords in sub-elements has been extended to also
1188
- include references to structured types.
1189
- - A warning was added if views/projections are used as element types.
1190
- - An info message is emitted if a namespace is annotated.
1191
- Annotating namespaces is not possible. Previously the annotation was silently lost.
1192
- It is now put into the "extensions" property of the CSN.
1193
-
1194
- ## Version 1.41.2 - 2020-09-15
1195
-
1196
- ### Fixed
1197
-
1198
- - OData: correctly render primary key associations targeting a composition parent but are not
1199
- the composition enabling association.
1200
- - to.hdbcds/sql/hdi: Do not dump if artifact doesn't exist anymore after association to join translation
1201
- - Only check for unmanaged associations inside of "many"/"array of" in the elements of views and entities,
1202
- not inside of actions and other members.
1203
-
1204
- ## Version 1.41.0 - 2020-09-11
1205
-
1206
- ### Added
1207
-
1208
- - OData: Allow the relational comparison of structures or managed associations in an ON condition as described in
1209
- version 1.32.0 - 2020-07-10 (forHana).
1210
- - Allow `Struct:elem` with and without preceeding `type of` as type reference.
1211
-
1212
- ### Fixed
1213
-
1214
- - to.cdl: Only render enums if they were directly defined there
1215
- - The parseCdl mode now checks for redefinitions to avoid generating invalid CSN.
1216
- - OData: An error is thrown if a redirected target has fewer keys than the original one.
1217
- - OData: Empty structured elements are now handled correctly in `flat` format.
1218
-
1219
- ## Version 1.40.0 - 2020-09-04
1220
-
1221
- ### Added
1222
-
1223
- - to.hdi/sql: Support default values for view parameters.
1224
- - OData: lower message severity from Error to Warning for
1225
- `<entity type> has no primary key` and `<type> has no properties`.
1226
-
1227
- ### Changed
1228
-
1229
- - OData: The foreign key references in associations are not flattened any more with format `structured`.
1230
-
1231
- ### Fixed
1232
-
1233
- - parse.cdl: Properly handle type arguments, most likely relevant for HANA types.
1234
- - OData: Multilevel anonymously defined `composition of <aspect>` is now processed successfully with the OData backend.
1235
- - OData: Fix a bug in EDM generation that caused a dump.
1236
- - Update ANTLR dependency to version 4.8.
1237
-
1238
- ## Version 1.39.0 - 2020-08-26
1239
-
1240
- ### Added
1241
-
1242
- - If the first CDS source (CDL or CSN) provided to the compiler
1243
- has a `namespace` declaration/property, then
1244
- that namespace name is put into the property `namespace` of the returned CSN.
1245
- - An event payload type can now be defined with a type/entity reference or
1246
- or projection (instead of providing the elements directly).
1247
- - Aspects can now be included when specifying the elements of an event payload type,
1248
- as it is known for type, entity and aspect definitions.
1249
-
1250
- ### Fixed
1251
-
1252
- - Fix a bug in explicit JOIN cardinality CDL parsing
1253
- - to.hdbcds/hdi/sql: Identifiers are checked and warnings are raised if the identifier exceeds a length limitation which would result in a deployment error.
1254
- - OData: Service, entity and element identifiers are checked and warnings are raised if an identifier is not compliant with the OData specification.
1255
-
1256
- ## Version 1.38.0 - 2020-08-25
1257
-
1258
- ### Changed
1259
-
1260
- - CSN: The property `payload` of an `event` has been renamed to `elements`.
1261
-
1262
- ### Fixed
1263
-
1264
- - to.hdbcds/hdi/sql: Correctly handle local-scope refs in on-conditions when flattening structures.
1265
- - Run checks for associations inside of `many` or `array of` only on entities and views.
1266
-
1267
-
1268
- ## Version 1.37.0 - 2020-08-21
1269
-
1270
- ### Added
1271
-
1272
- - Projections columns can now use expressions like select items,
1273
- both for `entity … as projection on` and `extend projection … with`.
1274
- - OData: `array of <structure>` or `many <structure>` is now allowed in OData V4, flat format.
1275
-
1276
- ### Changed
1277
-
1278
- - to.hdbcds/hdi/sql:
1279
- + Messages of id "query-no-undefined" are now raised as errors.
1280
- + Aspects/types/abstract entities containing anonymous aspect compositions
1281
- must not be used as types and are removed during transformation.
1282
-
1283
- ### Fixed
1284
-
1285
- - to.cdl: Events are rendered.
1286
- - to.cds: Anonymous aspect composition are now rendered correctly.
1287
- - to.hdbcds/hdi/sql:
1288
- + Events are ignored.
1289
- + local-scope references in on-conditions are now handled correctly during flattening.
1290
- + Removed duplicate messages.
1291
- - A model with multilevel `composition of <aspect>` (spread across several aspect declarations,
1292
- composing one another) is now processed successfully with the OData backend.
1293
- - The CSN parser supports explicit join cardinalities.
1294
- - Prefix a `@assert.unique` table constraint with the table name to avoid name clashes.
1295
-
1296
-
1297
- ## Version 1.36.0 - 2020-08-07
1298
-
1299
- ### Added
1300
-
1301
- - Query select items can now be declared to be virtual.
1302
-
1303
- - CQL now allows to specify a join cardinality. Allowed are any combinations of
1304
- `{ [ EXACT ] ONE | MANY } TO { [ EXACT ] ONE | MANY }` for
1305
- `{ INNER | { LEFT | RIGHT | FULL } [ OUTER ] }` joins.
1306
- The cardinality is added in the for HANA generated `CREATE VIEW` statements.
1307
-
1308
- - Support the creation of unique constraints by assigning `@assert.unique.<constraintName>` to
1309
- non-query entities or query entities annotated with `@cds.persistence.table`. The value of the
1310
- annotation is an array of paths referring to elements in the entity. The path leaf may
1311
- be an element of a scalar, structured or managed association type. Individual foreign keys or
1312
- unmanaged associations can not be accessed. In case the path points to a structured element,
1313
- the unique constraint will contain all columns stemming from the structured type. In case
1314
- the path points to a managed association, the unique constraint will contain all foreign key
1315
- columns stemming from this managed association.
1316
- For HANA a `UNIQUE INVERTED INDEX` and for SQLite a `named unique table constraint` is generated.
1317
-
1318
- ### Changed
1319
-
1320
- - OData: Update vocabularies 'Common', 'UI'
1321
- - The association to join transformation treats foreign key accesses with priority. If a foreign key
1322
- of a managed association can be accessed without joins, no joins are generated.
1323
- The priority handling can be turned of with option `joinfk`.
1324
-
1325
- ### Fixed
1326
-
1327
- - Semantic location in messages is now more precise.
1328
-
1329
- ## Version 1.35.0 - 2020-07-31
1330
-
1331
- ### Added
1332
-
1333
- - Introduce option `localizedLanguageFallback`; if set to value `"none"`, the localized
1334
- convenience views do not use function `coalesce` to select from a default text as fallback.
1335
-
1336
- ### Fixed
1337
-
1338
- - Properly consider targets of compositions in `mixin`s to be autoexposed.
1339
- - Uniformly limit propagation of `@cds.autoexposed`, i.e.
1340
- there is not inheritance from a query source navigating along an association.
1341
- Previously, compiling a compiled model could lead to new autoexposed entities.
1342
- - OData:
1343
- + V2: Distribute various `@sap` specific annotations to the entity container.
1344
- + Always set attribute `Nullable` on properties of type `Collection()`.
1345
-
1346
- ## Version 1.34.0 - 2020-07-27
1347
-
1348
- ### Fixed
1349
-
1350
- - Do not dump with illegal references in explicit `on` conditions of redirections;
1351
- properly report them via error messages.
1352
-
1353
- ## Version 1.33.0 - 2020-07-24
1354
-
1355
- ### Added
1356
-
1357
- - Allow to declare `many/array of` elements, parameters and return types to be `(not) null`.
1358
- The nullability applies to the array items of the element, not the element itself.
1359
- - New boolean option `dependentAutoexposed` to avoid name clashes in dependent
1360
- autoexposed entities (text entities, components of managed compositions).
1361
- - cdsc: Add toOdata version 'v4x' to combine `{ version: 'v4', odataFormat: 'structured', odataContainment: true }`.
1362
-
1363
- ### Changed
1364
-
1365
- - OData:
1366
- + Update vocabularies 'Common', 'Core', 'ODM'.
1367
- + The default nullability for collection value properties is `false`, indicating that the returned collection must
1368
- not contain null value entries.
1369
- - toCdl: Identifiers are now quoted with `![` and `]`. Inner `]` characters are escaped with `]]`.
1370
- - toCdl/toSql: Function names containing non standard HANA identifier characters are rendered case preserving and quoted
1371
- if an appropriate naming mode has been set in the options.
1372
-
1373
- ### Fixed
1374
-
1375
- - forHana: Correctly flatten managed associations as foreign keys used in the definition.
1376
- of another managed association.
1377
- - OData: Don't render aspects as `edm.ComplexType`.
1378
-
1379
- ## Version 1.32.0 - 2020-07-10
1380
-
1381
- ### Added
1382
-
1383
- - Provide semantic code completion for elements, enums, actions and parameters
1384
- in `annotate` and `extend`.
1385
- - forHana: Allow the relational comparison of structures or managed associations in an ON condition.
1386
- Both operands must be structurally compatible, that is both structures must be expandable
1387
- to an identical set of leaf paths. Each leaf path must terminate on a builtin CDS scalar type.
1388
- The original relational term of the form `s1 op s2` is replaced by the resulting expression
1389
- `s1.leafpath_0 op s2.leafpath_0 (AND s1.leafpath_i op s2.leafpath_i)*` with `i < n leaf paths`.
1390
-
1391
- ### Changed
1392
-
1393
- - toCdl: String enums without a value are no longer rendered with their name's string representation as their value.
1394
-
1395
- ### Fixed
1396
-
1397
- - parseCdl: Fix missing extensions in files that extend unknown services/contexts.
1398
- - OData: Do not render an EDM document in case of raised errors
1399
- - to.cdl: Aspects are now correctly rendered as aspects and not as types
1400
-
1401
- ## Version 1.31.2 - 2020-07-03
1402
-
1403
- ### Fixed
1404
-
1405
- - HANA/SQLite: Correctly handle already resolved types when a cds.linked CSN is passed in
1406
- - HANA/SQLite: Ensure that all elements in a Draft are non-virtual
1407
-
1408
- ## Version 1.31.0 - 2020-06-26
1409
-
1410
- ### Added
1411
-
1412
- - forHana/toSql: A (proxy) entity representing a HANA User Defined Function or a HANA Calculation View
1413
- can now be annotated with `@cds.persistence { udf, calcview }` so that queries to these artifacts are
1414
- rendered with the appropriate parameter lists. Parameters for HANA Calculation Views are decorated with
1415
- `PLACEHOLDER."$$<id>$$"`. HANA User Defined Functions without arguments require an empty argument
1416
- list `()` as part of the query source.
1417
- Entities that are assigned with `@cds.persistence { udf, calcview }` cannot contain associations or act as
1418
- association targets, even if they have no defined parameter list.
1419
- Multiple assignments of `@cds.persistence { table, udf, calcview }` to the same entity are rejected.
1420
- - OData V4: Elements with type `array of <scalar type>` are now supported in flat mode
1421
-
1422
- ### Changed
1423
-
1424
- - Option `beta` now only works with selective feature flags. Instead of `beta: true`, a dictionary of `<feature>: true` is expected. Available feature flags are:
1425
- 1. subElemRedirections
1426
- 2. keyRefError
1427
- 3. aspectCompositions
1428
- 4. odataProxies
1429
- 5. uniqueconstraints
1430
- - OData V4: Unmanaged associations/compositions with a target cardinality of exactly one (that is `[1..1]`)
1431
- are rendered as `edmx:NavigationProperty` with attribute `Nullable="false"`
1432
- - OData: On-condition checks are now performed when generating OData as well.
1433
- - SQLite: The property length for string parameters is not longer restricted to 5000 characters.
1434
- - HANA/SQLite: Improved the error message when an entity without elements is found to make it clearer what is expected.
1435
-
1436
- ### Fixed
1437
-
1438
- - An error is emitted if parameters in functions/actions have a default value as it is not yet supported.
1439
- For example by using `type of E:element` where `element` has a default value.
1440
- - OData V2: Derived scalar types are not rendered as `<edmx:TypeDefinition>`, so no annotation assignments to
1441
- such carriers must be rendered.
1442
- - HANA/SQLite: Fixed a bug when flattening structured elements - instead of a human-readable error, an exception was thrown.
1443
-
1444
- ## Version 1.30.0 - 2020-06-12
1445
-
1446
- ### Added
1447
-
1448
- - Projections can now have `where` and `group by`/`having` clauses.
1449
-
1450
- ### Changed
1451
-
1452
- ### Fixed
1453
-
1454
- - `doc` comments in CDL now support Windows-style line breaks (CRLF). They are replaced with `\n` in CSN.
1455
- - `toCdl` no longer renders a `*` column if no columns are used in the original source.
1456
- - Types that have both `type` and `items`/`elements` properties in CSN are now checked to avoid
1457
- mismatches if a unstructured / non-arrayed type is referenced but `items`/`elements` exists.
1458
- - OData:
1459
- + Correctly render CRLF and LF to __&#xa;__ in EDMX
1460
-
1461
- ## Version 1.29.0 - 2020-06-08
1462
-
1463
- ### Added
1464
-
1465
- - Projections can now have `limit` and `order by` clauses.
1466
-
1467
- ### Changed
1468
-
1469
- - OData: Update vocabularies 'CodeList', 'Common', 'Graph', 'UI'
1470
-
1471
- ### Fixed
1472
-
1473
- - Memory usage improvement - compile messages with id `ref-undefined-excluding` uses much less memory.
1474
-
1475
- - HANA/SQL: Validate ON conditions of mixin association definitions in all subqueries
1476
-
1477
- - OData V2: Assign various `@sap` annotations to the `<edmx:EnitySet>` and `<edmx:AssociationSet>`
1478
- if such annotations are assigned to CDS entities or associations.
1479
-
1480
- - OData V4 Structured: Omit foreign keys of managed associations that establish the containment relationship to
1481
- a container, if this association was declared to be primary key.
1482
-
1483
- - OData: Warn about non-integer enums as they are not supported by OData, yet.
1484
-
1485
- - Warn about string values in integer enums and vice versa.
1486
-
1487
- ## Version 1.28.0 - 2020-05-27
1488
-
1489
- ### Added
1490
-
1491
- - API: add `getArtifactCdsPersistenceName()` and `getElementCdsPersistenceName()` which return
1492
- the value of annotation `@cds.persistence.name` for the corresponding artifact/element.
1493
-
1494
- ### Changed
1495
-
1496
- - Issue error if old backends are used with beta mode.
1497
- - Raise severity of message `Unmanaged associations cannot be used as primary key` with id `unmanaged-as-key` to error.
1498
-
1499
- ### Fixed
1500
-
1501
- - OData:
1502
- + Render vocabulary `<edmx:Reference>` and `<edmx:Include>` if vocabulary namespace was used.
1503
- + Reduce memory consumption in EDM Renderer.
1504
- + Render annotations for navigation properties if association is annotated with `@cds.api.ignore: true`.
1505
-
1506
- ## Version 1.27.0 - 2020-05-15
1507
-
1508
- ### Added
1509
-
1510
- ### Changed
1511
-
1512
- - Improve warning messages for integer enum missing a value and chained array of.
1513
- - HANA/SQL
1514
- + Empty structures are not allowed as foreign keys.
1515
- - Report a warning for integer enum elements that do not have values.
1516
- - Report a warning for enums that are not integer- or string-like.
1517
- - OData
1518
- + Update vocabularies 'Common', 'Core', 'Validation'
1519
- + Pass through structures without elements
1520
- + `cds.Decimal` and `cds.DecimalFloat` (deprecated) without precision/scale are rendered
1521
- as `Edm.Decimal` with `Scale=variable` (V4) and `sap:variable-scale="true"` (V2)
1522
-
1523
- ### Fixed
1524
-
1525
- - Memory usage improvement - compile messages do not inherit from Error any more.
1526
- - HANA types in annotation assignments work again.
1527
- - HANA/SQL: Correctly handle temporal in conjunction with namespaces.
1528
- - Fix a bug in Association to Join translation that prevents exposing managed associations via subqueries.
1529
-
1530
- ### Removed
1531
-
1532
- ## Version 1.26.4 - 2020-05-08
1533
-
1534
- ### Added
1535
-
1536
- - Add new OData vocabulary `com.sap.vocabularies.HTML5.v1`
1537
-
1538
- ### Changed
1539
-
1540
- - Report a warning when a deprecated non-snapi backend (OData, HANA/SQL) is called.
1541
-
1542
- - OData:
1543
- + Update vocabulary 'UI'
1544
- + Add annotation `@Common.Label: '{i18n>Draft_DraftAdministrativeData}'` to entity `DraftAdministrativeData`
1545
- + Improve info message for target mismatch on associations that are compared with $self
1546
-
1547
- ### Fixed
1548
-
1549
- - The CSN `val` property is now allowed in enum element extensions. Such CSN can be
1550
- generated using the `parseCdl` mode and it is now compilable.
1551
-
1552
- - Again allow negative values as enum values, fixing a regression introduced with v1.24.6.
1553
-
1554
- - OData: Correctly handle associations in arrayed elements (keyword `many`).
1555
-
1556
- - Annotation assignment checks now recognize HANA types.
1557
-
1558
- ## Version 1.26.2 - 2020-04-24
1559
-
1560
- ### Added
1561
-
1562
- - The client tool `cdsc` has got a new option `--beta <list>` which may be used to
1563
- specify a comma separated list of experimental features to be enabled.
1564
-
1565
- - CSN in parse-cdl mode now has a `requires` property that represents `using`s from CDL.
1566
-
1567
- ### Fixed
1568
-
1569
- - OData:
1570
- + Change foreign key creation order for associations to respect their dependencies.
1571
- + Use correct path during on-condition flattening.
1572
- + Report error when using elements without types for **array of type of (element)** and similar definitions.
1573
-
1574
- - HANA/SQL:
1575
- + Fix references to `null` enum values in default clauses.
1576
-
1577
- - Type arguments are now properly set in CSN when using parse-cdl mode.
1578
-
1579
- - Avoid unjust warning if the `extensions` property of an input CSN contain `extend` statements.
1580
-
1581
- ## Version 1.26.0 - 2020-04-17
1582
-
1583
- ### Added
1584
-
1585
- - The client tool `cdsc` has got a new command `parseCdl` which returns a CSN
1586
- that is close to the original CDL file. It does not resolve imports and does
1587
- not apply extensions.
1588
-
1589
- - Unmanaged associations as primary keys are now warned about.
1590
-
1591
- - `localized` in combination with `key` is now warned about.
1592
-
1593
- - Enum values are now checked to only be either numbers or a strings - a warning is raised.
1594
-
1595
- - Elements in mixin clauses that are _not_ unmanaged associations now produce an error.
1596
-
1597
- ### Changed
1598
-
1599
- - HANA/SQL:
1600
- + Raise warnings `rewrite-not-supported` and `rewrite-undefined-key` to errors.
1601
-
1602
- - Compiler: Empty elements are now kept along for the propagation.
1603
-
1604
- - OData: Annotate all elements of `DraftAdministrativeData` with `@Common.Label: '{i18n>"Draft_<elementName>"}'`
1605
- and elements 'DraftUUID', 'DraftIsCreatedByMe' and 'DraftIsProcessedByMe' with `@UI.Hidden`.
1606
-
1607
- ### Fixed
1608
-
1609
- - Compiler: `type of <unmanaged assocation>` is now handled correctly by raising an error.
1610
-
1611
- ## Version 1.25.0 - 2020-04-09
1612
-
1613
- ### Changed
1614
-
1615
- - Downgrade `chained array of`-error to a warning
1616
- - SQLite: Don't render implicit casts
1617
-
1618
- ## Version 1.24.6 - 2020-04-08
1619
-
1620
- ### Changed
1621
-
1622
- - OData:
1623
- + Improve messages for misaligned forward/backlink associations in EDM generator
1624
- + For V2 add annotations `@sap.creatable: false`, `@sap.updatable: false`, `@sap.deletable: false`,
1625
- `@sap.pageable: false` to the Parameter EntityType and `@sap.creatable: false`, `@sap.updatable: false`,
1626
- `@sap.deletable: false`, `@sap.addressable: false` to the Result EntityType.
1627
- + Update vocabularies 'Common' and 'Graph' and 'ODM'.
1628
-
1629
-
1630
- ### Fixed
1631
-
1632
- - Various messages mention more appropriate source locations.
1633
-
1634
- - Improve messages for `array of`
1635
-
1636
- - OData:
1637
- + Render 'array of' for ReturnType correctly
1638
- + Report error for view fields with no type information early
1639
- + Handle associations in structures with an association as explicit key
1640
-
1641
- ### Removed
1642
-
1643
- - The client tool `cdsc` does not offer the option `--std-json-parser` anymore,
1644
- as it had no effect.
1645
-
1646
- ## Version 1.24.4 - 2020-03-25
1647
-
1648
- ### Added
1649
-
1650
- ### Changed
1651
-
1652
- - `doc` comment propagation can now also be stopped by comments that only contain whitespace
1653
- (including newlines) like `/** */`.
1654
-
1655
- - OData:
1656
- + Remove redundant service name and `__` prefix out of dynamically exposed substructures.
1657
- + Update vocabularies 'Capabilities' and 'Graph'.
1658
-
1659
- ### Fixed
1660
-
1661
- - OData:
1662
- + Process correctly "type of".
1663
- + Process correctly elements with underscore as prefix.
1664
-
1665
- - Preserve parameter list in localized convenience views.
1666
-
1667
- ## Version 1.24.3 - 2020-03-16
1668
-
1669
- ### Added
1670
-
1671
- ### Changed
1672
-
1673
- ### Fixed
1674
-
1675
- - Force usage of resolve@1.8.1 instead of semver to avoid issues with file cache
1676
-
1677
- ## Version 1.24.2 - 2020-03-13
1678
-
1679
- ### Added
1680
-
1681
- - Support function calls like `count( distinct ... )` and `count( all ... )`.
1682
-
1683
- - With option `--doc-comment` comments of the form `/**...*/` are preserved, if these comments
1684
- appear at positions where annotation assignments are allowed. `doc` comments are propagated
1685
- like annotations until an empty comment `/***/` disrupts the propagation.
1686
-
1687
- - OData:
1688
- + Add new OData vocabularies `com.sap.vocabularies.Graph.v1` and `com.sap.vocabularies.ODM.v1`
1689
- + With option `--odata-containment`, `parent` association and inferred key elements for
1690
- `composition of <aspect>` as well as inferred keys of `_texts` entities are not rendered.
1691
- + OData V4: Produce primary key paths with length limited alias names.
1692
-
1693
- ### Changed
1694
-
1695
- ### Fixed
1696
-
1697
- - When not disabled by `@cds.autoexpose:false`, an entity used as composition target
1698
- is auto-exposed in the current service;
1699
- this did not work always if the target was a _query_ entity.
1700
-
1701
- - Foreign key creation in odata flat-mode when following associations.
1702
-
1703
- - Rename `@description` to `@Core.Description` in all cases as part of the OData transformation of a CSN.
1704
-
1705
- - When generating extensions from EDMX annotations, handle correctly targets from an EntityContainer.
1706
-
1707
- - Apply service annotations in EDMX generation.
1708
-
1709
-
1710
- ### Removed
1711
-
1712
- - Warning 'Service should not have more then one draft root artifact'
1713
-
1714
- - Experimental annotation '@cds.odata.{v2|v4}.ignore`
1715
-
1716
- - OData vocabulary `com.sap.vocabularies.odm.v1` (lowercase 'odm')
1717
-
1718
- - `--beta-mode` from option `--odata-containment`.
1719
-
1720
- ## Version 1.24.1 - 2020-03-06
1721
-
1722
- ### Added
1723
-
1724
- - Add new OData vocabulary `com.sap.vocabularies.odm.v1`
1725
-
1726
- ### Changed
1727
-
1728
- - Expressions in mixin-definitions are now validated.
1729
- - OData:
1730
- + Redirect inbound associations to entities with parameters to corresponding Parameter EntityType.
1731
- + Update vocabulary `UI`
1732
- - Use semver for dependencies
1733
-
1734
- ### Fixed
1735
-
1736
- - Resolve backlink mixin association usages uniformly in association to join translation.
1737
-
1738
-
1739
- ## Version 1.24.0 - 2020-02-28
1740
-
1741
- ### Added
1742
-
1743
- - If an entity `E` with localized elements has the annotation `@fiori.draft.enabled`,
1744
- a new element `ID_texts` of type `cds.UUID` is added to `E_texts` as the _only key_ and
1745
- the annotation `@odata.draft.enabled` will not be set to false for `E.texts`.
1746
- - A comment of the form `/**…*/` at "annotation positions" is now considered a doc comment;
1747
- its "cleaned-up" text is put into the CSN as value of the property `doc`.
1748
- In the OData/EDMX, it appears as value for the annotation `@Core.Description`.
1749
-
1750
- ### Fixed
1751
-
1752
- - HANA CDS: When casting a column to an enum type, don't render it as an enum
1753
- - Ignore top-level CSN "annotations" like `@sql_mapping` in the CSN frontend.
1754
- - OData: Key constraint checks for Draft enabled entities consider EDM exposed keys only.
1755
- - Message level for draft key checks is raised to 'warning' again.
1756
- - Action and function calls are checked for missing arguments.
1757
- - All references are correctly transformed in flatten mode.
1758
319
 
1759
320
 
1760
321
  ## Older Versions