perfsonar / perfsonar/pscompose

Handle custom invalid message when validating forms

Open
#207 3 comments 0 reactions 2 assignees View on GitHub

@jkafader-esnet is already working on this.

Since Jun 2, 2026.

Dominant language
Python
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Currently, I have this

        "slip": {
            "type": "string",
            "title": "Slip",
            'pattern': '^P(?:\\d+(?:\\.\\d+)?W)?(?:\\d+(?:\\.\\d+)?D)?(?:T(?:\\d+(?:\\.\\d+)?H)?(?:\\d+(?:\\.\\d+)?M)?(?:\\d+(?:\\.\\d+)?S)?)?$',
            "description": "ISO 8601 Duration that allows the start of each run to be as much as the Duration later than their ideal scheduled time. Default is 5 minutes (PT5M)",
            "default": "PT5M",
        },

If i want to add a key such as x-invalid-message: "'%s' is not a valid ISO 8601 duration.", the frontend ignores the validation entirely. It's probably because AJV rejects any unknown keywords in strict mode, breaking all validation.

Perhaps, we'll have to update json-forms-esm and do something like

import { createAjv } from "@jsonforms/core";

const handleDefaultsAjv = createAjv({ useDefaults: true });
handleDefaultsAjv.addKeyword({ keyword: "x-invalid-message" });

Doing this, would then allow us to show better invalid messages to the user.

Currently, in the above case, the UI shows

Image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.