-
Notifications
You must be signed in to change notification settings - Fork 122
Description
On server side I use the JSON-API Framework Lux. This delivers all attributes dasherized, e.g. first-name, independent of the case type internally used.
This is also recommended by JSON API:
Member names SHOULD contain only the characters “a-z” (U+0061 to U+007A), “0-9” (U+0030 to U+0039), and the hyphen minus (U+002D HYPHEN-MINUS, “-“) as separator between multiple words.
How do I define my model in Angular 2 JSON API?
The following solution is obviously not working:
// from models/user.ts
@Attribute
first-name: string
But when I use the camelCase type:
// from models/user.ts
@Attribute
firstName: string
then the attribute is not recognised:
// from console.log():
first-name: "Foobar"
firstName: undefined
The same happens when I use the snake_case type (first_name).
I there a possibility to specify the casing, that should be used by Angular 2 JSON API, both for GETting resources and POSTing/PATCHing resources?
Or is this a bug, and it should work out-of-the-box with the camelCase (firstName) or snake_case (first_name) variant?