redstone-dart / redstone

A metadata driven microframework for Dart.
http://redstone-dart.github.io/redstone
MIT License
342 stars 42 forks source link

RAML plugin #17

Open seaneagan opened 10 years ago

seaneagan commented 10 years ago

Since redstone allows you to define APIs declaratively using methods, parameters, annotations, etc, it should be possible to generate a RAML doc from those.

Would the plugin API provide the necessary hooks to implement this?

luizmineo commented 10 years ago

This would be a really interesting use of the plugin API. Although, it currently doesn't provide a way to inspect installed routes. I'll try to include this feature in the API for the next release.

seaneagan commented 10 years ago

It'd be nice if the RAML could be generated via a transformer, without having to start an actual server. It would probably require access to the actual MethodMirrors since the methods would need to have some annotations to specify the markdown documentation to put in the RAML doc.

luizmineo commented 10 years ago

I see. But inspecting routes through a transformer will require a different API, since you have to use the analyzer package to inspect the code, instead of the mirror package.

Anyway, I think it will be good to improve the plugin API, since other plugins can create routes dynamically (which is not possible to inspect during compile time).

luizmineo commented 10 years ago

Redstone.dart v0.5.7 now allows plugins to inspect installed routes, interceptors, error handlers and groups. Maybe it's not yet the ideal solution, but you can already use it to build a plugin that generates and publishes an index of your service API.

azenla commented 9 years ago

@seaneagan Is this still relevant? I'm sure @redstone-dart/owners would love to look into this.

oskbor commented 9 years ago

Maybe the https://pub.dartlang.org/packages/rpc package can be used? Its not RAML but fills the same purpose (generating a discovery document)

azenla commented 9 years ago

@oskbor I'll surely look into it.

cgarciae commented 9 years ago

@kaendfinger actually I wanted to propose generating a Discovery Document by adding annotations, maybe for v0.6. @oskbor maybe we could make Redstone's annotations compatible with RPC's method for generating the Discovery Document, that way we don't have to implement it ourselves. I'll post on RPC to see what they think.

seaneagan commented 9 years ago

fyi I posted a similar request for the rpc package. Perhaps code can be shared between the two projects for that.