mulesoft / api-designer

A web editor for creating and sharing RAML API specifications
Other
1.07k stars 266 forks source link

Question - Remote file server support #107

Closed malleshv closed 10 years ago

malleshv commented 10 years ago

Thanks for contributing to this. Looks very promising. Are there any plans to support retrieving and saving an existing RAML file from/to a remote file server (over HTTP(S))? I ask this as I see that there is remote-file-system.js which supports various operations to the remote file server.

-Mallesh

xaka commented 10 years ago

Thank you for your feedback, Mallesh!

API Designer does support retrieving and saving existing RAML files. The only thing you need to do is to implement your protocol and start using it. We're still working on documentation and so, but you can check https://github.com/mulesoft/api-designer#embedding that describes the way you can accomplish that. It's very easy, I'm serious :)

If you have question, you're very welcome to ask!

brianmc commented 10 years ago

Hi Mallesh, also about to attempt this (thanks for the reply Xaka) so maybe we can help each other out. I'll let you know how I get on.

Brian

brianmc commented 10 years ago

OK, I've implemented a simple files API to match the API I can see APIHub provides to the remote-file-system and I've modified remote-file-system.js and request-builder.js so token/login is not required. I can see the API is queried when I click the folder icon (GET) but for some reason the Save button is not being enabled. Need to debug into that but just wanted to update the thread. Is this the right path?

xaka commented 10 years ago

I wouldn't say that this is the right path as you definitely went too far :)

You shouldn't touch remote-file-system.js nor request-builder.js as those are used by designer for its own purpose and it's really long road to go along.

What you really want to do is simply implement file system service with 4 functions (directory, save, load, remove) and provide it to designer via config as in https://github.com/mulesoft/api-designer#embedding.

Just copy/paste it, use jQuery or AngularJS ($http) to communicate with remote service, and you're done.

brianmc commented 10 years ago

Thanks for that Xaka, most of the work was in the RAML Store API plus I learned a lot about the app from looking at the internals.

I didn't have much luck with the embedding instructions, any chance of some more explicit steps in the ReadMe? Also would be awesome to have the $http code in that sample persistence block.

I'll probably add my persistence API to github and maybe people would find that useful. Right now it matches the remote-file-system interface (/files)

brianmc commented 10 years ago

I have added my raml-store REST API to github at https://github.com/brianmc/raml-store

Also there is a persistence sample which interfaces between the api-designer and this raml-store API: https://github.com/brianmc/raml-store/blob/master/sample-designer.html

I need to add installation instructions and other documentation so I'll do that in the next day or two.

comptly commented 10 years ago

@brianmc this looks awesome. Let me know when you've got the docs up, and we'd be happy to point to this project from the API Designer repo / raml.org / etc!

brianmc commented 10 years ago

Thanks @comptly, I just updated the readme and I think that's a decent cut at the installation/run/test instructions. https://github.com/brianmc/raml-store I ran it today on a clean machine and it was fairly painless. Hopefully this will be useful for folks and drive adoption.

Cheers,

Brian