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

Issue #627 custom message for format #632

Merged
merged 2 commits into from
Jan 10, 2023
Merged

Conversation

vickyrathod
Copy link
Contributor

No description provided.

@stevehu
Copy link
Contributor

stevehu commented Jan 10, 2023

It looks good to me. It will be very useful for other users. Would you be able to create a document in the doc folder? Thanks.

@vickyrathod
Copy link
Contributor Author

@stevehu I have updated document for custom messages with example and details, please check.

@stevehu stevehu merged commit 2822c69 into networknt:master Jan 10, 2023
@stevehu
Copy link
Contributor

stevehu commented Jan 10, 2023

@vickyrathod Thanks a lot for your help.

@rajivraghu
Copy link

How to specify custom message for required field??

@stevehu
Copy link
Contributor

stevehu commented Jan 12, 2023

I think that is standard. something like field name is required.

@UngeheurenUngeziefer
Copy link

This doesn't work for "required" key, standard message pop up

@stevehu
Copy link
Contributor

stevehu commented May 5, 2023

This keyword doesn't support customized message as it is not necessary.

@noliveleger
Copy link

noliveleger commented Aug 14, 2023

This keyword doesn't support customized message as it is not necessary.

I agree when you have to validate a simple JSON object. But what about nested objects?

This schema:

    {
        "type": "object",
        "required": ["name"],
        "additionalProperties": true,
        "properties": {
            "name": {"type": "string"},
            "foo": {
                "type": "object",
                "uniqueItems": true,
                "properties": {
                    "name": {"type": "string"}
                },
                "required": ["name"],
                "additionalProperties": true
            }
        }
   }

with this JSON (missing name property inside foo)

{
    "name": "lorem",
    "foo": {"bar": "foobar"}
}

The message for the nested name property will be the same as the one at the root level. It would be great to customize it.

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

Successfully merging this pull request may close these issues.

None yet

5 participants