formly-js / angular-formly

JavaScript powered forms for AngularJS
http://docs.angular-formly.com
MIT License
2.22k stars 404 forks source link

Integration with JS-Data? #303

Closed facultymatt closed 9 years ago

facultymatt commented 9 years ago

Was wondering if you've considered integrations with http://www.js-data.io/ which is a powerful library for data modeling.

I believe the schema defined by jsData could be pulled nicely into formly with pretty minimal changes.

What made me think of this was validation. jsData, like formly, does not include validation beyond a few basics around type. Instead, the user must create validators like so.

I use jsData often in projects, and will consider giving jsData + formly a try in my next project.

Any thoughts on this?

kentcdodds commented 9 years ago

Yes, I totally love js-data from @jmdobry. @jmdobry, would love to collaborate on a library that could convert your schema to mine and then back again so your users can use angular-formly and my users can use js-data. Would be amazingly awesome.

facultymatt commented 9 years ago

I'd love to take a stab at this in the future - currently our jsData + jsFormly (+ Salesforce) integration is complete. For now we have done this with a model and form setup in the controller - nothing fancy.

However we have a few projects on the horizon where a more robust integration could be developed.

If you want to get a rough spec together for how an integration could work it would be a great start! If not I will check back in with something when those projects get closer.

!!!

jmdobry commented 9 years ago

As a note, js-data 2.0 removes the coupling between js-data and js-data-schema, so you're free to use whatever validation library you'd like (just implement the validate lifecycle hook). So if there's a validation library that's already compatible with angular-formly, use that.

kentcdodds commented 9 years ago

angular-formly is pretty versatile, but I made an example using is.js and it was pretty cool.

facultymatt commented 9 years ago

Yes the example is great and that library is amazing! So simple.

I tweeted the other day asking for validation libraries - I swear there were some responses but all I could find was "native validation". Do either of you have a list of great solutions like is.js? Not that it matters for this particular integration, but would be useful to know!

Theoretically any validation library should work using defineRule combined with optionTypes and validators.

kentcdodds commented 9 years ago

I also tweeted about it a few days ago. Found a few libraries there.

jmdobry commented 9 years ago

Validate.js is another good one.

facultymatt commented 9 years ago

Also stumbled across this recently: https://github.com/square/lgtm/wiki

On Thu, May 28, 2015 at 12:17 AM, Jason Dobry notifications@github.com wrote:

Validate.js http://validatejs.org/ is another good one.

— Reply to this email directly or view it on GitHub https://github.com/formly-js/angular-formly/issues/303#issuecomment-106165716 .

Matt Miller

Web Master 609-335-4417 matt@superpedestrian.com https://www.superpedestrian.com/ https://www.google.com/url?q=https%3A%2F%2Fwww.superpedestrian.com%2F&sa=D&sntz=1&usg=AFQjCNHLEDFaMLgggeXL8rh4gGlNfN0WSA


Superpedestrian Inc. 84 Hamilton St. Cambridge, MA 02139

This message is intended only for the addressee named above. If you are not the intended recipient of this message, you are hereby notified that you must not use, disseminate, or copy it in any form or take any action in reliance upon it. If you have received this message in error, please delete it and any copies of it from your email system and reply immediately to the sender at the address shown above. This message may contain confidential and/or proprietary information. Neither confidentiality, nor any proprietary rights are intended to be waived or lost by any error in transmission.

kentcdodds commented 9 years ago

I actually don't think that I'll ever get to this. If someone else wants to do this, I'd happily help them get started. I'm going to go ahead and close this though as I don't plan on actually implementing it.

kentcdodds commented 9 years ago

To, anyone interested in implementing this. I added a new feature in 6.14.0 that allows you to specify a fieldTransform function to convert a given field configuration into something that angular-formly understands. So accomplishing something like this should be a matter of writing a fieldTransform to convert js-data schema into formly field configurations.