Skip to content
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.

[Question] Can I add a label or comment to one property? #374

Closed
MaxGeorgeBlack opened this issue Aug 6, 2019 · 4 comments
Closed

[Question] Can I add a label or comment to one property? #374

MaxGeorgeBlack opened this issue Aug 6, 2019 · 4 comments
Labels

Comments

@MaxGeorgeBlack
Copy link

In mongoose, I write one property with a label
name: { type: String, label: 'Customer name', max: 50, optional: true, },

But it seems that "label" is not supported in typegoose. Any solutions or ideas?

@hasezoey
Copy link
Contributor

hasezoey commented Aug 6, 2019

could you provide a link where mongoose documents this?

@mfulop
Copy link

mfulop commented Aug 6, 2019

Some plugins like mongoose-schema-jsonschema are using extra properties defined on the options object, and it makes sense to me as well.
@MaxGeorgeBlack I simply extended the PropOptions declaration to allow this:

// field with custom schema option
// add custom schema option to PropOptions
declare module 'typegoose/lib/prop' {
  interface PropOptions {
    customSchemaOption?: string
  }
}

@mfulop
Copy link

mfulop commented Aug 7, 2019

@hasezoey for this reason I recommend keeping the current way of forwarding the whole provided PropOptions object to mongoose and I would also either document how to extend the declaration or add [k:string]: any to the PropOptions declaration

@hasezoey
Copy link
Contributor

hasezoey commented Aug 7, 2019

add [k:string]: any to the PropOptions declaration

will be added into 6.0.0 :)

hasezoey referenced this issue in typegoose/typegoose Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants