-
Notifications
You must be signed in to change notification settings - Fork 82
Can include model schema definitions in generated $resources #194
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
Conversation
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
Can someone please provide an example of how to call the LoopBack model from inside a Kendo UI datasource attribute? |
We have some samples online although using a somehow limited version of the custom Kendo UI data source - http://repository.akera.io:8383/slc/ (Kendo Grid using Akera Angular SDK). Since then we have extended the datasource and though we can make it generic for all LoopBack models if we can get the model definition exported on the client-side as well... what we do now for akera.io is to have a base model that exposes the 'describe' method and have all models extent that instead. We're going to release the data source on github, guess we just have to check if the model definition can be retrieved somehow and only include the schema if that is available. Thing is for anything else beside read operations the Kendo datasource need to know the model primary key - for update, delete :( |
* @description | ||
* The schema of the model represented by this $resource | ||
*/ | ||
R.schema = <%- JSON.stringify(meta.modelSchema, null, '\t') -%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use 2 spaces for indentation for consistency, we don't use tabs anywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add ;
at the end of the generated statement.
R.schema = <%- ... -%>;
Hi @akera-io, thank you for the pull request. Please add a unit-test to verify the implementation and address my minor comments above. |
@slnode ok to test |
Hi Miroslav, addressing the comments should be straight forward, for unit-test should we add a new test in services.spec.js or what is your favourite? Cheers, Acorn IT On 25 Jan 2016, at 15:27, Miroslav Bajtoš <[email protected]mailto:[email protected]> wrote: Hi @akera-iohttps://github.com/akera-io, thank you for the pull request. Please add a unit-test to verify the implementation and address my minor comments above. — |
added unit test, hope this is how we should have added one :) |
Hi,
we're working on a Kendo data source that can use Strongloop REST services as 'transport' and while things are working just fine for read operations for updates the Kendo data source require some schema information - the model primary key is mandatory else no update operation can take place.
While one can add that information manually when defining the data source it's a pita not to use the information already available in our models. We've just added an option to include the model definition (properties) when generating the angular resources, this is not included by default so if you think we can merge that back in 'master' we would rather not keep the fork alive. There is a minor change in the client to accommodate this.
Best regards,
Marian Edu
[email protected]
www.acorn-it.com
www.akera.io