Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Javascript API Annotation DSL
// app/instance-initializers/schema.js
import fetch from 'fetch'
import { loadSchema } from 'wildland-schema/ember-data';
import ENV from '../config/environment';
// load schema and store to report usage violations
export function initialize(applicationInstance) {
if (ENV.environment === 'development') {
const store = applicationInstance.lookup('service:store');
fetch('/api/v1/schema').then(response => response.json())
.then(jsonSchema => loadSchema(store, jsonSchema));
// models/baz.js
import DS from 'ember-data';
import Schema from 'wildland-schema/ember-data';
const Baz default DS.Model.extend({
foo: DS.belongsTo('foo'),
oldThing: DS.attr(),
thing: DS.attr(),
bar: DS.attr(),
export default Schema(Baz);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment