Class SchemaDefinitionService
publicA SchemaDefinitionService implementation provides the ability to query for various information about a resource in an abstract manner.
How an implementation determines this information is left up to the implementation, this means that schema information could be lazily populated, derived-on-demand, or progressively enhanced during the course of an application's runtime.
The implementation provided to work with @ember-data/model
makes use of the
static schema properties on those classes to respond to these queries; however,
that is not a necessary approach. For instance, Schema information could be sideloaded
or pre-flighted for API calls, resulting in no need to bundle and ship potentially
large and expensive JSON or JS schemas to pull information from.
To register a custom schema implementation, extend the store service or lookup and register the schema service first thing on app-boot. Example below shows extending the service.
1 2 3 4 5 6 7 8 9 |
import Store from ' -data/store'; import CustomSchemas from './custom-schemas'; export default class extends Store { constructor(...args) { super(...args); this.registerSchemaDefinitionService(new CustomSchemas()); } } |
At runtime, both the Store
and the StoreWrapper
provide
access to this service via the getSchemaDefinitionService()
method.
1 2 3 4 5 6 7 8 9 |
export default class extends Component { store; get attributes() { return this.store .getSchemaDefinitionService() .attributesDefinitionFor(this.args.dataType); } } |
This is not a class and cannot be instantiated.
Methods
Properties
No documented items
Events
No documented items