timbunce / WebAPI-DBIC

A composable RESTful JSON API to DBIx::Class schemas using roles and Web::Machine. PLEASE NOTE This module is no longer under active development. If you're interested in helping to develop or maintain it please fork it.
26 stars 10 forks source link

Generate Resource classes as .pm files to enable reuse #19

Open ungrim97 opened 9 years ago

ungrim97 commented 9 years ago

Currently all resources are created in memory as Web::Machine subclasses. There should likely be a Schema::Loader style option to output these for future use/modification into a specific directory.

So for a DBIC Schema: MyApp/Schema/Result/Artist

There would be a corresponding MyApp//Resource/Artist MyApp//ResourceSet/Artist

These could likely also provide some override features such as url path etc.

WAPID should then load all modules in this directory and create the required Dir assuming ResourceSet to be an extension of Resource with required defaults.

This should have the added side effect of reducing start up time in WAPID, though adding a "Load on the fly" option is probably desirable.

Relates to #18.

ungrim97 commented 9 years ago

Resource classes should:

Sensible defaults should be provided in the base class based on existsing behaviour