Skip to content

Inconsistency for dasherized attributes #93

Closed
@JanMattner

Description

@JanMattner

If I have a client entity definition as follows:

public class Client : Identifiable
{
        [Attr("clientName")]
        public string ClientName { get; set; }
}

I expect that the attribute is everywhere referenced as "clientName". However, when POSTing a new client, I am forced to use the dasherized version of it:

{
  "data": {
    "type": "clients",
    "attributes": {
      "client-name": "Foo Bar"
  }
}

However, the response of that and a normal GET request uses the non-dasherized version:

{
  "data": {
    "type": "clients",
    "id": "8",
    "attributes": {
      "clientName": "Foo Bar"
    },
  }
}

I am forced to do that due to this line in the JsonApiDeSerialization.cs

I expect that the attribute names defined via the Attr attribute are used throughout the framework.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions