Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose properties of resource #142

Merged
merged 4 commits into from
Mar 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Saule/ApiResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,20 @@ protected ApiResource()
/// </summary>
public string ResourceType { get; private set; }

internal IEnumerable<ResourceAttribute> Attributes => _attributes;
/// <summary>
/// Gets the defined attributes of this resource.
/// </summary>
public IEnumerable<ResourceAttribute> Attributes => _attributes;

internal IEnumerable<ResourceRelationship> Relationships => _relationships;
/// <summary>
/// Gets the defined relationships of this resource.
/// </summary>
public IEnumerable<ResourceRelationship> Relationships => _relationships;

internal string IdProperty { get; private set; }
/// <summary>
/// Gets the defined identifier of this resource.
/// </summary>
public string IdProperty { get; private set; }

/// <summary>
/// Customize the type name of this resource. The default value
Expand Down Expand Up @@ -198,4 +207,4 @@ private static T GetUniqueResource<T>()
return resource;
}
}
}
}
8 changes: 7 additions & 1 deletion Saule/ResourceAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ public class ResourceAttribute
public ResourceAttribute(string name)
{
Name = name.ToDashed();
PropertyName = name.ToPascalCase();
}

/// <summary>
/// Gets the name of the attribute.
/// Gets the name of the attribute in dashed JSON API format.
/// </summary>
public string Name { get; }

/// <summary>
/// Gets the name of the attribute in PascalCase.
/// </summary>
public string PropertyName { get; }
}
}