cognitect-labs / vase

Data driven microservices
Eclipse Public License 1.0
375 stars 41 forks source link

There should be better handling for multiple descriptors #11

Closed ohpauleez closed 8 years ago

ohpauleez commented 8 years ago

The top-level Vase API supports multiple descriptors to be into the main functions. This is nice for end-users because it's common to break large descriptors down into smaller, cohesive descriptors.

Currently those functions map over the descriptors individually, but Vase injects routes and other artifacts when processing descriptors (routes like the describe route used to reflect the APIs back out to the user for discovery/docs). Injecting the reflection capabilities should be a separate function called from the top-level API after process routes. Additionally, in the new format, it's cleaner to merge Descriptor subsections (norms, specs, apis) -- the top-level functions should merge descriptor subsections when processing them, instead of mapping over descriptors individually.

ohpauleez commented 8 years ago

I just landed some potential fixes on master; We should reevaluate this.

ordnungswidrig commented 8 years ago

@ohpauleez any chance to have the commits reference the github issues? This would make it easier to follow along.

ohpauleez commented 8 years ago

aac2d75ac5ddaef07ed7d85c3850ede2c72b04ac

ordnungswidrig commented 8 years ago

https://github.com/cognitect-labs/vase/commit/aac2d75ac5ddaef07ed7d85c3850ede2c72b04ac#diff-3ccc7ee0d66a7ac4f495ddde20024936R20 I would recommend to make a decision about the arity of the argument. In my experience, a function that accepts an item or a list of items leads to confusion over time.

ohpauleez commented 8 years ago

The entire top-level API consumes spec-or-specs. There is exactly one function for each part of a full api-spec (schema/norms, specs, routes/api). Everything below this layer consumes exactly one spec.

ohpauleez commented 8 years ago

Landed on master