@sap/cds-compiler 6.4.2 → 6.5.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 (71) hide show
  1. package/CHANGELOG.md +87 -1159
  2. package/README.md +1 -10
  3. package/doc/IncompatibleChanges_v5.md +436 -0
  4. package/doc/IncompatibleChanges_v6.md +659 -0
  5. package/doc/Versioning.md +3 -7
  6. package/lib/api/main.js +1 -0
  7. package/lib/api/options.js +5 -0
  8. package/lib/api/validate.js +3 -0
  9. package/lib/base/message-registry.js +25 -2
  10. package/lib/base/messages.js +1 -1
  11. package/lib/base/model.js +3 -2
  12. package/lib/checks/actionsFunctions.js +6 -3
  13. package/lib/checks/existsExpressionsOnlyForeignKeys.js +16 -10
  14. package/lib/checks/existsInForbiddenPlaces.js +32 -0
  15. package/lib/checks/existsMustEndInAssoc.js +1 -1
  16. package/lib/checks/existsMustNotStartWithDollarSelf.js +31 -0
  17. package/lib/checks/validator.js +6 -2
  18. package/lib/compiler/assert-consistency.js +5 -7
  19. package/lib/compiler/builtins.js +5 -6
  20. package/lib/compiler/checks.js +4 -8
  21. package/lib/compiler/define.js +244 -459
  22. package/lib/compiler/extend.js +297 -11
  23. package/lib/compiler/finalize-parse-cdl.js +2 -10
  24. package/lib/compiler/generate.js +29 -1
  25. package/lib/compiler/populate.js +21 -63
  26. package/lib/compiler/propagator.js +1 -2
  27. package/lib/compiler/resolve.js +2 -12
  28. package/lib/compiler/shared.js +145 -114
  29. package/lib/compiler/tweak-assocs.js +14 -10
  30. package/lib/compiler/utils.js +97 -0
  31. package/lib/compiler/xpr-rewrite.js +113 -140
  32. package/lib/edm/annotations/edmJson.js +9 -6
  33. package/lib/edm/annotations/genericTranslation.js +8 -4
  34. package/lib/edm/csn2edm.js +3 -4
  35. package/lib/edm/edmInboundChecks.js +1 -2
  36. package/lib/edm/edmPreprocessor.js +3 -3
  37. package/lib/gen/CdlGrammar.checksum +1 -1
  38. package/lib/gen/CdlParser.js +4 -3
  39. package/lib/gen/Dictionary.json +16 -1
  40. package/lib/json/from-csn.js +4 -6
  41. package/lib/json/to-csn.js +3 -3
  42. package/lib/model/csnRefs.js +13 -4
  43. package/lib/model/enrichCsn.js +4 -2
  44. package/lib/optionProcessor.js +8 -4
  45. package/lib/parsers/AstBuildingParser.js +1 -1
  46. package/lib/render/utils/sql.js +3 -2
  47. package/lib/transform/db/applyTransformations.js +1 -1
  48. package/lib/transform/db/assertUnique.js +3 -3
  49. package/lib/transform/db/assocsToQueries/normalizeFrom.js +33 -0
  50. package/lib/transform/db/assocsToQueries/transformExists.js +17 -13
  51. package/lib/transform/db/assocsToQueries/utils.js +1 -6
  52. package/lib/transform/db/backlinks.js +4 -4
  53. package/lib/transform/db/cdsPersistence.js +4 -4
  54. package/lib/transform/db/constraints.js +4 -4
  55. package/lib/transform/db/expansion.js +5 -5
  56. package/lib/transform/db/flattening.js +4 -5
  57. package/lib/transform/db/rewriteCalculatedElements.js +3 -3
  58. package/lib/transform/db/temporal.js +11 -11
  59. package/lib/transform/draft/db.js +2 -0
  60. package/lib/transform/draft/odata.js +5 -7
  61. package/lib/transform/effective/flattening.js +1 -2
  62. package/lib/transform/forOdata.js +3 -3
  63. package/lib/transform/forRelationalDB.js +1 -1
  64. package/lib/transform/localized.js +13 -20
  65. package/lib/transform/odata/createForeignKeys.js +1 -2
  66. package/lib/transform/odata/flattening.js +1 -2
  67. package/lib/transform/odata/toFinalBaseType.js +52 -55
  68. package/lib/transform/transformUtils.js +3 -4
  69. package/package.json +3 -3
  70. package/doc/CHANGELOG_BETA.md +0 -464
  71. package/doc/CHANGELOG_DEPRECATED.md +0 -235
package/CHANGELOG.md CHANGED
@@ -4,9 +4,67 @@
4
4
  <!-- markdownlint-disable MD004 -->
5
5
  <!-- (no-duplicate-heading)-->
6
6
 
7
- Note: `beta` fixes, changes and features are usually not listed in this ChangeLog
8
- but in [doc/CHANGELOG_BETA.md](doc/CHANGELOG_BETA.md).
9
- The compiler behavior concerning `beta` features can change at any time without notice.
7
+ If you upgrade from a previous version, you might want to read in more detail about
8
+ incompatible [changes between v5 and v6](./doc/IncompatibleChanges_v6.md)
9
+ and [changes between v4 and v5](./doc/IncompatibleChanges_v5.md).
10
+
11
+ Note: while we list new `beta` flags and their removal in this ChangeLog,
12
+ we might not list every change in its behavior here.
13
+ Productive code should never require a `beta` flag to be set, and
14
+ might use a deprecated flag only for a limited period of time.
15
+
16
+ ## Version 6.5.0 - 2025-11-21
17
+
18
+ ### Added
19
+
20
+ - compiler:
21
+ + remove all special restrictions for references after an `exists` predicate
22
+ (backends might introduce restrictions relevant for them)
23
+ + support runtimes to improve draft handling (calc elements, column expressions)
24
+ - for.odata/to.edm(x):
25
+ + `is (not) null` operator is now supported in annotation expressions
26
+ + in OData version 2, all elements of the `DraftAdministrativeData` EntityType get
27
+ the annotation `UI.HiddenFilter` with value `true`
28
+ + artifacts annotated with `@cds.external: 2` are now processed by the OData backend
29
+ - to.sql:
30
+ + the `exists` predicate can now be defined as a filter condition on the leaf of the `from` path
31
+ i.e. `select from Books[exists author]` is equivalent to `select from Books where exists author`
32
+
33
+ ### Changed
34
+
35
+ - compiler: report an error for an `annotate` on non-existent definitions
36
+ with security-relevant annotations (`@restrict`, `@requires`, `@ams.…`)
37
+ - Update OData vocabularies: Capabilities, Common, Hierarchy
38
+
39
+ ### Fixed
40
+
41
+ - compiler: make an annotation `@cds.autoexpose: false` on an aspect used as
42
+ `Composition` target have the desired effect (similar on `cds.common.TextsAspect`)
43
+
44
+ ## Version 6.4.6 - 2025-10-23
45
+
46
+ ### Fixed
47
+
48
+ - compiler: a references to an element of the target in a filter for associations
49
+ inside an annotation expression does not lead to a compiler message requesting
50
+ users to provide the annotation themselves (regression with v6.4.4)
51
+
52
+ ## Version 6.4.4 - 2025-10-15
53
+
54
+ ### Fixed
55
+
56
+ - compiler:
57
+ + properly rewrite references in arguments of associations in annotation expressions
58
+ + a references to a variable (`$user.id`, …) in a filter of an annotation expression
59
+ does not lead to a compiler message requesting users to provide the annotation themselves
60
+ + improve code completion in annotation expressions: the editor can display valid names
61
+ for references even if the expression does not properly end by `)`
62
+ - to.sql:
63
+ + reject `$self` in infix filter following exists predicate instead of just ignoring the filter expression
64
+ + properly add comparison for the `tenant` discriminator to the `join` condition of `localized` views
65
+ if the non-published option for tenant support is set (regression with v6.4.0)
66
+
67
+ ### Removed
10
68
 
11
69
  ## Version 6.4.2 - 2025-10-07
12
70
 
@@ -17,8 +75,8 @@ The compiler behavior concerning `beta` features can change at any time without
17
75
  + avoid clutter in message text for syntax errors: use `‹Value›` instead of listing value tokens
18
76
  - compiler: fix suppression of warnings when annotating backend-generated things
19
77
  like draft entities or localized convenience views
20
- - to.sql|hdi|hdbcds: Fix handling of structured columns when calculated elements are used
21
- don't add explicit casts too eagerly
78
+ - to.sql|hdi|hdbcds: don’t report unjustified errors when projecting structured elements and
79
+ calculated elements had been used (regression with v6.4.0)
22
80
 
23
81
  ## Version 6.4.0 - 2025-09-26
24
82
 
@@ -239,14 +297,29 @@ The compiler behavior concerning `beta` features can change at any time without
239
297
 
240
298
  - for.odata/to.edm(x):
241
299
  + Annotating the generated `DraftAdministrativeData` artifacts and their elements is now supported.
300
+ - beta flag `v7preview`: if set, the compiler reports those issues as errors
301
+ which we consider severe enough to report as error with the v7 release.
302
+ - new `deprecated` flags (which can't be used together with beta flag):
303
+ + If the deprecated flag `noQuasiVirtualAssocs` is set, managed to-many associations
304
+ will get foreign keys as they got in compiler v5. If not set, managed to-many associations
305
+ without explicit foreign keys don't get `keys` anymore in cds-compiler v6.
306
+ + If the deprecated flag `noCompositionIncludes` is set, generated entities for compositions
307
+ of named aspect will not get an `includes` property.
308
+ + If the deprecated flag `noPersistenceJournalForGeneratedEntities` is set,
309
+ `@cds.persistence.journal` will _not_ be propagated to generated entities,
310
+ including generated `.texts` entities for localized entities, nor generated entities
311
+ for managed compositions of aspects. If not set, this annotation is copied to those entities
312
+ in compiler v6.
242
313
 
243
314
  ### Removed
244
315
 
245
316
  - compiler:
246
317
  + The Antlr-based parser is removed.
247
- + v5 deprecated flags are removed, see [CHANGELOG_DEPRECATED.md](doc/CHANGELOG_DEPRECATED.md).
248
318
  + Option `compositionIncludes` is removed, as its default is `true`; instead, a deprecated flag was added.
249
319
  - to.hdbcds: The HDBCDS backend is deprecated and can no longer be invoked.
320
+ - beta feature `v6preview`
321
+ - deprecated flags `includesNonShadowedFirst`, `eagerPersistenceForGeneratedEntities` and
322
+ `noKeyPropagationWithExpansions`
250
323
 
251
324
  ### Fixed
252
325
 
@@ -358,6 +431,8 @@ The compiler behavior concerning `beta` features can change at any time without
358
431
  in parentheses such as `[ (1), (2) ]`, as well as "infinite" by using `[ _, _ ]`.
359
432
  - for.odata/to.edm(x)/for.seal: Propagate annotation expressions from managed associations
360
433
  to the foreign keys
434
+ - beta feature `v6preview`: if set, the compiler reports those issues as errors
435
+ which we consider severe enough to report as error with the v6 release.
361
436
 
362
437
  ### Changed
363
438
 
@@ -530,6 +605,11 @@ The compiler behavior concerning `beta` features can change at any time without
530
605
  - CDL parser: Issue warning for arrayed parameter with default value.
531
606
  - to.cdl: Arrayed parameters with default values were not rendered correctly.
532
607
 
608
+ ### Removed
609
+
610
+ - beta flag `optionalActionFunctionParameters`: in v5, action and function parameters
611
+ can be specified as optional without setting this beta flag.
612
+
533
613
  ## Version 5.2.0 - 2024-08-27
534
614
 
535
615
  ### Added
@@ -645,1156 +725,4 @@ This is a preview version for the major release and contains breaking changes. I
645
725
 
646
726
  - API: Deprecated functions `preparedCsnToEdmx` and `preparedCsnToEdm` were removed.
647
727
  Use `to.edm(x)` instead.
648
-
649
- ## Version 4.9.10 - 2025-04-29
650
-
651
- ### Fixed
652
-
653
- - Added option `allowMixinInProjectionExtension` which allows referring to mixins in `extend projection`.
654
- This was forbidden in cds-compiler v4, but re-introduced in v5.5. Users wanting to migrate from cds-compiler
655
- v3 to v4 can use this option for easier migration.
656
-
657
- ## Version 4.9.8 - 2024-07-29
658
-
659
- ### Fixed
660
-
661
- - compiler: Fix extensions with bound actions using an explicit binding parameter in `parseCdl` CSN.
662
- - to.edm(x): No `Nullable` attribute for `$ReturnType` of `Collection(<entity type>)` [OData V4 CSDL, section 12.8 Return Type](https://docs.oasis-open.org/odata/odata-csdl-xml/v4.01/odata-csdl-xml-v4.01.html#sec_ReturnType)
663
-
664
- ## Version 4.9.6 - 2024-07-15
665
-
666
- ### Fixed
667
-
668
- - for.seal: Don't generate DRAFT artifacts.
669
- - for.odata: Propagate all `@odata { Type, MaxLength, Precision, Scale, SRID }` to generated foreign keys.
670
- - to.edm(x): Respect `AppliesTo` specification in term definitions for actions and functions.
671
- - to.sql: Conditions inside filters in combination with foreign key aliases were not properly translated in rare cases.
672
-
673
- ## Version 4.9.4 - 2024-05-21
674
-
675
- ### Fixed
676
-
677
- - to.sql:
678
- + always include `tenant` column in foreign key references.
679
- + reject `tenantDiscriminator` option only if sql dialect is `hana` and if `withHanaAssociations` option is set.
680
-
681
- ## Version 4.9.2 - 2024-05-13
682
-
683
- ### Fixed
684
-
685
- - compiler: Rewriting annotation expression paths in structures of projections has been improved.
686
- - to.edm(x):
687
- + Operator `/` represents `DivBy` operator, explicit `DivBy` is replaced with `Div` as integer division.
688
- - to.sql: consider all associations in tenant dependent entity for referential constraint generation
689
-
690
- ## Version 4.9.0 - 2024-04-25
691
-
692
- ### Added
693
-
694
- - compiler: Annotations with expressions are now rewritten when propagated.
695
- - for.seal: Added API function that produces a CSN for SEAL.
696
- - for.odata/to.edm(x): Support annotation path expressions including path flattening.
697
-
698
- ### Changed
699
-
700
- - parser: A space between `.` and `*`/`{` (nested projections) is now a warning.
701
- Use `bin/cds_remove_invalid_whitespace.js` to automatically fix this warning.
702
- - compiler:
703
- + Published compositions with filters are changed to associations.
704
- + Expressions as annotation values are rejected for few known annotations that don't expect them.
705
- - Update OData vocabularies: 'Aggregation', 'Capabilities', 'Common', 'Hierarchy', 'PersonalData', 'Session', 'UI'.
706
- - to.edm(x): Exposed anonymous parameter types are now prefixed with `ap`, `bap` and `ep` for actions, bound actions and entities.
707
-
708
- ### Fixed
709
-
710
- - compiler:
711
- + Deprecated `$parameters` is no longer proposed in code completion.
712
- + Duplicate mixin definitions lead to failing name resolution.
713
- - to.cdl: Types were always rendered for associations with filters, even if it would lead to a compilation failure.
714
- - to.edm(x):
715
- + Fix a recursion bug in entity parameter handling.
716
- + Fix event exclusion in service preprocessing.
717
-
718
- ## Version 4.8.0 - 2024-03-21
719
-
720
- ### Added
721
-
722
- - compiler: Type `cds.Vector` was added. It is mapped to `REAL_VECTOR` on SAP HANA.
723
- - Support associations to/from entities with parameters for SAP HANA SQL (hdi/direct).
724
- - to.sql/to.hdi:
725
- + SAP HANA keywords `ABSOLUTE`, `REAL_VECTOR`, and `ST_ASESRIJSON` are now included for smart quoting.
726
- + PostgreSQL keyword `SYSTEM_USER` is now included for smart quoting.
727
- - API: Added `to.sql.postgres.keywords` and `to.sql.h2.keywords`.
728
- They contain keywords for the respective SQL dialect.
729
-
730
- ### Changed
731
-
732
- - compiler: Overriding an included element must not change the type to an association
733
- if it wasn't an association before and vice versa.
734
- - Update OData vocabularies: 'Authorization', 'Common', 'UI'.
735
-
736
- ### Fixed
737
-
738
- - compiler: `cast()`s to structured types and associations are now rejected. They could lead to crashes before.
739
- - to.edm(x):
740
- + Reject action/function return types that are declared `many of many`.
741
- + Render user defined annotation type `cds.Integer` as `Edm.Int`.
742
- - to.sql|hdi|hdbcds:
743
- + Correctly handle `.list` during flattening.
744
- + Improve handling of `.items`.
745
- - to.sql|hdi.migration:
746
- + Turn types and aspects into dummies to reduce CSN size.
747
- + Correctly detect a removed `.default` and forcefully set the default to `null`.
748
-
749
- ## Version 4.7.6 - 2024-02-29
750
-
751
- ### Fixed
752
-
753
- - OData: Restored compatibility with the Java runtime.
754
- Drafts generation was applied twice.
755
-
756
-
757
- ## Version 4.7.4 - 2024-02-27
758
-
759
- ### Fixed
760
-
761
- - OData: Fixed infinite recursion in draft handling for nested recursive compositions.
762
-
763
-
764
- ## Version 4.7.2 - 2024-02-26
765
-
766
- ### Fixed
767
-
768
- - Restored compatibility with `@sap/cds-dk` for Java runtime.
769
-
770
-
771
-
772
- ## Version 4.7.0 - 2024-02-23
773
-
774
- ### Added
775
-
776
- - compiler: Virtual elements can now be referenced in expressions in annotation.
777
-
778
- ### Changed
779
-
780
- - Update OData vocabularies: 'Authorization', 'Common', 'Hierarchy', 'UI'.
781
- - to.edm(x): `@cds.odata.valuelist` renders all non-key elements of the value help list as `ValueListProperty`.
782
-
783
- ### Fixed
784
-
785
- - CDL parser: a `select` after two or more `(`s in an expression or condition
786
- could cause some constructs in that query, such as `virtual`, to be not properly parsed.
787
- - compiler: published associations with filters sometimes had the filter applied twice
788
- if used in inline aspect compositions
789
- - to.sql|hdi|hdbcds[.migration]:
790
- + With `withHanaAssociations`: `false`, remove the association elements from the final CSN in order
791
- to correctly detect them during migration scenarios and
792
- with generated `hdbcds`.
793
- + Skip expensive processing (for calculated elements and nested projections) if the model doesn't use it.
794
- + Don't greedily set alias on subqueries if not required.
795
- + Remove bound actions and turn all non-database relevant artifacts into dummies to simplify and shrink CSN.
796
-
797
- ## Version 4.6.2 - 2024-02-02
798
-
799
- ### Fixed
800
-
801
- - compiler: Fix incorrect error about type properties if deprecated flag `ignoreSpecifiedQueryElements` is set.
802
- - Update OData vocabularies: 'Authorization', 'Common'.
803
-
804
-
805
- ## Version 4.6.0 - 2024-01-26
806
-
807
- ### Added
808
-
809
- - compiler: Events can now be projections on other structured events and types.
810
- - to.cdl: `parseCdl` and `gensrc` style CSN (a.k.a. `inferred` and `xtended`) is now supported as input.
811
-
812
- ### Changed
813
-
814
- - Update OData vocabularies: 'Aggregation', 'Validation'
815
- - to.sql/hdi/hdbcds: Removed warnings for number and type of keys in draft-enabled entities.
816
-
817
- ### Fixed
818
-
819
- - compiler:
820
- + ON-conditions of associations with filters in calculated elements were incorrectly rewritten when included
821
- in other entities, and the filter was applied twice in some scenarios.
822
- + redirecting an association with filter did not rewrite paths relative to the redirection target.
823
- + Unknown type references with an explicit named type argument such as `Unknown(length: 10)` crashed.
824
- - to.edm(x):
825
- + `@Core.IsURL` is not rendered in combination with `@Core.MediaType` (V4 only).
826
- + No 'odata-navigation' warning for association targets annotated with `@cds.autoexpose: false`.
827
- + No empty annotation in API, when a non-existent base annotation is annotated
828
- (eg. `@Common.Label.@Core.Description` without `@Common.Label`).
829
- + Don't crash if value for `$Type` is not a string.
830
- + Generated foreign keys of type `cds.UUID` that are also primary key are not annotated with
831
- `@Core.ComputedDefaultValue`. This is a follow up correction to [4.5.0](#version-450---2023-12-08)
832
-
833
-
834
- ## Version 4.5.0 - 2023-12-08
835
-
836
- ### Added
837
-
838
- - compiler/parser
839
- + Annotations can have any expressions as value, like `@Anno: ( ref + 1 )`.
840
- References are checked to be valid element references,
841
- inherited values might become invalid due to element renaming.
842
- This feature is still experimental, and
843
- might not be supported by all backends or runtimes at the moment.
844
- + A single `annotate` statement can now be used to annotate parameters, elements and
845
- bound actions in one statement.
846
- - to.edm(x): Key elements of type `cds.UUID` are annotated with `@Core.ComputedDefaultValue` if they are
847
- defined directly in the entity. Elements of type `cds.UUID` that are defined in a named structured type
848
- and used to define a key element are not annotated, instead a warning is raised if such elements are
849
- not annotated with `@Core.ComputedDefaultValue`.
850
- - to.sql|hdi: Add option `withHanaAssociations` which, for sqlDialect `hana`, allows suppressing
851
- the generation of the `WITH ASSOCIATIONS`.
852
-
853
- ### Changed
854
-
855
- - Update OData Vocabulary: 'Common'.
856
- - api: Reject CSN as input in backends, if it is a CSN in flavor `parsed` with a non-empty `requires` array.
857
- Reason being that the model is not considered a "full" CSN, as dependencies were not resolved.
858
-
859
- ### Fixed
860
-
861
- - compiler:
862
- + Fix false positives of cyclic dependencies for calculated elements.
863
- + Fix cardinality on source associations when publishing them with a filter (+ different cardinality)
864
- in a projection. The cardinality was incorrectly changed on the source as well.
865
- - CDL parser:
866
- + More numbers that would lose relevant digits due to precision loss are
867
- stored as strings in CSN (i.e. `{ "literal":"number", "val": "1.0000000000000001" }`).
868
- + Nested table expressions and queries in the FROM clause (with surrounding parentheses)
869
- could cause some constructs such as `virtual` to be not properly parsed.
870
- - to.hdi.migration: Don't drop-create the primary key when only a doc-comment has changed.
871
- - to.cdl: Fix edge case where `@A.![B#]` was not rendered correctly.
872
-
873
- ### Removed
874
-
875
- - to.edm(x): Remove option `--odata-open-type` introduced with [4.4.0](#version-440---2023-11-09).
876
-
877
- ## Version 4.4.4 - 2023-11-24
878
-
879
- ### Fixed
880
-
881
- - to.hdi.migration: Changes in only `doc`-comments should not result in a drop-create of the primary key.
882
-
883
- ## Version 4.4.2 - 2023-11-17
884
-
885
- ### Fixed
886
-
887
- - for.odata: Fix crash when using a projection with associations as action parameter type.
888
- - to.edm(x): `Edm.AnyPropertyPath` is hard to `Edm.PropertyPath`. As there is no dynamic path evaluation,
889
- `Edm.NavigationPropertyPath` must be enforced via `$edmJson`.
890
- `Edm.AnyPropertyPath` has been used in `@Aggregation.ApplySupported.GroupableProperties` for the first
891
- time after vocabulary update with [4.4.0](#version-440---2023-11-09).
892
-
893
- ## Version 4.4.0 - 2023-11-09
894
-
895
- ### Added
896
-
897
- - compiler: International letters such as `ä` can now be used in CDS identifiers without quoting.
898
- Unicode letters similar to JavaScript are allowed.
899
- - to.edm(x):
900
- + Allow to render all complex types within a requested service as `OpenType=true` with option `--odata-open-type`.
901
- Explicit `@open: false` annotations are not overwritten.
902
- + Allow to annotate the generated draft artifacts but not generated foreign keys (as with any other managed association).
903
- - to.sql|hdi|hdbcds: Allow annotating the generated `.drafts` tables.
904
-
905
- ### Changed
906
-
907
- - CDL parser: improve error recovery inside structured annotation values
908
- - Update OData vocabularies: 'Aggregation', 'Common', 'Core', 'Hierarchy', 'ODM', 'UI'.
909
-
910
- ### Fixed
911
-
912
- - parser:
913
- + `/**/` was incorrectly parsed as an unterminated doc-comment, leading to parse errors.
914
- + Doc-comments consisting only of `*` were not correctly parsed.
915
- - compiler: do not propagate `default`s in a CSN of flavor `xtended`/`gensrc`.
916
- - to.hana: Fix various bugs in association to join translation. Support `$self` references
917
- in filter expressions.
918
- - to.edm(x): Omit `EntitySet` attribute on `Edm.FunctionImport` and `Edm.ActionImport` that return
919
- a singleton.
920
- - to.sql|hdi.migration: Improve handling of primary key changes - detect them and render corresponding drop-create.
921
-
922
- ## Version 4.3.2 - 2023-10-25
923
-
924
- ### Fixed
925
-
926
- - compiler: Fix auto-exposure of composition target entities inside anonymous composition target aspects.
927
- - to.hana: Fix a bug in association to join translation, expect ON condition operand to be a function without arguments.
928
-
929
- ## Version 4.3.0 - 2023-09-29
930
-
931
- ### Added
932
-
933
- - compiler: it is possible to publish associations with filters in views.
934
- Managed associations become unmanaged ones. For example:
935
- ```cds
936
- entity Proj as projection on Base {
937
- assoc[id = 1],
938
- };
939
- ```
940
-
941
- ### Changed
942
-
943
- - Update OData vocabularies: 'Aggregation', 'Capabilities', 'Common', 'PDF', 'PersonalData', 'UI'.
944
-
945
- ### Fixed
946
-
947
- - parser: Chained methods without arguments such as `b` in `a().b.c()` were lost.
948
- - compiler:
949
- + Type arguments in `cast()` functions, whose column also has an explicit type set, were not
950
- properly checked. Now the `cast()`s type and type arguments are checked.
951
- + SQL function `STDDEV(*)` was not parsable.
952
- + In views, published association's ON-conditions containing `$projection` are now rewritten
953
- to `$self` in the CSN `elements` property. This ensures recompilability of the CSN.
954
-
955
- ## Version 4.2.4 - 2023-09-14
956
-
957
- ### Fixed
958
-
959
- - OData: For compatibility with the Java runtime, don't prepend table aliases to column aliases unless necessary.
960
-
961
- ## Version 4.2.2 - 2023-08-31
962
-
963
- ### Fixed
964
-
965
- - to.sql|hdi.migration: Fix bug that caused a migration to be rendered for the HANA CDS types that were removed from the CSN
966
-
967
- ## Version 4.2.0 - 2023-08-29
968
-
969
- ### Added
970
-
971
- - Compiler:
972
- + Option `moduleLookupDirectories: [ 'strings' ]` can be used to specify additional module lookup
973
- directories, similar to `node_modules/`.
974
- + LIMIT and OFFSET clauses can now contain expressions, including parameter references.
975
- - to.edm(x):
976
- + Detect spec violation `scale` > `precision`.
977
- - to.sql/for.odata:
978
- + With the new option `fewerLocalizedViews: true|false`, an entity/view will not get a localized convenience
979
- view, if it only has associations to localized entities/views. Only if there is actually a localized
980
- element (e.g. new localized element or reference to one), will it get a convenience view.
981
- - to.sql
982
- + In a localized scenario, create foreign key constraints for the generated `.texts` entities.
983
- + Casting `null` to a structure such as `null as field : StructT` is now supported. For each leaf element,
984
- an additional `null as field_name` column is added.
985
-
986
- ### Changed
987
-
988
- - Compiler:
989
- + Selecting fields of structures or associations (without filters) are now candidates for ON-condition
990
- rewrites: It is no longer necessary to select the struct/association directly.
991
- + Consistently handle the case when type elements are defined to be a `key`:
992
- the `key` property is not only preserved with `includes`, but also in other cases.
993
- Use option `deprecated.noKeyPropagationWithExpansions` to switch to the v3 behavior.
994
- + When including aspects or entities into structured type definitions,
995
- do not add actions to the type.
996
- + An `annotate` statement in the `extensions` section of a CSN now consistently uses the
997
- `elements` property even if the `annotate` is intended to be used for an enum symbol.
998
- Before v4.2, the compiler has used the `enum` property in a CSN of flavor `xtended`
999
- (`gensrc`) if it was certain that it was to be applied to an enum symbol.
1000
- - to.cdl: If a definition has an `actions` property, an `actions {…}` block is now always rendered,
1001
- and is not ignored if empty.
1002
- - to.sql:
1003
- + For SQL dialect "sqlite", `cds.DateTime` is now rendered as `DATETIME_TEXT` instead of `TIMESTAMP_TEXT`.
1004
- + Casting a literal (except `null`) to a structure now yields a proper error.
1005
- + `.texts` entities annotated with `@cds.persistence.skip` (without their original entity having that annotation)
1006
- lead to deployment issues later. It is now an error.
1007
-
1008
- ### Fixed
1009
-
1010
- - Compiler:
1011
- + Reject invalid reference in the `on` of `join`s already while compiling,
1012
- not just when calling the (SQL) backend.
1013
- + Correct the calculation of annotation assignments on the return structure of actions
1014
- when both `annotate … with {…}` and `annotate … with returns {…}` had been used
1015
- on the same structure element. Ensure that it works when non-applied, too.
1016
- + Do not remove or invent `actions` properties with zero actions or functions in it.
1017
- + Correct auto-redirection of direct cycle associations: if the source and target of a
1018
- model association are the same entity, and the main artifact of the service association
1019
- based on the model association is a suitable auto-redirection target, then use it
1020
- as new target, independently from the value of `@cds.redirection.target`.
1021
- - to.cdl: Indirectly structured types (`type T: Struct;`) with `includes` (`extend T with T2;`), are now properly rendered.
1022
- - to.sql/hdi/hdbcds:
1023
- + Views on views with parameters did not have localized convenience views based on
1024
- other localized views (missing `localized.` prefix in FROM clause)
1025
- + Run less checks on entities marked with `@cds.persistence.exists`
1026
- + Correctly render SELECT items where the column name conflicts with a table alias
1027
- - to.sql: Casting expressions to a structured type yields a proper error instead of strange compiler error.
1028
- - to.edm(x):
1029
- + Don't expand `@mandatory` if element has an annotation with prefix `@Common.FieldControl.`.
1030
- + Fix a bug when referencing nested many structures, especially referring to a managed association via
1031
- `$self` comparison.
1032
- + Improve handling of non-collection annotation values for collection-like vocabulary types.
1033
- + Don't render `Scale: variable` for `cds.Decimal(scale:0)`.
1034
- - to.sql|hdi.migration:
1035
- + Fixed a bug that caused rendering of `ALTER` statements to abort early and not render some statements.
1036
- + CSN output now only contains real `cds` builtins, no early remapping to HANA CDS types or similar.
1037
- - to.sql.migration: Don't drop-create views marked with `@cds.persistence.exists`
1038
-
1039
- ### Removed
1040
-
1041
- ## Version 4.1.2 - 2023-07-31
1042
-
1043
- ### Fixed
1044
-
1045
- - to.hdi.migration: Changes in constraints are not rendered as part of the .hdbmigrationtable file,
1046
- as they belong in other HDI artifacts
1047
-
1048
- ## Version 4.1.0 - 2023-07-28
1049
-
1050
- ### Added
1051
-
1052
- - Calculated elements "on-read" can now reference localized elements.
1053
- - Aliases for columns inside sub-queries are now optional, also for expressions.
1054
- - for.odata/to.hdi/to.sql: Specified default value on a managed association is forwarded to a foreign key
1055
- if association has exactly one foreign key.
1056
- - CDL: Annotation-only aspects having no `elements` and `actions` can now be defined with
1057
- the CDL syntax `@Anno… aspect Name;`. They cannot be extended with elements or actions
1058
- in order to ensure that they can always be used to extend non-structures.
1059
- To allow the former but not the latter, use `@Anno… aspect Name {…};`.
1060
- - to.sql: Support session variables for h2
1061
-
1062
- ### Changed
1063
-
1064
- - api: Function `isInReservedNamespace(name)` handles name `cds` as being in a reserved namespace as well.
1065
- - `CompilationError.messages` are now sorted severity aware. Errors are listed first.
1066
- - Compiler:
1067
- + Improve the calculation of semantic code completion candidates.
1068
- + Some checks, like those for valid `on` conditions of associations,
1069
- are now already done with `compile` and not just the backends.
1070
- + SQL `cast()`s must always have a `type` property
1071
- + Type properties such as `precision` or `length` must be accompanied by a type (possibly inferred).
1072
- - for.odata/to.hdi/to.sql: No longer reject unmanaged associations as foreign keys of a managed association.
1073
- Instead, ignore such references during ON-condition rewriting and foreign key generation. Referring to
1074
- unmanaged associations is incompatible with SAP HANA CDS naming mode 'hdbcds'.
1075
- - to.sql: Rework session variables for postgres.
1076
- - Update OData vocabularies: 'Common', 'HTML5', 'PersonalData', 'UI'.
1077
-
1078
- ### Fixed
1079
-
1080
- - Compiler:
1081
- + ensure that annotations of elements in anonymous aspects of managed compositions
1082
- are not lost.
1083
- + issue error for definitions like `entity Self as projection on Base { $self.* };`
1084
- instead of simply concluding that the projection has zero elements.
1085
- + do not report a invalid cyclic dependency if associations between two entities
1086
- are valid cycles.
1087
- + Element type references can again follow associations (removed v4.0 incompatibility).
1088
- - to.sql:
1089
- + `$self` references inside a nested projection using `$self` was incorrectly resolved.
1090
- + associations to entities marked with `@cds.persistence.skip` were not properly
1091
- checked inside nested projections.
1092
- + Select items casting `null` to an arrayed type work again, e.g. `null as ManyType`.
1093
- - to.sql/hdi/hdbcds: Raise a nice error message for `@sql.append` on managed associations/compositions,
1094
- as we do for structured error messages.
1095
- - to.cdl: Annotations with multiple qualifiers (`#`) are now rendered correctly.
1096
- - to.edm(x): Revert change introduced with [3.9.0](#version-390---2023-04-20)
1097
- "Correct referential constraint calculation for `[0..1]` backlink associations".
1098
- - for.odata: Process shortcut annotations sequence independent.
1099
- - to.sql.migration:
1100
- + Respect unique and referential constraints for delta calculation.
1101
- + Added a configurable error for primary key additions, as those will lead to errors if the table
1102
- contains data. This could lead to inconsistent states if
1103
- some deployments succeed and others fail, so by default it is an error.
1104
-
1105
- ### Removed
1106
-
1107
- - Compiler:
1108
- + forbid wildcards in projection extensions: `extend … with columns { * )`.
1109
- + forbid column references such as `$user.*`, `$user.{id}` and `$user {id}`.
1110
-
1111
- ## Version 4.0.2 - 2023-06-22
1112
-
1113
- ### Fixed
1114
-
1115
- - to.sql.migration: When drop-creating views, also drop-create (transitively) dependent views.
1116
- - to.edm(x):
1117
- + Forward `@odata.singleton { nullable }` annotation to parameter entity.
1118
- + Annotations assigned to a parameterized entity are propagated to the parameter entity if the annotation is
1119
- applicable to either an `edm.EntitySet` or `edm.Singleton`. This especially covers all `@Capabilities` and their
1120
- shortcut forms like `@readonly` and `@insertonly`. The original annotation is not removed from the original entity.
1121
- Annotations that should be rendered at the parameter `edm.EntityType` can be qualified with `$parameters`.
1122
- Explicitly qualified annotations are removed from the original entity allowing individual assignments.
1123
-
1124
-
1125
- ## Version 4.0.0 - 2023-06-06
1126
-
1127
- ### Added
1128
-
1129
- - Calculated elements "on-write" are now supported, e.g. `elem = field + 1 stored;` will be rendered in SQL
1130
- as `GENERATED ALWAYS AS`.
1131
- - compiler:
1132
- + `returns` of actions and functions can now be annotated, e.g.
1133
-
1134
- ```cds
1135
- action A() returns @direct { … };
1136
- annotate A with returns {
1137
- @anno val;
1138
- }
1139
- ```
1140
- + It is now possible to use `*/` inside doc comments by escaping it `*\/`. Only this exact string can be escaped.
1141
- + Functions `parse.expr` and `parse.cql` now support `group by`, `having`, `order by`, `limit`, and `offset` in infix filters.
1142
- + In expressions, you can now use function names after the `new` keyword which do
1143
- not start with `st_`, if the name is followed by an open parenthesis.
1144
-
1145
- ### Changed
1146
-
1147
- - API:
1148
- + `messageContext()` is now deprecated; use `messageStringMultiline()` instead with `config.sourceMap`.
1149
- + `messageString(err, config)` has a new signature; the old one is still supported for backward compatibility.
1150
- + Option `docComment: false` now removes doc comments during compilation even for CSN.
1151
- If this option is not defined, doc comments are checked, but not put into CSN.
1152
- - compiler:
1153
- + CSN: Specified elements of queries are now resolved and checked (previously ignored except for annotations).
1154
- Type properties (`length`, …) and some element properties are now taken from the specified elements
1155
- instead of relying only on the elements inferred by the compiler.
1156
- + CSN: Compiler accepts CSN input with CSN version `0.1.0` (produced by cds-compiler version 1.10.0 and older)
1157
- only if the version attribute is properly set, i.e. `"version": {"csn": "0.1.0"}`.
1158
- + CSN: Type properties (`length`, `precision`, `scale`, and `srid`) next to `elements` or `items` in CSN input
1159
- is now an error. Previously ignored.
1160
- + An extension of the form `extend Def with { name = 42 };` is now represented in parsed CSN as
1161
- adding a calculated element.
1162
- + `having` as the first word in an infix filter is now interpreted as keyword. Write `![having]`
1163
- to have it parsed as identifier.
1164
- + If a definition overrides elements of an included definition, it is sorted according
1165
- to the included definition's element order. This is similar to how `*` works in projections.
1166
- It is no longer possible to overwrite a scalar element with a structure and vice versa.
1167
- + Two included definitions cannot have the same element. The including entity must override the element.
1168
- + If a type with properties precision and scale is extended, the `extend` statement must extend both properties.
1169
- + `annotate E:elem with actions {};` is now a parser error and no longer a compiler error.
1170
- Only relevant if you use `parseCdl`-style CSN.
1171
- + Annotations (and other properties) are now propagated to `returns` as well, if the returned artifact
1172
- is a non-entity, e.g. a type.
1173
- + `annotate E with returns {…}` is now only applied to actions/functions. Previous compiler versions
1174
- autocorrected the `annotate` statements to apply them to an entity's elements.
1175
- + Calculated elements can't refer to localized elements.
1176
- + Table aliases can't be used in `extend Query with columns {…}` any longer. Use direct element references instead.
1177
- + Table alias and mixin names can no longer start with `$`. Choose a different name. With this change
1178
- we avoid unexpected name resolution effects in combination with built-in `$`-variables.
1179
- + A semicolon is now required after a type definition like `type T : many {} null`.
1180
- + Message ID `duplicate-autoexposed` was changed to `def-duplicate-autoexposed`.
1181
- + Bare `$projection` are rejected. Use `$self` instead.
1182
- - Update OData vocabularies 'Common', 'UI'.
1183
- - to.sql:
1184
- + Change default `length` for `cds.String` for all SQL dialects except `hana` to 255.
1185
- + for the sql dialect `postgres`, the `ON DELETE RESTRICT` / `ON UPDATE RESTRICT` rules
1186
- are omitted from the referential constraint definitions.
1187
- - to.cdl:
1188
- + If associations are used inside `items`, an error is emitted instead of rendering invalid CDL.
1189
- + `items` inside `items`, where the outer one does not have a `type`, is now always an error,
1190
- because it can't be rendered in CDL
1191
-
1192
- ### Fixed
1193
-
1194
- - compiler:
1195
- + `parseCdl` CSN did not include correct `...` entries for annotations containing `... up to`
1196
- + Type references inside calculated elements were not always correctly resolved.
1197
- + `USING` empty files were incorrectly marked as "not found".
1198
- + Correct the handling of `$self` references in nested projections and filters in queries.
1199
- + If an association was inside `items`, e.g. via type chains, the compiler crashes instead of emitting proper errors.
1200
- + References in the user-provided `on` conditions of associations with a to be
1201
- auto-redirected model entity as target were not always resolved correctly.
1202
- Complain in error situations.
1203
- + Make extend code robust against prototype-polluted JS classes.
1204
- - Localized convenience views for projections (not views) did not have references rewritten.
1205
- This only affects CSN, the SQL result was correct.
1206
- - Calculated elements in composition-of-aspect lost their `value` when generating composition targets.
1207
- - to.sql/to.hdi/for.odata: Foreign keys in ON-conditions were not always properly checked and flattened if explicit
1208
- `keys` were provided that reference structures.
1209
- - Extending bound actions with elements is not possible, but was not reported by the compiler and elements were silently lost.
1210
- - for.odata:
1211
- + Don't propagate `@odata { Type, MaxLength, Precision, Scale }` from structured to flattened leaf elements.
1212
- + Remove `type: null` attribute from element definitions referencing an undefined type via `type of`.
1213
- - to.edm(x):
1214
- + Don't reject untyped properties that are API typed with a valid `@odata.Type` annotation.
1215
- + Render correct `EntitySetPath` and annotation target path for actions/functions with explicit binding parameter.
1216
- - to.cdl: ParseCdl-style CSN containing annotations with `...` were not properly rendered.
1217
-
1218
- ### Removed
1219
-
1220
- - NodeJs 14 is no longer supported.
1221
- - `CompileMessage` no longer has property `location`, which was deprecated in v2.1.0, but `$location`,
1222
- which is supported since v2.1.0
1223
- - compiler:
1224
- + It is no longer possible to write `type of $self.‹elem›` to refer to the element `‹Def›.‹elem›`
1225
- where `‹Def›` is the main artifact where the type expression is embedded in. Replace by `type of <Def>:‹elem›`.
1226
- + Element type references can no longer follow associations, i.e. `E:assoc.id` is not allowed
1227
- (v4.0 only, re-introduced with v4.1).
1228
- + "Smart type references" such as `Entity.myElement` instead of `Entity:myElement`
1229
- are removed, because since - `Entity.myElement` could also be a definition,
1230
- creating ambiguities. This did not work always, anyway.
1231
-
1232
- ## Version 3.9.12 - 2023-12-06
1233
-
1234
- ### Fixed
1235
-
1236
- - compiler:
1237
- + SQL function `STDDEV(*)` was not parsable.
1238
- + Numbers in scientific notation `-1e1` were sometimes not recognized via CSN input.
1239
- - for.odata: Fix crash when using a projection with associations as action parameter type.
1240
- - for.hana: Fix a bug in association to join translation, expect ON condition operand to be a function without arguments.
1241
- - to.edm(x):
1242
- + Omit `EntitySet` attribute on `Edm.FunctionImport` and `Edm.ActionImport` that return a singleton.
1243
- + Don't render `Scale: variable` for `cds.Decimal(scale:0)`.
1244
- - to.sql/hdi/hdbcds: consider `having` predicate for `exists` expansion
1245
-
1246
- ## Version 3.9.10 - 2023-08-25
1247
-
1248
- ### Fixed
1249
-
1250
- - to.edm(x): Error reporting for incorrect handling of "Collection()" has been improved.
1251
- - to.sql/hdi/hdbcds: Views on views with parameters did not have localized convenience views based on
1252
- other localized views (missing `localized.` prefix in FROM clause)
1253
- - to.sql: Casting expressions to a structured type yields a proper error instead of strange compiler error.
1254
- - to.sql.migration: Don't drop-create views marked with `@cds.persistence.exists` or `@cds.persistence.skip`
1255
-
1256
- ## Version 3.9.8 - 2023-08-03
1257
-
1258
- ### Fixed
1259
-
1260
- - to.edm(x):
1261
- + Don't expand `@mandatory` if element has an annotation with prefix `@Common.FieldControl.`.
1262
- + Fix a bug when referencing nested many structures, especially referring to a managed association via
1263
- `$self` comparison.
1264
- - to.sql/hdi/hdbcds: Detect navigation into arrayed structures and raise helpful errors instead of running into internal errors.
1265
-
1266
- ## Version 3.9.6 - 2023-07-27
1267
-
1268
- ### Fixed
1269
-
1270
- - to.edm(x): Revert change introduced with [3.9.0](#version-390---2023-04-20)
1271
- "Correct referential constraint calculation for `[0..1]` backlink associations".
1272
- - for.odata: Process shortcut annotations sequence independent.
1273
-
1274
- ## Version 3.9.4 - 2023-06-07
1275
-
1276
- ### Fixed
1277
-
1278
- - compiler: `USING` empty files were incorrectly marked as "not found".
1279
- - Localized convenience views for projections (not views) did not have references rewritten.
1280
- This only affects CSN, the SQL result was correct.
1281
- - to.edm(x): Render correct EntitySetPath and annotation target path for actions/functions
1282
- with explicit binding parameter.
1283
-
1284
- ## Version 3.9.2 - 2023-04-27
1285
-
1286
- ### Fixed
1287
-
1288
- - Fix crash in core compiler which occurred when CAP was used in a node environments
1289
- where an enumerable property was added to `Array.prototype`.
1290
- - to.edm(x):
1291
- + Publicly release `@open`.
1292
- + No `DefaultValue` for `Edm.NavigationProperty`.
1293
-
1294
- ## Version 3.9.0 - 2023-04-20
1295
-
1296
- ### Added
1297
-
1298
- - Variables `$valid.from` and `$valid.to` have been added to the compiler.
1299
- They behave the same as `$at.from` and `$at.to`.
1300
- - to.edm(x):
1301
- + Add `--odata-vocabularies` to pass a dictionary `{ <prefix>: { Alias, Namespace, Uri } }`
1302
- into the EDM generation. `<prefix>` must match the value of `Alias`. Entries are ignored
1303
- if they are incomplete, malformed, redefine an official OASIS/SAP vocabulary or match the name
1304
- of the current service. Annotations of the form `@<prefix>.<annotation>` are added to the API
1305
- without evaluation including an `edm:Reference`. It is in the users responsibility to provide
1306
- a URI that a client can resolve against a valid vocabulary document.
1307
- + Support annotation `@open` on entity and structured type level to declare the corresponding
1308
- entity/complex type to be `OpenType=true`. If an open structured type is declared closed
1309
- (with a falsy annotation value), the corresponding EDM type is closed as well and suffixed
1310
- with `_closed` (or `_open` vice versa).
1311
- No further checks are performed on possibly open foreign or primary key types nor on eventually
1312
- bucket elements to store the additional data.
1313
-
1314
- ### Changed
1315
-
1316
- - compiler: Parameter references in filters such as `assoc[field < :Param]` are now allowed.
1317
- - In the compiled CSN, sort the non-enumerable `$sources` property
1318
- according to the reversed layered extension order.
1319
- - Update OData vocabulary 'Common', 'ODM', 'UI'.
1320
- - to.cdl: If an identifier contains illegal characters (e.g. newline), we no longer produces
1321
- invalid CDL, but emit an error instead.
1322
-
1323
- ### Fixed
1324
-
1325
- - to.edm(x):
1326
- + Fix spec requirement: "Navigation properties of complex types MUST NOT specify a partner".
1327
- + Set default target cardinality for unspecified `composition of {}` to `[0..1]`.
1328
- + Correct referential constraint calculation for `[0..1]` backlink associations.
1329
- - for.hana/for.odata: Reject final unmanaged assoc path step in ON Condition if preceded with `$self`.
1330
- - to.cdl: Parentheses around expressions containing conditions were sometimes missing.
1331
- - to.sql/hdi/hdbcds:
1332
- + Detect and process calculated elements in functions like `upper`.
1333
- + Better detection of calculated elements in `.expand`/`.inline`.
1334
- + Entities with calculated elements sometimes had incorrect types. This happened, for example,
1335
- if they were marked with `@odata.draft.enabled`
1336
-
1337
- ## Version 3.8.2 - 2023-03-30
1338
-
1339
- ### Fixed
1340
-
1341
- - parser: Identifiers that are keywords were not allowed in annotation values inside arrays
1342
- - compiler: Compatibility against cds-lsp was restored.
1343
- - to.sql/hdbcds/hdi/edm(x): Fix a crash for sub-queries inside nested expressions of on-conditions of JOINs.
1344
-
1345
- ## Version 3.8.0 - 2023-03-27
1346
-
1347
- ### Added
1348
-
1349
- - compiler:
1350
- + Table aliases for sub-queries are no longer required.
1351
- + A time zone designator can now be used in time literals, e.g. `time'16:41:01+01:30'`or `time'16:41:01Z'`.
1352
- - Calculated elements ("on-read") are now enabled per default.
1353
- When used in views, they are replaced by their value, for example:
1354
- ```cds
1355
- entity E { one: Integer; two = one + 1; };
1356
- entity P as projection on E { two };
1357
- // P is the same as:
1358
- entity P as projection on E { one + 1 as two };
1359
- ```
1360
- This allows to define calculations centrally at the entity, which can be used by
1361
- other views.
1362
- - In CDL, a ternary operator was added as a shortcut for `CASE` expressions:
1363
- `a ? b : c` is a shortcut for `CASE WHEN a THEN b ELSE c END`. There is no CSN
1364
- representation. The ternary operator is rendered as a `CASE` expression in CSN.
1365
- - In CDL and CSN, `not null` can now also be used in type definitions.
1366
- - In CDL (and CSN as before), elements can be defined without specifying a type.
1367
-
1368
- ### Changed
1369
-
1370
- - API: We now report an error for most backends, if the input CSN has
1371
- `meta.flavor == 'xtended'`, because only client/inferred CSN is supported.
1372
- - Update OData vocabularies 'PersonalData', 'UI'
1373
- - for.odata: Shortcut annotations `@label`, `@title`, `@description`, `@readonly` are no longer
1374
- removed from the OData processed CSN.
1375
- - to.cdl:
1376
- + Annotation arrays are split into multiple lines, if a single line would be too long.
1377
- + Nested `SELECT`s are put into separate lines to make them more readable.
1378
- + (Annotation) paths are quoted less often.
1379
- - to.sql: The list of reserved SAP HANA identifiers was updated (for smart quoting).
1380
-
1381
- ### Fixed
1382
-
1383
- - The CSN parser now accepts bare `list`s in `columns[]`, similar to the CDL parser.
1384
- - to.cdl:
1385
- + Delimited identifiers in filters are now surrounded by spaces if necessary, to avoid `]]`
1386
- being interpreted as an escaped bracket.
1387
- - to.edm(x):
1388
- + Remove empty `Edm.EntityContainer` again. Removal of an empty entity container has been
1389
- revoked with [3.5.0](#fixed-7) which was wrong. An empty container must not be rendered
1390
- as it is not spec compliant.
1391
- + Correctly resolve chained enum symbols.
1392
- + Fix a program abort during structured rendering in combination with `--odata-foreign-keys`
1393
- and foreign keys in structured types.
1394
- + Correctly render paths to nested foreign keys as primary key in structured mode with
1395
- `--odata-foreign-keys`.
1396
- - to.hdi/to.sql/to.edm(x):
1397
- + Reject unmanaged associations as ON-condition path end points.
1398
- + Fix bug in message rendering for tuple expansion.
1399
- + Correctly detect invalid @sql.append/prepend in projections.
1400
- - to.hdi/to.sql: The list of SAP HANA keywords was updated to the latest version.
1401
-
1402
- ### Removed
1403
-
1404
- - for.odata: Undocumented shortcut annotation `@important` has been removed.
1405
-
1406
-
1407
- ## Version 3.7.2 - 2023-02-24
1408
-
1409
- ### Fixed
1410
-
1411
- - CSN parser: Structured annotations containing `=` were accidentally interpreted as expressions,
1412
- even though the corresponding beta flag was not set.
1413
-
1414
-
1415
- ## Version 3.7.0 - 2023-02-22
1416
-
1417
- ### Added
1418
-
1419
- - Several `annotate` statement can append/prepend values
1420
- to the same array-valued annotation without an `anno-duplicate` error,
1421
- even if there is no `using from` dependency between the involved sources
1422
- - SQL methods such as `point.ST_X()` can be used in views.
1423
- - The SQL `new` keyword can be used for `ST_*` types such as `new ST_POINT('Point(0.5 0.5)') )`
1424
-
1425
- ### Changed
1426
-
1427
- - Update OData vocabularies 'Common', 'Core', 'Measures', 'PDF', 'UI'.
1428
- - to.edm(x): Empty complex types are no longer warned about as they are allowed.
1429
-
1430
- ### Fixed
1431
-
1432
- - `parse.cql` and `parse.expr` no longer ignore type arguments such as `cast(field as String(12))`.
1433
- One argument is interpreted as `length` and two are interpreted as `precision` and `scale`, similar to
1434
- how custom types and their arguments are interpreted.
1435
- - Previously, the compiler could not always find a unique redirection target if there were
1436
- one direct projection on the model target and two or more projections on that projection.
1437
- - The performance of compiler-checks for deeply nested expressions/queries has been improved
1438
- - Fix various bugs in Association to Join translation:
1439
- + Recursive `$self` dereferencing
1440
- + Correct resolution of table alias in non-bijective `$self` backlink associations in combination with
1441
- explicit redirection.
1442
- - to.edm(x): Process value help list convenience annotations on unbound action parameters.
1443
-
1444
-
1445
- ## Version 3.6.2 - 2023-02-06
1446
-
1447
- ### Fixed
1448
-
1449
- - to.hdi(.migration): Don't render `-- generated by cds-compiler version` comment at the top of the HDI-based
1450
- artifacts, as this caused HDI to detect the file as `changed`
1451
- and redeploy, causing way longer deployment times. Old behavior can be enabled with option `generatedByComment: true`.
1452
- - to.sql/hdi/hdbcds: Correctly handle variables like `$user` in `exists` filters.
1453
-
1454
- ## Version 3.6.0 - 2023-01-25
1455
-
1456
- ### Added
1457
-
1458
- - API: There are new API functions for `to.cdl`: `smartId`, `smartFunctionId` and `delimitedId`.
1459
- - CDL parser: when defining a parameter for entities, actions or functions,
1460
- you can use a regular identifier for its name even if that is a reserved name like `in`.
1461
- - The first parameter of a bound action or function can be typed with `$self` or `many $self`
1462
- even if no type named `$self` exists.
1463
- - If an aspect `sap.common.TextsAspect` exists in the `sap.common` context, it will be included
1464
- in all `.texts` entities. This allows to extend `.texts` entities via extending the aspect.
1465
- Example:
1466
- ```cds
1467
- entity E {
1468
- key id : Integer;
1469
- content: localized String;
1470
- }
1471
- extend sap.common.TextsAspect with {
1472
- elem: String;
1473
- };
1474
- // from @sap/cds common.cds
1475
- aspect sap.common.TextsAspect {
1476
- key locale: String;
1477
- }
1478
- ```
1479
- - to.edm(x): Support explicit binding parameter `<id>: [many] $self` for OData V4 only.
1480
- The explicit binding parameter is rendered as any other parameter and `$self` is replaced with
1481
- the binding type but only if no `$self` definition exists in the model. This gives full control
1482
- over the binding parameter including name, nullability, default value and annotations.
1483
- The explicit binding parameter is ignored for OData V2 and has precedence over `@cds.odata.bindingparameter`.
1484
-
1485
- ### Changed
1486
-
1487
- - Many messages concerning the CDL and CSN syntax are improved:
1488
- affects message ids (`syntax-…`), message texts and the error locations.
1489
- - Duplicate doc-comments are now errors, similar to duplicate annotations.
1490
- - Update OData vocabularies 'Aggregation', 'Analytics', 'Capabilities','Common', 'ODM', 'Offline',
1491
- 'PDF', 'Session', 'UI'.
1492
-
1493
- ### Fixed
1494
-
1495
- - If an entity with parameters is auto-exposed, the generated projection now has
1496
- the same formal parameters and its query forwards these parameters to the origin entity.
1497
- - to.hdbcds: Aliases for foreign `keys` were not quoted if necessary.
1498
- - to.cdl:
1499
- + Aliases for `expand` and foreign `keys` were not quoted if necessary.
1500
- + Query functions that are CDL keywords were not properly quoted.
1501
- + CSN `doc` properties containing `*/` resulted in invalid CDL.
1502
- To avoid compilation issues, `*/` is escaped as `*\/`.
1503
- - to.edm(x): Respect record type hint `$Type` in EDM JSON as full qualified `@type` URI property.
1504
-
1505
- ## Version 3.5.4 - 2023-01-10
1506
-
1507
- ### Fixed
1508
-
1509
- - Allow window functions also with a deprecated flag being set.
1510
- - to.edm(x): Fix program abort due to malformed error location in EDM annotation preprocessing.
1511
- - to.sql/hdi/hdbcds: The option `pre2134ReferentialConstraintNames` can be used to omit the referential
1512
- constraint identifier prefix `c__`.
1513
-
1514
- ## Version 3.5.2 - 2022-12-20
1515
-
1516
- ### Fixed
1517
-
1518
- - to.sql/hdi/hdbcds: Don't process references in actions, as they have no impact on the database - avoids internal errors.
1519
-
1520
- ## Version 3.5.0 - 2022-12-07
1521
-
1522
- ### Added
1523
-
1524
- - grammar: `localized` is now allowed in select items as well, to force the creation of convenience views.
1525
- - to.edm(x):
1526
- + Validate annotation values of OASIS/SAP vocabulary term definitions against `@Validation.AllowedValues`.
1527
- + Reveal dangling type references in produced EDM.
1528
- + `@Capabilities` 'pull up' introduced with [3.3.0](#version-330---2022-09-29) must now be switched
1529
- on with option `odataCapabilitiesPullup`.
1530
- - If option `addTextsLanguageAssoc` is set but ignored by the compiler, an info message is emitted.
1531
- This can happen if, e.g., the `sap.common.Languages` entity is missing.
1532
- - Add OData vocabularies 'Offline' and 'PDF'.
1533
-
1534
- ### Changed
1535
-
1536
- - to.edm(x):
1537
- + Vocabulary references to `Common` and `Core` are added to the generated EDM by default to allow
1538
- usage of these vocabularies in http messages even if the terms are not being used in the EDM itself.
1539
- + API representation of enum types as `@Validation.AllowedValues` has been shifted from `for.odata` to
1540
- `to.edm(x)`. This allows to reuse imported enum types in new APIs.
1541
- + Messages raised from the EDM annotation renderer have been reworked with message id and enhanced message
1542
- position including the annotation under investigation.
1543
- + `@Validation.AllowedValues` annotation as introduced for enum elements with v1.44.2
1544
- are now always rendered into the API regardless of `@assert.range`.
1545
- - to.cdl: The input CSN is no longer cloned for client-CSN and parseCdl-CSN,
1546
- as the renderer does not modify it.
1547
- - A new warning is emitted if compositions of anonymous aspects are used with the `Association`
1548
- keyword instead of `Composition`. Replace the former with the latter to fix the warning.
1549
- - The previous info messages about annotating undefined artifacts (e.g. `anno-undefined-art`)
1550
- are now warnings.
1551
-
1552
- ### Removed
1553
-
1554
- - to.edm(x): 'Empty Schema' warning has been removed.
1555
-
1556
- ### Fixed
1557
-
1558
- - Enums with a structured base type were accidentally not warned about if used in annotation definitions.
1559
- - for.odata/for.hana: Instead of parenthesising tuple expansion with `()`, put
1560
- newly created expression in a `xpr` expression, if the term has more than one expansion.
1561
- - Annotation on indirect or inferred enum values were sometimes lost
1562
- - to.cdl:
1563
- + Certain keywords of special functions no longer add superfluous parentheses.
1564
- + Extension rendering now supports type extensions as well as `key` for elements.
1565
- + Builtins that clashed names with implicit contexts were not rendered with `cds.` prefix.
1566
- + Unknown artifacts (as can happen in parseCdl-style CSN) are now rendered as `USING` statements.
1567
- + Type extensions in `csn.extensions` (e.g. for `length`) are now rendered.
1568
- - to.edm(x):
1569
- + Fix a bug in type exposure when using `@cds.external` complex types.
1570
- + Don't remove empty `Edm.EntityContainer`.
1571
- + Aspects with actions outside of services are no longer warned about.
1572
- - for.hana: Fix a foreign key replacement bug during association to join translation.
1573
-
1574
- ## Version 3.4.4 - 2022-11-25
1575
-
1576
- ### Fixed
1577
-
1578
- - compiler: CSN flavor `gensrc` (known as `xtended` in `@sap/cds`) lost annotations
1579
- on enum values and projection columns.
1580
-
1581
- ## Version 3.4.2 - 2022-11-11
1582
-
1583
- ### Fixed
1584
-
1585
- - Don't propagate `@cds.external` (The CDS Importer adds `@cds.external` for all
1586
- imported definitions beginning with cds-dk@6.3.0, see CAP release log).
1587
- - for.odata: Ignore all `@cds.external` definitions.
1588
- - to.sql: For sql dialect `h2`, don't turn a Decimal with length 0 into a Decfloat.
1589
- - Extending a projection with an aspect could result in incorrect auto-redirection.
1590
- - Annotations of aspects were not properly propagated to projections under some order-specific circumstances.
1591
-
1592
- ## Version 3.4.0 - 2022-10-26
1593
-
1594
- ### Added
1595
-
1596
- - to.sql: Add support for sql dialect `h2`, which renders SQL for H2 2.x.
1597
- - Projections can now be extended by annotation-only aspects, e.g. `extend P with MyAspect;`.
1598
-
1599
- ### Fixed
1600
-
1601
- - Properly report an error for bare `$self` references,
1602
- except in the `on` condition of unmanaged associations.
1603
- - Do not dump with references to CDS variables like `$now` in `expand`/`inline`.
1604
- - Properly report an error when trying to `cast` a column to an association.
1605
- - to.cdl: Identifiers that are always keywords in special functions are now escaped.
1606
- - to.edm(x):
1607
- + Nested annotation was not applied if outer annotation has value zero.
1608
- + Fix `AppliesTo=ComplexType, TypeDefinition` term definition directive.
1609
- - to.sql/hdi/hdbcds:
1610
- + Properly report an error for `exists` with `$self.managed-association`
1611
- + For sql dialect `hana`, add an implicit alias when using `:param` in the select list
1612
- + Handle `$self` and magic variables during expansion of nested projections
1613
-
1614
- ## Version 3.3.2 - 2022-09-30
1615
-
1616
- ### Fixed
1617
-
1618
- - to.edm(x): Set `Scale` (V4) or `@sap:variable-scale` (V2) attributes correctly when overwriting `cds.Decimal`
1619
- with `@odata.Scale`.
1620
- - to.sql: For dialect `postgres`, add braces around `$now`, `$at.from` and `$at.to`.
1621
-
1622
- ## Version 3.3.0 - 2022-09-29
1623
-
1624
- ### Added
1625
-
1626
- - Nested projections can be used without `beta` option:
1627
- + Support `expand`: columns can look like `assoc_or_struct_or_tabalias { col_expression1, … }`,
1628
- `longer.ref as name { *, … } excluding { … }`, `{ col_expression1 as sub1, … } as name`, etc.
1629
- + Support `inline`: columns can look like `assoc_or_struct_or_tabalias.{ col_expression1, … }`,
1630
- `longer.ref[filter = condition].{ *, … } excluding { … }`, `assoc_or_struct_or_tabalias.*`, etc.
1631
- - to.sql/hdi/hdbcds/edm(x)/for.odata: Allow to structure comparison against `is [not] null`.
1632
- - to.sql: Support dialect `postgres` - generates SQL intended for PostgreSQL. Not supported are `cds.hana` data types and views with parameters.
1633
-
1634
- ### Changed
1635
-
1636
- - A valid redirection target does not depend on parameters anymore. This
1637
- change could induce a redirection error, which could easily solved by assigning
1638
- `@cds.redirection.target: false` to the entity with “non-matching” parameters.
1639
- - Properly issue an error when projecting associations with parameter
1640
- references in the `on` condition. Before this change, the compiler dumped
1641
- when projecting such an association in a view on top.
1642
- - Update OData vocabularies 'Capabilities', 'Common', 'UI'.
1643
- - to.cdl:
1644
- + Extensions are now always put into property `model` of `to.cdl()`s result.
1645
- + Actions on views and projections are now rendered as part of the definition, instead of an extension.
1646
- - to.edm(x): `@Capabilities` 'pull up' supports all counterpart properties of `@Capabilities.NavigationPropertyRestriction`
1647
- except for properties `NavigationProperty` and `Navigability`.
1648
- - to.hdi: Updated list of `keywords` which must be quoted in naming mode `plain`.
1649
- - to.sql/hdi/hdbcds/edm(x)/for.odata: Reject structure comparison with operators `<,>,<=,>=`. Message id `expr-unexpected-operator`
1650
- is downgradable to a warning.
1651
-
1652
- ### Fixed
1653
-
1654
- - Do not issue a warning anymore when adding elements via multiple `extend` statements in the same file.
1655
- - An info message for annotating builtins through `extend` statements is now reported, similar to `annotate`.
1656
- - Fix auto-redirection for target of new assoc in query entity
1657
- - for.odata: `@readonly/insertonly/mandatory: false` are not expanded.
1658
-
1659
- ## Version 3.2.0 - 2022-08-30
1660
-
1661
- ### Added
1662
-
1663
- - New Integer types with these mappings:
1664
-
1665
- | CDS | OData | SQL | HANA CDS |
1666
- | --------- | --------- | -------- | ------------- |
1667
- | cds.UInt8 | Edm.Byte | TINYINT | hana.TINYINT |
1668
- | cds.Int16 | Edm.Int16 | SMALLINT | hana.SMALLINT |
1669
- | cds.Int32 | Edm.Int32 | INTEGER | cds.Integer |
1670
- | cds.Int64 | Edm.Int64 | BIGINT | cds.Integer64 |
1671
-
1672
- - Properties of type definitions and types of direct elements can now be extended,
1673
- e.g. `extend T with (length: 10);`
1674
-
1675
- - CDL parser: support SQL function `substr_regexpr` with its special argument syntax.
1676
-
1677
- ### Fixed
1678
-
1679
- - An internal dump could have occurred in certain situations
1680
- for models with cyclic type definitions.
1681
- - Annotations on inferred enum elements of views were lost during recompilation.
1682
- - to.cdl: Annotations on enum value in query elements were lost.
1683
- - for.odata: Allow dynamic shortcut annotation values (`$edmJson`).
1684
- - to.edm(x):
1685
- + Don't overwrite annotations of input model.
1686
- + Ignore `null` values in `$edmJson` strings.
1687
- - to.hdi.migration: Don't interpret bound action changes as element changes.
1688
-
1689
- ## Version 3.1.2 - 2022-08-19
1690
-
1691
- ### Fixed
1692
-
1693
- - to.edm(x):
1694
- + `@Capabilities` 'pull up' for containment trees should not prefix the
1695
- dynamic annotation paths of the root container.
1696
- + Remove service namespace prefix of a parameter type for function/action annotation targets
1697
- in multi schema mode if the parameter type is defined in an alternative schema.
1698
-
1699
- ## Version 3.1.0 - 2022-08-04
1700
-
1701
- ### Added
1702
-
1703
- - Extending an artifact with multiple includes in one extend statement is now possible:
1704
- `extend SomeEntity with FirstInclude, SecondInclude;`
1705
- - Aspects can now have actions and functions, similar to entities. Aspects can be extended by actions as well.
1706
- - `cdsc`:
1707
- + `toCsn` now supports `--with-locations` which adds a `$location` property to artifacts
1708
- + `toHana`/`toSql` now supports `--disable-hana-comments`, which disables rendering of doc-comments for HANA.
1709
- - to.hdi/sql/hdbcds: Support FK-access in `ORDER BY` and `GROUP BY`
1710
- - to.hdi.migration: Detect an implicit change from `not null` to `null` and render corresponding `ALTER`
1711
-
1712
- ### Changed
1713
-
1714
- - compiler: If an unknown file extension is used but the file starts with
1715
- an opening curly brace (`{`), it will be parsed as CSN.
1716
- - to.edm(x): In V4 containment mode, pull up `@Capabilities` annotations from the containees to the root container (set)
1717
- and translate them into corresponding `@Capabilities.NavigationRestrictions`. If a `NavigationRestriction` is already available
1718
- for that containment path, capabilities are merged into this path. Capability annotation value paths are prefixed with
1719
- the navigation restriction path.
1720
- The capability 'pull up' has an effect on entity annotations only. `@Capabilities` assignments on compositions are not pulled
1721
- up but rendered to the association type which is important to enable dynamic capabilities on 'to-many' relations and to avoid
1722
- ambiguities in entity set capabilities.
1723
- - Update OData vocabularies 'Analytics', 'Capabilities', 'Common', 'Core', 'DataIntegration', 'Graph', 'PersonalData', 'UI', 'Validation'.
1724
-
1725
- ### Fixed
1726
-
1727
- - Syntax of date/time literals are now checked against ISO 8601. If the format is invalid, a warning is emitted.
1728
- - The code completion directly after the `(` for functions with special syntax
1729
- now suggests all valid keywords, like for `extract` or `locate_regexpr`.
1730
- - compiler:
1731
- + `cast(elem as EnumType)` crashed the compiler.
1732
- + Annotations on sub-elements in query entities were lost during re-compilation.
1733
- + An association's cardinality was lost for new associations published in projections.
1734
- + Annotations on indirect action parameters were lost in CSN flavor `gensrc`.
1735
- + Re-allow `annotate` statements referring to the same element twice,
1736
- even if there are annotation assignments for sub elements.
1737
- + If a file's content starts with `{` and if neither file extension is known nor
1738
- `fallbackParser` is set, assume the source is CSN.
1739
- - all backends: references in `order by` _expressions_ are correctly resolved.
1740
- - to.edm(x):
1741
- + Allow cross service references for unmanaged associations and improve warning message for muted associations.
1742
- + Nested `@UI.TextArrangement` has precedence over `@TextArrangement` shortcut annotation for `@Common.Text`.
1743
- - to.hdi.migration:
1744
- + Doc comments rendered the _full doc comment_ instead of only the first paragraph, as `to.hdi` does.
1745
- + Respect option `disableHanaComments` when rendering the `ALTER` statements
1746
- - to.hdi/sql/hdbcds:
1747
- + Check for invalid usages of `$self` and give helpful errors
1748
- + Correctly resolve association-steps in the from-clause in conjunction with `exists`
1749
-
1750
- ## Version 3.0.2 - 2022-07-05
1751
-
1752
- ### Fixed
1753
-
1754
- - to.sql: For `sqlDialect` `plain`, `$now` is replaced by `CURRENT_TIMESTAMP` again.
1755
- - compiler:
1756
- + Don't crash if a USING filename is invalid on the operating system, e.g. if `\0` is used.
1757
- + Info messages for annotations on localized convenience views are only emitted for unknown ones.
1758
- + Improve error message for an `extend` statement which had added a new element
1759
- and tried to extend that element further. Similarly for a new action.
1760
- (If you consider this really of any use, use two `extend` statements.)
1761
- - for.odata: expand `@readonly`/`@insertonly` on aspects as for entities into `@Capabilities`.
1762
- - to.edm(x):
1763
- + Exclude managed association as primary key on value list annotation preprocessing.
1764
- + Don't render annotations for aspects defined in a service.
1765
-
1766
- ## Version 3.0.0 - 2022-06-23
1767
-
1768
- ### Added
1769
-
1770
- - Instead of requiring all files on startup, they are required on an as-needed basis to reduce startup times.
1771
- - CDL parser: support SQL functions `locate_regexpr`, `occurrences_regexpr`,
1772
- `replace_regexpr` and `substring_regexpr` with their special argument syntax.
1773
- - CDL parser: the names `trim` and `extract` are not reserved anymore.
1774
-
1775
- ### Changed
1776
-
1777
- - cds-compiler now requires Node 14.
1778
- - `compile()` and its derivates now use `fs.realpath.native()` instead of `fs.realpath()`.
1779
- - CDL parser:
1780
- + Multi-line doc comments without leading `*` were inconsistently trimmed.
1781
- + As before, a structure value for an annotation assignment in a CDL source is flattened,
1782
- i.e. `@Anno: { foo: 1, @bar: 2 }` becomes `@Anno.foo: 1 @Anno.@bar: 2`.
1783
- Now, the structure property name `$value` is basically ignored:
1784
- `@Anno: { $value: 1, @bar: 2 }` becomes `@Anno: 1 @Anno.@bar: 2`.
1785
- The advantage is that overwriting or appending the annotation value works as expected.
1786
- + Keywords `not null` is only valid after `many String enum {...}` and no longer after `String`.
1787
- - `@cds.persistence.skip` and `@cds.persistence.exists` are both copied to generated child artifacts
1788
- such as localized convenience views, texts entities and managed compositions.
1789
- - Update OData vocabularies 'Common', 'UI'.
1790
- - (Sub-)Elements of localized convenience views can now be annotated, e.g. `annotate localized.E:elem`.
1791
- - `getArtifactCdsPersistenceName` now enforces the `csn` argument and can optionally have the `sqlDialect` passed in.
1792
- - `getElementCdsPersistenceName` can optionally have the `sqlDialect` passed in.
1793
-
1794
- ### Removed
1795
-
1796
- - All v2 deprecated flags.
1797
- - Keyword `masked`.
1798
- - CDL parser: `*` is not parsed anymore as argument to all SQL functions;
1799
- it is now only allowed for `count`, `min`, `max`, `sum`, `avg`, `stddev`, `var`.
1800
- - All non-SNAPI options.
728
+ - beta feature `v5preview`