Closed joshjeppson closed 5 years ago
There is a pluralization convention for API resource identity type names so I am assuming you are using this convention first of all. But you can always explicitly set any service model or schema level properties which does take precedence over any conventions.
So for your example of Person it would be something like the following:
public class PersonConfiguration : ResourceTypeBuilder<PersonResource>
{
// PUBLIC CONSTRUCTORS //////////////////////////////////////////////
#region Constructors
public PersonConfiguration()
{
// Hypermedia
this.Hypermedia()
.SetApiCollectionPathSegment("persons");
// Resource Identity
this.ResourceIdentity(x => x.Id)
.SetApiType("persons"); // This is explicitly setting json:api "type" to "persons"
// Attributes
// Relationships
this.ToOneRelationship<ProfileResource>("profile");
// Ignored
this.Attribute(x => x.ProfileId).Ignore();
this.Attribute(x => x.Profile).Ignore();
}
#endregion
}
Thanks! Exactly what I needed.
I'm switching our code base over from REST to JSONAPI using this framework. We made the decision long ago to use persons as the plural of person, not people. In our Ember clients this is easily overridden using an irregular inflector setting. Is there a way within this framework to override pluralization for only one specific instance like this?