Skip to content

PATCH request with nullable attributes does not work #95

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

Closed
ghost opened this issue Apr 25, 2017 · 0 comments
Closed

PATCH request with nullable attributes does not work #95

ghost opened this issue Apr 25, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Apr 25, 2017

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

@jaredcnance jaredcnance self-assigned this Apr 25, 2017
@jaredcnance jaredcnance added this to the v2.0.0 milestone Apr 25, 2017
@jaredcnance jaredcnance mentioned this issue Apr 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant