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

Unable to use "string" in enum as a value #38

Open
MQ-xz opened this issue Oct 6, 2023 · 2 comments
Open

Unable to use "string" in enum as a value #38

MQ-xz opened this issue Oct 6, 2023 · 2 comments

Comments

@MQ-xz
Copy link

MQ-xz commented Oct 6, 2023

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 MQ-xz changed the title Unable to user "string" in as enum value Unable to use "string" in as enum value Oct 6, 2023
@MQ-xz MQ-xz changed the title Unable to use "string" in as enum value Unable to use "string" in enum as a value Oct 6, 2023
@GrantBirki
Copy link
Owner

@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?

@MQ-xz
Copy link
Author

MQ-xz commented Oct 30, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants