Skip to content
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

fix(odata): Fix <Record> example for null value #1356

Merged
merged 4 commits into from
Oct 18, 2024
Merged

Conversation

bugwelle
Copy link
Contributor

@bugwelle bugwelle commented Oct 17, 2024

Due to annotation flattening, the value null would not be rendered as <Null/> in OData EDMX. Instead, as the section before that mentions, we need to use special $edmJson syntax or the new expression syntax (null).

Tested with cds-compiler v5.3.2

Due to annotation flattening, the value `null` would _not_ be rendered
as `<Null/>` in OData EDMX.  Instead, as the section before that mentions,
we need to use special `$edmJson` syntax.
@@ -360,7 +360,7 @@ Record-like source structures are mapped to `<Record>` nodes in EDMX, with primi

```cds
@Some.Record: {
Null: null,
Null: { $edmJson: { $Null } },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is special handling of record-annotation-types, I stand corrected. However, due to annotation flattening, such entries wouldn't be propagated properly anyway.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes that's wrong especially as a couple of lines @Some.Null explains how it should be. However, all this was written before we had this:

 @UI.rec: { Null: (null) }

renders into:

 <Annotation Term="UI.rec">
          <Record>
            <PropertyValue Property="Null">
              <Null/>
            </PropertyValue>
          </Record>
        </Annotation>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, thanks for reminding me! 😄
I've updated the sections.

Copy link
Contributor

@hjboth hjboth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, you probably want to rewrite the null anno with expression syntax?

@bugwelle bugwelle requested a review from hjboth October 17, 2024 07:54
advanced/odata.md Outdated Show resolved Hide resolved
@renejeglinsky renejeglinsky merged commit c0d9a4d into main Oct 18, 2024
4 checks passed
@renejeglinsky renejeglinsky deleted the andre/null branch October 18, 2024 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants