Generator
The jsonapi-resource
generator creates prototypes (classes/mixins/modules etc.) for the resource. The output includes new files for an initializer, service, adapter, and serializer.
Use ember generate resource name
(name
is the entity).
jsonapi-resource
Generate a resource (model with associated adapter, serializer, service and initializer):
ember generate jsonapi-resource entityName
Use the singular form of the name for your resource entityName
.
The blueprint for a jsonapi-resource
does not generate a route. You can generate a route using the same name or use a different name:
ember generate route entityName
Include arguments for the generator to use with the jsonapi-model
blueprint. The resulting resource (model) uses the attr
, has-one
, and has-many
computed properties per the arguments you use.
ember generate jsonapi-resource article title:string version:number author:has-one:user
When using the pod file structure in your ember-cli project use the --pod
argument:
ember generate jsonapi-resource user name:string articles:has-many:articles --pod