occiware / ecore

Ecore meta-model and examples
13 stars 8 forks source link

Generate JavaScript frontend for OCCI extensions #101

Open philippemerle opened 8 years ago

philippemerle commented 8 years ago

The idea is to automatically generate JavaScript/HTML5 frontend for OCCI extensions. 1) generate JavaScript code to interact with an OCCI server. This code will be a kind of stubs hiding technical details of OCCI HTTP interactions. 2) generate HTML5 page with widgets (formular, etc.) which will invoke the generated JavaScript code.

mdutoo commented 8 years ago

Courtesy of wpiers : http://som-research.uoc.edu/tools/emf-rest/ => generates RESTful API & js lib

philippemerle commented 8 years ago

This work could be named jsOCCI: a JavaScript Client-Side API for OCCI. jsOCCI is similar to jOCCI: a Java Client-Side API for OCCI.

mdutoo commented 8 years ago

Swagger can easily allow that : once an API has been described in JSON (swagger spec, see ex. http://malmo.lizenn.net:8080/api-docs/swagger.json ), the swagger-js builds through introspection a Javascript library for this API. Moreover, it can be used by Swagger UI to provide a simple developer playground, and Open Wide plans to use it in its Ozwillo Datacore-inspired OCCI Playground.

So the question is how to describe the OCCI API in the swagger JSON format, especially since it's meta. In erocci, Jean has done it by feeding it the knowledge of its HTTP OCCI engine about routes ( * ). Outside erocci, the OCCIware way would be to write the corresponding generator.

The alternative would be to write a static OCCI swagger spec, i.e. one in which for instance there would be a single parameterized operation /collections/{myKindOrMixin} instead of one per kind and mixin. This difference would then be visible in the swagger js lib and HTML UI, though not in the advanced OCCI Playground. The good news is, it's not an either / or, we can do both (each JSON spec at its own URL) and offer both programming styles to js developers.

( * ) how erocci fills the swagger spec from its routes :