Skip to content

req.options.controller not set, camelCase serialization not working #48

@danieledraganti

Description

@danieledraganti

Hello,
I am using your blueprint system on an app with Ember.js as a front end, which is of course the ideal platform for JSON API 😊
I am running on Sails 1.0.0-36.
I am calling the JsonApiService inside of a controller to handle user signup.
This is a stub of the code I have made to check if the JSON API integration works:

signup: function (req, res) {
	  req.options.controller = 'user';
	  JsonApiService.createRecord(req, res);
  }

I would like to point out two bugs:

  1. I need to manually set req.options.controller since this is used by your parseModel to retrieve the actual model of the resource, but Sails does not set this value automatically.
  2. I am receiving the parameters as 'kebab-case' from my front end, therefore your service should serialize them correctly when injected in the Sails model, to camelCase (I have set attributesDeserializedCase: 'camelCase'in the config/jsonapi.js), but Waterline triggers the following error:
UsageError: Invalid new record(s).
Details:
  Could not use specified `first-name`.  This is not a valid name for an attribute.

Where does your code do the serializing/deserializing? What is happening here?

Thank you in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions