miragejs/ember-cli-mirage

JSONApiSerializer does not support `serializeIds` (v2.4.0)

lcoq opened this issue · 2 comments

lcoq commented

This should probably be at least specified (again) in the documentation.
Apparently it was the case in 2018 (#1180 ).

// mirage/models/session.js
export default Model.extend({
  user: belongsTo()
});
// mirage/serializers/application.js
export default JSONAPISerializer.extend({
  serializeIds: 'always'
});

Relationship id is indeed returned with include: ['user'] option, but without no relationship data at all is returned, no matter serializeIds value.

This could be nice to allow this anyway 🙂

All this code was extracted to another repo. https://github.com/miragejs/miragejs MirageJS. Please post your issue there. This addon now only aids in importing MirageJS.

The following line has been deprecated

import { JSONAPISerializer } from 'ember-cli-mirage';

and changed to (see https://www.ember-cli-mirage.com/docs/data-layer/serializers#defining-serializers) to help understand which repo is responsible for what.

import { JSONAPISerializer } from 'miragejs';
lcoq commented

Oh sorry then !

For future readers the serializeIds option was renamed on the other repo :

JSONAPISerializer.extend({
  alwaysIncludeLinkageData: true
})

Thank you !