Missing Resource Type: received resource data with a type 'events' but no schema could be found with that name

45 Views Asked by At

I have a basic Rails 7 application that uses the jsonapi-resources gem. On the Rails side of the application, I implemented a simple structure of two resources - events and event_categories. They are connected to each other through associations:

has_one :category, class_name: "EventCategory", exclude_links: %i[self related]
has_many :events

Everything works successfully through Postman. include, fields[*] and sorting work.

Well, that is, everything is fine with the Rails part.

The problem is only with Ember.

From their documentation, I conclude that Ember out of the box can work with JSON:API using the JSONAPIAdapter. But I immediately get this error:

Error while processing route: events.index Assertion Failed: Missing Resource Type: received resource data with a type 'events' but no schema could be found with that name. Error: Assertion Failed: Missing Resource Type: received resource data with a type 'events' but no schema could be found with that name.

Uncaught (in promise) Error: Assertion Failed: Missing Resource Type: received resource data with a type 'events' but no schema could be found with that name.

// app/models/event.js

import Model, { attr } from '@ember-data/model';

export default class EventModel extends Model {
  @attr('string') note;
  @attr('string') scheduled_on;
}

Tell me, please, what is the problem?

0

There are 0 best solutions below