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

Support errorMessage so as to customise validation errors #371

Open
jobinkavalam opened this issue Nov 30, 2023 · 0 comments
Open

Support errorMessage so as to customise validation errors #371

jobinkavalam opened this issue Nov 30, 2023 · 0 comments

Comments

@jobinkavalam
Copy link

Currently, the following schema definition,

        {
          "type": "string",
          "pattern": "^\\d+$"
        }

is expected to give errors such as:

Does not match pattern '^\d+$'

Clearly, in the given context a more friendlier message can be used.

Implementations such as ajv support this feature through the errorMessage field, i.e.

        {
          "type": "string",
          "pattern": "^\\d+$",
          "errorMessage": "should be a number"
        }

It will be great to have gojsonschema support that.

Also really appreciate if there is a better alternative to achieve this in gojsonschema.

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

1 participant