diff --git a/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs b/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs index 0c5a17fb..1c12bef6 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs +++ b/src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs @@ -705,8 +705,9 @@ private void CreateAlternateKeyPath(ODataPath currentPath, IEdmEntityType entity IEnumerable> alternateKeys = _model.GetAlternateKeysAnnotation(entityType); foreach (var keyDict in alternateKeys) { + if (keyDict.Where(static x => x.Value is not null).ToDictionary(static k => k.Key, static v => v.Value.Name) is not { Count: > 0 } keyMappings) + continue; ODataPath keyPath = currentPath.Clone(); - IDictionary keyMappings = keyDict.ToDictionary(static k => k.Key, static v => v.Value.Name); ODataKeySegment keySegment = new(entityType, keyMappings) { IsAlternateKey = true