Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom metadata to Ottoman models #166

Closed
FabriceReynolds opened this issue Mar 15, 2017 · 1 comment
Closed

Add custom metadata to Ottoman models #166

FabriceReynolds opened this issue Mar 15, 2017 · 1 comment
Assignees
Labels
enhancement P3 Nice to Have

Comments

@FabriceReynolds
Copy link

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 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 removed.

Cheers,

Fabrice

@gsi-alejandro
Copy link
Collaborator

It's something good to have.

We will do some work-around and provide a way to do this.

@AV25242 AV25242 added the P3 Nice to Have label Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement P3 Nice to Have
Projects
None yet
Development

No branches or pull requests

4 participants