Fix wrong links generated for derived type with navigation property when odata.metadata=full - #831
Merged
gathogojr merged 1 commit intoFeb 1, 2023
Conversation
…hen odata.metadata=full
gathogojr
requested review from
ElizabethOkerio,
KenitoInc,
corranrogue9,
habbes,
lisicase,
mikepizzo and
xuzhg
January 31, 2023 08:24
2 tasks
xuzhg
approved these changes
Jan 31, 2023
Member
|
@gathogojr Is it part of #798 ? |
Contributor
Author
@xuzhg I didn't realize the customer had created a PR |
KenitoInc
approved these changes
Feb 1, 2023
gathogojr
deleted the
fix/797-wrong-links-for-derived-type-with-navigation-property
branch
February 1, 2023 04:45
This was referenced Feb 1, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request fixes #797.
Description
Fix wrong links generated for derived type with navigation property when
odata.metadata=full. Whenodata.metadata=fullis specified, the type-cast segment is wrongly appended to the resource id.When that happens, since ODL also appends the type-cast segment, you end up with the response payload looking as follows:
{ "@odata.context": "http://localhost:5219/odata/$metadata#Customers/ODataAlternateKeySample.Models.GoldCustomer/$entity", "@odata.type": "#ODataAlternateKeySample.Models.GoldCustomer", "@odata.id": "http://localhost:5219/odata/Customers(1)/ODataAlternateKeySample.Models.GoldCustomer", "@odata.editLink": "Customers(1)/ODataAlternateKeySample.Models.GoldCustomer/ODataAlternateKeySample.Models.GoldCustomer", "Id": 1, "Name": "Tom", "CountryOrRegion": null, "Passport": null, "SSN": "SSN-1-101", "Titles@odata.type": "#Collection(String)", "Titles": [ "abc", null, "efg" ], "Contact@odata.associationLink": "http://localhost:5219/odata/Customers(1)/ODataAlternateKeySample.Models.GoldCustomer/ODataAlternateKeySample.Models.GoldCustomer/Contact/$ref", "Contact@odata.navigationLink": "http://localhost:5219/odata/Customers(1)/ODataAlternateKeySample.Models.GoldCustomer/ODataAlternateKeySample.Models.GoldCustomer/Contact" }This pull request fixes the generation of
@odata.id,@odata.editLink,@odata.associationLinkand@odata.nagivationLinkproperties such that the response payload looks as follows:{ "@odata.context": "http://localhost:5219/odata/$metadata#Customers/ODataAlternateKeySample.Models.GoldCustomer/$entity", "@odata.type": "#ODataAlternateKeySample.Models.GoldCustomer", "@odata.id": "http://localhost:5219/odata/Customers(1)/ODataAlternateKeySample.Models.GoldCustomer", "@odata.editLink": "Customers(1)/ODataAlternateKeySample.Models.GoldCustomer", "Id": 1, "Name": "Tom", "CountryOrRegion": null, "Passport": null, "SSN": "SSN-1-101", "Titles@odata.type": "#Collection(String)", "Titles": [ "abc", null, "efg" ], "Contact@odata.associationLink": "http://localhost:5219/odata/Customers(1)/ODataAlternateKeySample.Models.GoldCustomer/Contact/$ref", "Contact@odata.navigationLink": "http://localhost:5219/odata/Customers(1)/ODataAlternateKeySample.Models.GoldCustomer/Contact" }