json-yaml-validate
json-yaml-validate copied to clipboard
Unable to use "string" in enum as a value
Schema
args:
- name:
type: string
required: true
description:
type: string
required:
type: boolean
type:
type: string
enum: ["string", "url", "domain", "path", "status", "ip", "list"]
yml code
args:
- description:
name: domain
required: false
type: string
error got
| {
| "file": "xxx/xxx.yml",
| "errors": [
| {
| "path": "args.0.type",
| "message": "args.0.type must be either function String() { [native code] }, url, domain, path, status, ip or list."
| }
| ]
| },
@MQ-xz Could it be due to the fact that your type
is named type
? What if you change your top level type
value to something like kind:
? Perhaps that would rule out the potential for a conflict on that keyword?
I don't think so, since when removing the string from enum it's working fine. Also look at that error message. the string shows like a function ("String()") as an option in it.
Also I think the issue is only raised when we use a string as a type.