Skip to content

HasMany relationship treated as HasOne in deserialization #52

Closed
@jfhs

Description

@jfhs

Having a model

    public class Country: Identifiable<Guid>
    {
        [Attr("name")]
        public string Name { get; set; }

        [HasMany("cities")]
        public virtual List<City> Cities { get; set; }
    }

And trying to post

{"data": {
    "attributes": {
      "name":"qwe"
    },
    "relationships": {
      "cities": {
        "data": []
      }
    },
    "type":"countries"
  }
}

JsonApiDeSerializer tries to find CitiesId property in here which it of course doesn't.

I believe there should be separate code for handling HasMany relationships.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions