Fix issue #2276: should use for @type for serializing record in CSDL JSON #2277
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issues
This pull request fixes #2276.
Description
7 Structural Property
A structural property is a property of a structured type that has one of the following types:
· Primitive type
· Complex type
· Enumeration type
· A collection of one of the above
A structural property MUST specify a unique name as well as a type.
The property’s name MUST be a simple identifier. It is used when referencing, serializing or deserializing the property. It MUST be unique within the set of structural and navigation properties of the declaring structured type, and MUST NOT match the name of any navigation property in any of its base types. If a structural property with the same name is defined in any of this type’s base types, then the property’s type MUST be a type derived from the type specified for the property of the base type and constrains this property to be of the specified subtype for instances of this structured type. The name MUST NOT match the name of any structural or navigation property of any of this type’s base types for OData 4.0 responses.
Names are case-sensitive, but service authors SHOULD NOT choose names that differ only in case.
Property Object
Structural properties are represented as members of the object representing a structured type. The member name is the property name, the member value is an object.
The property object MAY contain the member $Kind with a string value of Property. This member SHOULD be omitted to reduce document size.
It MAY contain the member $Type, $Collection, $Nullable, $MaxLength, $Unicode, $Precision, $Scale, $SRID, and $DefaultValue.
It also MAY contain annotations.
Example 15: complex type with two properties Dimension and Length
"Measurement": {
"$Kind": "ComplexType",
"Dimension": {
},
"Length": {
}
}
For the record:
14.4.12 Record
The record expression enables a new entity type or complex type instance to be constructed.
A record expression MAY specify the structured type of its result, which MUST be an entity type or complex type in scope. If not explicitly specified, the type is derived from the expression’s context.
A record expression contains zero or more property value expressions. For each single-valued structural or navigation property of the record expression’s type that is neither nullable nor specifies a default value a property value expression MUST be provided. The only exception is if the record expression is the value of an annotation for a term that has a base term whose type is structured and directly or indirectly inherits from the type of its base term. In this case, property values that already have been specified in the annotation for the base term or its base term etc. need not be specified again.
For collection-valued properties the absence of a property value expression is equivalent to specifying an empty collection as its value.
Record expressions are represented as objects with one member per property value expression. The member name is the property name, and the member value is the property value expression.
The type of a record expression is represented as the @type control information, see [OData‑JSON].
It MAY contain annotations for itself and its members. Annotations for record members are prefixed with the member name.
Checklist (Uncheck if it is not completed)
Additional work necessary
If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.