digia / jaysonapi

Node framework agnostic JSON API serializer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Id is a number

byCedric opened this issue · comments

When I serialize my data, from sequelizejs, the id's are returned as a numeric value. However, inside the JSON API specification it states that:

Every resource object MUST contain an id member and a type member. The values of the id and type members MUST be strings.

So to fully comply with the standard, can we parse the refValue within the serialzier, to a string?

I don't see a problem with that at all. It is a "MUST" so it should be in the serializer.

Any chance you could shoot over a PR? I'm on a launch deadline or i'd be able to knock out.

Quick scan over, it may be as simple as casting to a string on https://github.com/digia/jaysonapi/blob/master/src/index.js#L144

Sweet, I was just asking before I change something that might had a reason. I will simply cast it to string. You can expect a pull request today! :)