OData / OData/AspNetCoreOData

ModelState serializing

Open
#348 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement P3
Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

class Test
{
   [Required]
   public string Value {get; set;}
}

Posting a Test object with Value == null will cause an invalid model state.
Doing BadRequest(ModelState) yields the following response:
{"error":{"code":"","message":"The input was not valid.","details":[{"code":"","message":"The input was not valid."}]}}

Expected
The response to contain the name of the property with an invalid value.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Test example with a null required Value and inspect the BadRequest(ModelState) response path. Trace how model-state errors are serialized, then verify that the resulting details identify the invalid property name while preserving the existing error response behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.