Build - May 8th
My model
public class ValidationModel
{
public int Id { get; set; }
[Required]
[Range(1,10)]
public int IntReq { get; set; }
[Required]
public int IntNotReqAndDMIsReq { get; set; }
[Required]
public string StrNotReqAndDMIsReq { get; set; }
}
I am making following request
var jsonEncodedBadObject = "{\"Id\": 4}";
object mediaTypeFormatter = "application/json";
request.Content = new StringContent((string)jsonEncodedBadObject, System.Text.Encoding.UTF8, (string)mediaTypeFormatter);
I am seeing following errors when I get a response
Key=model
Value
Exception:Required property 'IntReq' not found in JSON. Path '', line 1, position 9.
Exception:Required property 'IntNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.
When I used April 25th build, I am seeing missing string property in Json errors too.
I am seeing
Key=model
Value
Exception:Required property 'IntReq' not found in JSON. Path '', line 1, position 9.
Exception:Required property 'IntNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.
__Exception:Required property 'StrNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.__
If you have add DataContract attribute to class and [DataMember(IsRequired = true)] on string property, you see following in response
Key=model
Value
Exception:Required property 'IntReq' not found in JSON. Path '', line 1, position 9.
Exception:Required property 'IntNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.
{}
Key=model.IntReq
Value
The field IntReq must be between 1 and 10.
Note: StrNotReqAndDMIsReq validation is missing
I attached fiddler session.
1st one is April 25th build with [Required] attributes on properties
2nd one is latest build with [Required] attribute on properties
3rd one is the latest build with [DataMember(IsRequired=true)] attribute on string property
My model
public class ValidationModel
{
public int Id { get; set; }
[Required]
[Range(1,10)]
public int IntReq { get; set; }
[Required]
public int IntNotReqAndDMIsReq { get; set; }
[Required]
public string StrNotReqAndDMIsReq { get; set; }
}
I am making following request
var jsonEncodedBadObject = "{\"Id\": 4}";
object mediaTypeFormatter = "application/json";
request.Content = new StringContent((string)jsonEncodedBadObject, System.Text.Encoding.UTF8, (string)mediaTypeFormatter);
I am seeing following errors when I get a response
Key=model
Value
Exception:Required property 'IntReq' not found in JSON. Path '', line 1, position 9.
Exception:Required property 'IntNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.
When I used April 25th build, I am seeing missing string property in Json errors too.
I am seeing
Key=model
Value
Exception:Required property 'IntReq' not found in JSON. Path '', line 1, position 9.
Exception:Required property 'IntNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.
__Exception:Required property 'StrNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.__
If you have add DataContract attribute to class and [DataMember(IsRequired = true)] on string property, you see following in response
Key=model
Value
Exception:Required property 'IntReq' not found in JSON. Path '', line 1, position 9.
Exception:Required property 'IntNotReqAndDMIsReq' not found in JSON. Path '', line 1, position 9.
{}
Key=model.IntReq
Value
The field IntReq must be between 1 and 10.
Note: StrNotReqAndDMIsReq validation is missing
I attached fiddler session.
1st one is April 25th build with [Required] attributes on properties
2nd one is latest build with [Required] attribute on properties
3rd one is the latest build with [DataMember(IsRequired=true)] attribute on string property