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
-
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:
- It doesn't exist
- The target entity is of the same type as the source entity ("self-reference")
Steps to reproduce:
- Checkout cars-annotation-archetype
- Remove property "Car" of entity type "Driver"
- Run example service
- 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:
- Always create a corresponding back-navigation property at the target entity of a navigation when using deep creates.
- Don't use deep create when target entity type = source entity type.
Additional information:
- A similar fix as this one is already present in readRelatedData()
- Patch does not include a test (yet) for this special case. I would need some assistance regarding conventions and options.
- 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.