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

Enable extended validations #2231

Open
justjam2013 opened this issue Nov 5, 2024 · 4 comments
Open

Enable extended validations #2231

justjam2013 opened this issue Nov 5, 2024 · 4 comments

Comments

@justjam2013
Copy link
Contributor

justjam2013 commented Nov 5, 2024

Feature Description

Add support for the following vocabulary to support extended validation of arrays:
https://docs.json-everything.net/schema/vocabs/array-ext/

Specifically the ability to validate that a uuid field is unique across items in an array

Update: json-everything is implemented in C# only, so would not be usable in homebridge-config-ui-x

@justjam2013
Copy link
Contributor Author

justjam2013 commented Nov 5, 2024

ajv keywords is a Typescript validator that provides uniqueItemProperties, which allows specifying that a field value is unique across items in an array.

Update: according to package-lock.json, ajv-keywords is an included node module. However the following did not work:

      "devices": {
        "type": "array",
        "uniqueItemProperties": [ "id" ],
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
            }
          }
        }
      }

Assigning two items the same id, the form still showed the green checkmark and the Save button was enabled even with "strictValidation": true

@justjam2013 justjam2013 changed the title Add Vocabulary for Extended Validation of Arrays Enable extended validations Nov 5, 2024
@justjam2013
Copy link
Contributor Author

Extending ticket to suggest enabling the use of ajv-keywords, like uniqueItemProperties and dynamicDefaults.

Copy link

github-actions bot commented Dec 6, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Dec 6, 2024
@justjam2013
Copy link
Contributor Author

Keeping this open.

@github-actions github-actions bot removed the stale label Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant