Ottoman feature request, model metadata

This is probably not the right place to ask for this so please point me in the right direction.

It would be useful to be able to add metadata to the Ottoman models so that they can be read by introspection and allow for metadata programming. For example; If I create a model and then try and add ‘hint’ and ‘required’ properties:

const test = ottoman.model("Test", {
       foo: {type:'string', hint:'This is a required foo object', required:true}
})

Introspecting the model I get the following fields

[ SchemaField {
    name: 'foo',
    type: CoreType(string),
    readonly: false,
    default: undefined,
    validator: undefined },
  SchemaField {
    name: '_id',
    type: CoreType(string),
    readonly: true,
    default: [Function: autogenUuid],
    validator: undefined } ]

The extra properties of foo are ignored.

Cheers,

Fabrice

Hey @f.reynolds,

Definitely not the wrong place to post this! It would be ideal however if you could file an issue on the project so we can better keep track: https://github.com/couchbaselabs/node-ottoman/issues. Being able to store meta-data with a model is an interesting idea which I had not considered. The main reason why you loose that information currently is that we store the model information in an optimal internal structure, it seems reasonable to consider this as a possible future feature though, so please file an issue!

Cheers, Brett

Hi Brett,

I’ve posted the issues as suggested: https://github.com/couchbaselabs/node-ottoman/issues/166

Cheers,

Fabrice