Skip to content

PATCH request with nullable attributes does not work #95

Closed
@ghost

Description

Hi,
Thanks for this great library!

When you are trying to PATCH a model with nullable attributes, it does not work.

Model example:

public class TodoItem : Identifiable
{
    Attr("description")]
    public string Description { get; set; }

    [Attr("created-date")]
    public DateTime CreatedDate { get; set; }

    [Attr("achieved-date")]
    public DateTime? AchievedDate { get; set; }
}

1st PATCH Request example: Field is not sent
PATCH http://localhost:5000/api/todoitem/1

{
  "description": "New description"
}

2nd PATCH Request example: Field is sent
PATCH http://localhost:5000/api/todoitem/1

{
  "description": "New description",
  "achieved-date": "2017-04-25T21:41:29.033Z"
}

Actual behavior: Exception is returned from the API.
Expected behavior:

  • Field is ignored if not sent (1st example)
  • Field is updated with new value if sent (2nd example)

Gerfaut

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions