-
Notifications
You must be signed in to change notification settings - Fork 139
@assert #2216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@assert #2216
Conversation
agoerler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please introduce in smaller steps
- one case
- multiple cases
- error function
cosider using ? :
Please add some examples for moderately more complex expressions.
Like, e.g.
- "if an order has items the order's total amount must be larger then 0"
- "a book's author's name must not be null"
Co-authored-by: Adrian Görler <[email protected]>
What exactly do you mean with We agreed with Johannes and Patrice yesterday that we will keep the expressions simple here and wait for the CXL docs. But I can check for a "moderately more complex expression". |
I think @agoerler meant that we split up this single block into 3 examples. After each example we explain the nature of the used expression. |
Yes, I have split up the examples already. But was not sure if |
patricebender
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 As Adrian stated, it would be nice to have a little more (complex) real life scenarios. I would have probably taken the well known Bookshop for showcasing the different scenarios. But that may be my personal taste.
You can use the ternary operator as syntactic sugar for the clumsy > cds.parse.xpr`1 > 2 ? true : false`
[
'case', 'when',
{ val: 1 }, '>',
{ val: 2 }, 'then',
{ val: true }, 'else',
{ val: false }, 'end'
] |
@patricebender - could you also omit the
|
That makes sense. When I tested it, compiler still required the default |
Co-authored-by: Patrice Bender <[email protected]>
I have improved the examples to use Bookshop related entities. Regarding the ternary operator, we still have to put the |
|
I would like to suggest that you introduce a few sub-sections for
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linting Errors
- guides/providing-services.md:1021:1 container type should be specified [Context: "::: "]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linting Errors
- guides/providing-services.md:1021:1 container type should be specified [Context: "::: "]
Akatuoro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 lgtm
Describes the basic feature set of the new
@assertannotation. The full blown CXN documentation is pending and will be provided by Patrice later. Once available, we will link it here. That´s why the expressions in the examples are kept simple by intention.