简体   繁体   中英

Retrieving ENUMS from a field of a model in LoopBack.io?

So given a model in loopback, containing a field (for example) "fruits" with enum value ["apple", "banana", "pear"]. Is there a loopback method I can use to retrieve the enum values of this particular model which I can then later use in let's say a front end application?

I assume that you are using @property({jsonSchema}) to define the enums. If you're using a code generator to generate front-end code based on your app's openapi.json file, the code generator may do this for you. I use @openapitools/openapi-generator-cli and it does. Do you need access to the enums in loopback code?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM