in JSLib/src/odata-json-light.js [792:826]
var jsonLightComputeNavigationAndAssociationProperties = function (data, entityModel, baseTypeModel) {
/// <summary>Adds navigation links to the entry metadata</summary>
/// <param name="data" type="Object">JSON light entry.</param>
/// <param name="entityModel" type="Object">Object describing the entry model.</param>
/// <param name="baseTypeModel" type="Object" optional="true">Object describing an OData conceptual schema of the baseType if it exists.</param>
var navigationLinkAnnotation = "@odata.navigationLinkUrl";
var associationLinkAnnotation = "@odata.associationLinkUrl";
var navigationPropertyName, navigationPropertyAnnotation, associationPropertyAnnotation;
for (var i = 0; entityModel.navigationProperty && i < entityModel.navigationProperty.length; i++) {
navigationPropertyName = entityModel.navigationProperty[i].name;
navigationPropertyAnnotation = navigationPropertyName + navigationLinkAnnotation;
if (data[navigationPropertyAnnotation] === undefined) {
data[navigationPropertyAnnotation] = data[jsonLightAnnotations.edit] + "/" + encodeURIComponent(navigationPropertyName);
}
associationPropertyAnnotation = navigationPropertyName + associationLinkAnnotation;
if (data[associationPropertyAnnotation] === undefined) {
data[associationPropertyAnnotation] = data[jsonLightAnnotations.edit] + "/$links/" + encodeURIComponent(navigationPropertyName);
}
}
if (baseTypeModel && baseTypeModel.navigationProperty) {
for (i = 0; i < baseTypeModel.navigationProperty.length; i++) {
navigationPropertyName = baseTypeModel.navigationProperty[i].name;
navigationPropertyAnnotation = navigationPropertyName + navigationLinkAnnotation;
if (data[navigationPropertyAnnotation] === undefined) {
data[navigationPropertyAnnotation] = data[jsonLightAnnotations.edit] + "/" + encodeURIComponent(navigationPropertyName);
}
associationPropertyAnnotation = navigationPropertyName + associationLinkAnnotation;
if (data[associationPropertyAnnotation] === undefined) {
data[associationPropertyAnnotation] = data[jsonLightAnnotations.edit] + "/$links/" + encodeURIComponent(navigationPropertyName);
}
}
}
};