How to use the @ember-data/serializer/json-api.extend function in @ember-data/serializer

To help you get started, we’ve selected a few @ember-data/serializer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github puzzle / cryptopus / frontend / app / serializers / application.js View on Github external
import JSONAPISerializer from "@ember-data/serializer/json-api";
import { underscore } from "@ember/string";

export default JSONAPISerializer.extend({
  keyForAttribute(attr) {
    return underscore(attr);
  },

  keyForRelationship(key) {
    return underscore(key);
  },

  serializeBelongsTo(snapshot, json, relationship) {
    // do not serialize the attribute!
    if (relationship.options && relationship.options.readOnly) {
      return;
    }
    this._super(...arguments);
  }
});

@ember-data/serializer

Provides Legacy JSON, JSON:API and REST Implementations of the Serializer Interface for use with @ember-data/store

MIT
Latest version published 18 days ago

Package Health Score

89 / 100
Full package analysis