joukevandermaas / saule

JSON API library for ASP.Net Web API 2.
https://joukevandermaas.github.io/saule
MIT License
76 stars 37 forks source link

Output of id is of type string in Json-Api, but is outputted as original type. #141

Closed Guidhouse closed 7 years ago

Guidhouse commented 7 years ago
public class User
    {
        public long UserId { get; set; }//For reasons of the DBA's we cannot change this easily
        public string Description { get; set; }
    }

Using ApiResource with 'WithId("UserId")' and the JsonApiSerializer captures the Id for the schema.@default ( in Swashbuckler), but the value is outputted without the quotation marks mandated by Json-Api, as seen here: http://jsonapi.org/format/#document-resource-objects.

what we get is the following json:

default": {
    "data": {
        "type": "user",
        "id": 1,
        "attributes": {
            "description": "Test"
        }, ...

I hope my explanation is clear enough, and if I get the time I will try and fix it myself and make a pull-request.

joukevandermaas commented 7 years ago

Good catch! A PR would be much appreciated.

joukevandermaas commented 7 years ago

Fixed in #149.