Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-1384

AnnotationInMemoryDs: deep Create throws "Missing source field for related data"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • V2 2.0.2, V2 2.0.3, V2 2.0.4, V2 2.0.5, V2 2.0.6, V2 2.0.7, V2 2.0.8, V2 2.0.9, V2 2.0.10, V2 2.0.11
    • V2 2.1.0
    • odata2-annotation
    • Patch

    Description

      When a deep create on a source entity follows a navigation property but no corresponding back-navigation at the target entity is found, AnnotationInMemoryDs throws the error "Missing source field for related data". There are two possible reasons no target navigation is found:

      1. It doesn't exist
      2. The target entity is of the same type as the source entity ("self-reference")

      Steps to reproduce:

      1. Checkout cars-annotation-archetype
      2. Remove property "Car" of entity type "Driver"
      3. Run example service
      4. Click "create example data"

      Expected results:

      Example data, including drivers, is created.

      Actual results:

      Car creation fails when it mentions a driver, no drivers are created nor cars that have a driver. Each create request logs "Missing source field for related data".

      Workaround:

      1. Always create a corresponding back-navigation property at the target entity of a navigation when using deep creates.
      2. Don't use deep create when target entity type = source entity type.

      Additional information:

      1. A similar fix as this one is already present in readRelatedData()
      2. Patch does not include a test (yet) for this special case. I would need some assistance regarding conventions and options.
      3. Bug was introduced in 6f7b76f689e4a8c8889c59760715c80d4a4c17f2 of issue OLINGO-508. IMHO that change broke more than it fixed (expect at least one more related bug), but see #1.

      Attachments

        Activity

          People

            Unassigned Unassigned
            cmilkau@prologa.de Carsten Milkau
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified