diff --git a/src/JsonApiDotNetCore/Internal/ContextGraph.cs b/src/JsonApiDotNetCore/Internal/ContextGraph.cs
index c0c7f2274b..6a39a292de 100644
--- a/src/JsonApiDotNetCore/Internal/ContextGraph.cs
+++ b/src/JsonApiDotNetCore/Internal/ContextGraph.cs
@@ -7,7 +7,7 @@ namespace JsonApiDotNetCore.Internal
public interface IContextGraph
{
///
- /// Gets the value of the navigation property, defined by the relationshipName,
+ /// Gets the value of the navigation property, defined by the relationshipName,
/// on the provided instance.
///
/// The resource instance
@@ -42,6 +42,12 @@ public interface IContextGraph
///
ContextEntity GetContextEntity(Type entityType);
+ ///
+ /// Get the public attribute name for a type based on the internal attribute name.
+ ///
+ /// The internal attribute name for a .
+ string GetPublicAttributeName(string internalAttributeName);
+
///
/// Was built against an EntityFrameworkCore DbContext ?
///
@@ -111,5 +117,13 @@ public string GetRelationshipName(string relationshipName)
.SingleOrDefault(r => r.Is(relationshipName))
?.InternalRelationshipName;
}
- }
+
+ public string GetPublicAttributeName(string internalAttributeName)
+ {
+ return GetContextEntity(typeof(TParent))
+ .Attributes
+ .Single(a => a.InternalAttributeName == internalAttributeName)
+ .PublicAttributeName;
+ }
+ }
}