-
Hello, Does someone know how to convert the following definition ? boot_device_order_list:
description: >
Indicates the order of device types in which VM
should try to boot from. If boot device order is
not provided the system will decide appropriate
boot device order.
items:
type: string
x-ntnx-enum:
- CDROM
- DISK
- NETWORK
type: array I have tried the following naive approach: values: "CDROM" | "DISK" | "NETWORK"
#boot_device_order_list: [...values]
#boot_device_order_list & ["CDROM"]
//conflicting values ["CDROM"] and {values:("CDROM"|"DISK"|"NETWORK"),#boot_device_order_list:[...values],(#boot_device_order_list & ["CDROM"])} (mismatched types list and struct):
-:1:1
-:3:27 Also please note that the list size must be 1=< and =<3 . Each enum value can only be used once. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
This is a little bit closer to what I am looking for. But unfortunately, the known issue is preventing me to ensure no duplicates... #boot_order_list: [ _,_,_ & =~ "CDROM|DISK|NETWORK"] |
Beta Was this translation helpful? Give feedback.
-
Maybe convert the list values to struct keys and assert the length still matches? |
Beta Was this translation helpful? Give feedback.
-
Maybe even easier is the builtin https://cuelang.org/docs/howto/use-list-uniqueitems-as-a-field-validator/ |
Beta Was this translation helpful? Give feedback.
Maybe something like this; I wrapped it as a "function pattern":
https://cuelang.org/play/?id=n4JYFMOSe49#w=function&i=cue&f=eval&o=cue