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

Implement attribute validation #15

Closed
greenstack opened this issue Mar 8, 2022 · 2 comments · Fixed by #16
Closed

Implement attribute validation #15

greenstack opened this issue Mar 8, 2022 · 2 comments · Fixed by #16
Labels
enhancement New feature or request

Comments

@greenstack
Copy link

When building decks, it would be nice to apply validation to certain values:

Some examples include:

  • A card has an elemental type. Since there are limited types, and it would be nice to be able to define what those limitations are.
  • A hero has a health attribute. It would be nice to set a regex that limits that attribute to either a number or another game-specific special symbol.

A simple implementation could be just setting a regex, but I would also like to see creating a list of valid values that could be selected from a dropdown.

A stretch goal could also be allowing attributes to use existing validation criteria (using Pokemon as an example, using the same validation to select both the card's type and weakness).

@hristoiankov hristoiankov added the enhancement New feature or request label Mar 8, 2022
@hristoiankov
Copy link
Contributor

The card attributes actually have a hidden 'type' value for features like this. I'll need to make a list of what those types could be before committing to an implementation. Current ideas: number, text, textarea, enum (what you're proposing). I do also like the regex idea too, it would be the quickest to implement.

@hristoiankov hristoiankov linked a pull request Mar 8, 2022 that will close this issue
@hristoiankov
Copy link
Contributor

hristoiankov commented Mar 8, 2022

This feature is now implemented. When creating attributes, you can choose your attribute type to be 'option'. You can then define the options available to that attribute.

image

In the card editor, there is a dropdown for selecting from the defined options.

image

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

Successfully merging a pull request may close this issue.

2 participants