Skip to content

Commit

Permalink
Disambiguate constant expressions in CSDL JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoTheissen committed Sep 5, 2024
1 parent a79ab2d commit 9410bc8
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
5 changes: 3 additions & 2 deletions docs/odata-csdl-json/odata-csdl-json.html
Original file line number Diff line number Diff line change
Expand Up @@ -2763,6 +2763,7 @@ <h3 id="1422-target"><a name="Target" href="#Target">14.2.2 Target</a></h3>
<h2 id="143-constant-expression"><a name="ConstantExpression" href="#ConstantExpression">14.3 Constant Expression</a></h2>
</summary>
<p>Constant expressions allow assigning a constant value to an applied term.</p>
<p>Primitive values of various types are represented as strings so that their type cannot be inferred from the constant expression alone. If such a constant expression is an operand of a larger expression, clients MUST assume that the operand has the type demanded by the larger expression, for example in a client-side function or in a comparison with another operand of known type. (In the <code>$In</code> comparison in <a href="#disambiguate">example 75</a> if <code>Fabric</code> is a collection of <code>Edm.String</code>, the constant expression <code>"Blue"</code> is a string, not a binary value.)</p>
<details open><summary>
<h3 id="1431-binary"><a name="Binary" href="#Binary">14.3.1 Binary</a></h3>
</summary>
Expand Down Expand Up @@ -3230,7 +3231,7 @@ <h3 id="eq-ne-gt-ge-lt-le-has-and-in"><a name="Eq.21.5" href="#Eq.21.5"><code>$E
<p>They MAY contain <a href="#Annotation">annotations</a>.</p>
</div>
<div class="varjson example">
<p>Example 75:</p>
<p>Example <a name="disambiguate" href="#disambiguate">75</a>:</p>
<div class="sourceCode" id="cb83"><pre class="sourceCode json"><code class="sourceCode json"><span id="cb83-1"><a href="#cb83-1" aria-hidden="true" tabindex="-1"></a><span class="fu">{</span></span>
<span id="cb83-2"><a href="#cb83-2" aria-hidden="true" tabindex="-1"></a> <span class="dt">&quot;$And&quot;</span><span class="fu">:</span> <span class="ot">[</span></span>
<span id="cb83-3"><a href="#cb83-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">{</span></span>
Expand Down Expand Up @@ -3309,7 +3310,7 @@ <h3 id="eq-ne-gt-ge-lt-le-has-and-in"><a name="Eq.21.5" href="#Eq.21.5"><code>$E
<span id="cb83-76"><a href="#cb83-76" aria-hidden="true" tabindex="-1"></a> <span class="fu">{</span></span>
<span id="cb83-77"><a href="#cb83-77" aria-hidden="true" tabindex="-1"></a> <span class="dt">&quot;$Path&quot;</span><span class="fu">:</span> <span class="st">&quot;Fabric&quot;</span></span>
<span id="cb83-78"><a href="#cb83-78" aria-hidden="true" tabindex="-1"></a> <span class="fu">}</span><span class="ot">,</span></span>
<span id="cb83-79"><a href="#cb83-79" aria-hidden="true" tabindex="-1"></a> <span class="st">&quot;Red&quot;</span></span>
<span id="cb83-79"><a href="#cb83-79" aria-hidden="true" tabindex="-1"></a> <span class="st">&quot;Blue&quot;</span></span>
<span id="cb83-80"><a href="#cb83-80" aria-hidden="true" tabindex="-1"></a> <span class="ot">]</span></span>
<span id="cb83-81"><a href="#cb83-81" aria-hidden="true" tabindex="-1"></a><span class="fu">}</span><span class="er">,</span></span>
<span id="cb83-82"><a href="#cb83-82" aria-hidden="true" tabindex="-1"></a><span class="fu">{</span></span>
Expand Down
12 changes: 10 additions & 2 deletions docs/odata-csdl-json/odata-csdl-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -3928,6 +3928,14 @@ properties targeted via the declaring structured type.
Constant expressions allow assigning a constant value to an applied
term.

Primitive values of various types are represented as strings so that their type
cannot be inferred from the constant expression alone. If such
a constant expression is an operand of a larger expression, clients MUST assume
that the operand has the type demanded by the larger expression, for example in a
client-side function or in a comparison with another operand of known type.
(In the `$In` comparison in [example 75](#disambiguate) if `Fabric` is a collection
of `Edm.String`, the constant expression `"Blue"` is a string, not a binary value.)

### <a name="Binary" href="#Binary">14.3.1 Binary</a>

::: {.varjson .rep}
Expand Down Expand Up @@ -4779,7 +4787,7 @@ They MAY contain [annotations](#Annotation).
:::

::: {.varjson .example}
Example 75:
Example <a name="disambiguate" href="#disambiguate">75</a>:
```json
{
"$And": [
Expand Down Expand Up @@ -4859,7 +4867,7 @@ Example 75:
{
"$Path": "Fabric"
},
"Red"
"Blue"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/odata-csdl-xml/odata-csdl-xml.html
Original file line number Diff line number Diff line change
Expand Up @@ -3164,7 +3164,7 @@ <h3 id="expressions-edmeq-edmne-edmgt-edmge-edmlt-edmle-edmhas-and-edmin"><a nam
<span id="cb80-35"><a href="#cb80-35" aria-hidden="true" tabindex="-1"></a>&lt;/<span class="kw">Le</span>&gt;</span>
<span id="cb80-36"><a href="#cb80-36" aria-hidden="true" tabindex="-1"></a>&lt;<span class="kw">Has</span>&gt;</span>
<span id="cb80-37"><a href="#cb80-37" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">Path</span>&gt;Fabric&lt;/<span class="kw">Path</span>&gt;</span>
<span id="cb80-38"><a href="#cb80-38" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">EnumMember</span>&gt;org.example.Pattern/Red&lt;/<span class="kw">EnumMember</span>&gt;</span>
<span id="cb80-38"><a href="#cb80-38" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">EnumMember</span>&gt;org.example.Pattern/Blue&lt;/<span class="kw">EnumMember</span>&gt;</span>
<span id="cb80-39"><a href="#cb80-39" aria-hidden="true" tabindex="-1"></a>&lt;/<span class="kw">Has</span>&gt;</span>
<span id="cb80-40"><a href="#cb80-40" aria-hidden="true" tabindex="-1"></a>&lt;<span class="kw">In</span>&gt;</span>
<span id="cb80-41"><a href="#cb80-41" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">Path</span>&gt;Size&lt;/<span class="kw">Path</span>&gt;</span>
Expand Down
3 changes: 2 additions & 1 deletion docs/odata-csdl-xml/odata-csdl-xml.md
Original file line number Diff line number Diff line change
Expand Up @@ -3737,6 +3737,7 @@ properties targeted via the declaring structured type.
Constant expressions allow assigning a constant value to an applied
term.


### <a name="Binary" href="#Binary">14.3.1 Binary</a>


Expand Down Expand Up @@ -4762,7 +4763,7 @@ Example 75:
</Le>
<Has>
<Path>Fabric</Path>
<EnumMember>org.example.Pattern/Red</EnumMember>
<EnumMember>org.example.Pattern/Blue</EnumMember>
</Has>
<In>
<Path>Size</Path>
Expand Down
16 changes: 13 additions & 3 deletions odata-csdl/14 Vocabulary and Annotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,16 @@ properties targeted via the declaring structured type.
Constant expressions allow assigning a constant value to an applied
term.

: varjson
Primitive values of various types are represented as strings so that their type
cannot be inferred from the constant expression alone. If such
a constant expression is an operand of a larger expression, clients MUST assume
that the operand has the type demanded by the larger expression, for example in a
client-side function or in a comparison with another operand of known type.
(In the `$In` comparison in [example ##disambiguate] if `Fabric` is a collection
of `Edm.String`, the constant expression `"Blue"` is a string, not a binary value.)
:

### ##subsubsec Binary

::: {.varjson .rep}
Expand Down Expand Up @@ -2012,7 +2022,7 @@ They MAY contain [annotations](#Annotation).
:::

::: {.varjson .example}
Example ##ex:
Example ##ex_disambiguate:
```json
{
"$And": [
Expand Down Expand Up @@ -2092,7 +2102,7 @@ Example ##ex:
{
"$Path": "Fabric"
},
"Red"
"Blue"
]
},
{
Expand Down Expand Up @@ -2180,7 +2190,7 @@ Example ##ex:
</Le>
<Has>
<Path>Fabric</Path>
<EnumMember>org.example.Pattern/Red</EnumMember>
<EnumMember>org.example.Pattern/Blue</EnumMember>
</Has>
<In>
<Path>Size</Path>
Expand Down

0 comments on commit 9410bc8

Please sign in to comment.