Skip to content

How to annotate RequiredProperties during deep insert? #2109

@HeikoTheissen

Description

@HeikoTheissen

Consider an entity set Orders with a containment navigation property Items and assume that the item property ItemType is mandatory during item creation.

For a request like POST Orders(...)/Items, this is expressed as:

<Annotations Target="ns.Container/Orders/Items">
  <Annotation Term="Capabilities.InsertRestrictions">
    <Record>
      <PropertyValue Property="RequiredProperties">
        <Collection>
          <PropertyPath>ItemType</PropertyPath>
        </Collection>
      </PropertyValue>
    </Record>
  </Annotation>
</Annotations>

But how can the requirement be expressed for a deep insert POST Orders with the Items navigation property in the payload?

<Annotations Target="ns.Container/Orders">
  <Annotation Term="Capabilities.InsertRestrictions">
    <Record>
      <PropertyValue Property="RequiredProperties">
        <Collection>
          <PropertyPath>Items/ItemType</PropertyPath>
        </Collection>
      </PropertyValue>
    </Record>
  </Annotation>
</Annotations>

goes too far: It seems to require that the payload always contains Items.

To which requests does the following alternative apply?

  • An insert POST Orders(...)/Items
  • A deep insert POST Orders with Items in the payload
<Annotations Target="ns.Container/Orders">
  <Annotation Term="Capabilities.NavigationRestrictions">
    <Record>
      <PropertyValue Property="RestrictedProperties">
        <Collection>
          <Record>
            <PropertyValue Property="NavigationProperty" NavigationPropertyPath="Items" />
            <PropertyValue Property="InsertRestrictions">
              <Record>
                <PropertyValue Property="RequiredProperties">
                  <Collection>
                    <PropertyPath>Items/ItemType</PropertyPath>
                  </Collection>
                </PropertyValue>
              </Record>
            </PropertyValue>
          </Record>
        </Collection>
      </PropertyValue>
    </Record>
  </Annotation>
</Annotations>

If this applies to deep inserts, does it mandate the ItemType in an item without also mandating the Items?

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Open

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions