Skip to content

Commit

Permalink
split schema json and error message to different code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
ori-shalom authored Jan 9, 2023
1 parent 0285151 commit 4dcec35
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func arrayUniqueItemsChecker(items []interface{}) bool {

By default, the error message returned when validating a value includes the error reason, the schema, and the input value.

For example, using the following schema and input value `secret` would produce the following error message:
For example, given the following schema:

```json
{
Expand All @@ -216,16 +216,17 @@ For example, using the following schema and input value `secret` would produce t
]
}

// Error Message:
Passing the input value `"secret"` to this schema will produce the following error message:

// string doesn't match the regular expression "[A-Z]"
// Schema:
// {
// "pattern": "[A-Z]"
// }
//
// Value:
// "secret"
```
string doesn't match the regular expression "[A-Z]"
Schema:
{
"pattern": "[A-Z]"
}

Value:
"secret"
```
Including the original value in the error message can be helpful for debugging, but it may not be appropriate for sensitive information such as secrets.
Expand Down

0 comments on commit 4dcec35

Please sign in to comment.