Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extenstions/jsonSchema - consider returning just the schema #2

Open
neonstalwart opened this issue Dec 8, 2014 · 0 comments · May be fixed by #4
Open

extenstions/jsonSchema - consider returning just the schema #2

neonstalwart opened this issue Dec 8, 2014 · 0 comments · May be fixed by #4

Comments

@neonstalwart
Copy link

it's hard to use extensions/jsonSchema with a custom base Model. e.g. i have a base Model for all my models which is something like this:

define(function (require) {
    var Model = require('dmodel/Model');

    return Model.createSubclass({
        rpc: function (method) {
            var params = Array.prototype.slice.call(arguments, 1);

            return this._store._rpc(this._store.target + this._store.getIdentity(this), method, params);
        }
    });
});

then each of my models just depend on that module and define their own schemas.

BaseModel.createSubcalss({
  schema: ...
});

trying to use extensions/jsonSchema causes a lot of friction because it takes a schema and returns a Model. i would have to do something like using AMD map config to map my own model as dmodel/Model into dmodel/extensions/jsonSchema or use model.prototype.schema as the schema to pass to another Model.

it would be easier if the extension took a json-schema and returned the dmodel schema so that it is used like so:

Model.createSubclass({
  schema: jsonSchema(...)
});
neonstalwart added a commit to neonstalwart/dmodel that referenced this issue Dec 8, 2014
@neonstalwart neonstalwart linked a pull request Dec 8, 2014 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant