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

[BUG] New implementation of "nullable" decreases the accuracy of ajv errors. #2751

Closed
Bugslive opened this issue Jul 15, 2024 · 4 comments · Fixed by #2752
Closed

[BUG] New implementation of "nullable" decreases the accuracy of ajv errors. #2751

Bugslive opened this issue Jul 15, 2024 · 4 comments · Fixed by #2752
Assignees

Comments

@Bugslive
Copy link

Describe the bug

The new implementation of "Nullable" prevents the developer/API client to capitalize on the AJV errors as all possible format validation errors are returned.

To Reproduce

  1. Fetch https://github.com/Bugslive/nullable
  2. Install package with npm install
  3. Start the app with npm start
  4. Send POST request to http://127.0.0.1:8083/rest/nullable with body {"name": "toto", "description": "aaaaaaaaaaaa"}
  5. Observe the answer and especially the number of errors (3 errors).
  6. Compare with error with v7.75.3

Expected behavior

The expected number of error is 1, and error to be:
{
"instancePath": "/description",
"schemaPath": "#/properties/description/maxLength",
"keyword": "maxLength",
"params": {
"limit": 10
},
"message": "must NOT have more than 10 characters",
"data": "aaaaaaaaaaaa",
"modelName": "ExampleModel",
"dataPath": ".description",
"requestPath": "body"
}

Code snippets

No response

Repository URL example

https://github.com/Bugslive/nullable

OS

macOS

Node version

Node v22.4.1

Library version

v7.75.4

Additional context

No response

@Romakita
Copy link
Collaborator

Doesn't seems to be a bug @Bugslive

Ajv returns errors according to the applied schema. Before the previous fix, the schema was totally wrongs. So if ajv return more errors, but errors are consistent isn't an issue but the expected behavior!

Copy link

🎉 Are you happy?

If you appreciated the support, know that it is free and is carried out on personal time ;)

A support, even a little bit makes a difference for me and continues to bring you answers!

github opencollective

1 similar comment
Copy link

🎉 Are you happy?

If you appreciated the support, know that it is free and is carried out on personal time ;)

A support, even a little bit makes a difference for me and continues to bring you answers!

github opencollective

@Romakita
Copy link
Collaborator

🎉 This issue has been resolved in version 7.75.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants