[SERVER-56207] Return JSON Schema `description` in document validation error message Created: 20/Apr/21  Updated: 29/Oct/23  Resolved: 25/Jun/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Katya Kamenieva Assignee: Denis Grebennicov
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
is documented by DOCS-14761 Investigate changes in SERVER-56207: ... Closed
Backwards Compatibility: Fully Compatible
Sprint: Query Execution 2021-06-14, Query Execution 2021-06-28
Participants:

 Description   

It would be nice to return the description that the user included in the JSON schema, as it may help understand the business logic behind the rule in cases where there's a complex regex or some other non-obvious restrictions.

Example:

{
  "$jsonSchema": {
    "bsonType": "object",
    "properties": {
      "localization": {
        "bsonType": "object",
        "additionalProperties": false,
        "patternProperties": {
          "^description_(es|de|fr)+$": {
            "bsonType": "string"
          }
        },
        "description": "Currently only Spanish, German and French are supported."
      }
    }
  }
}

Error:

{
  "propertyName": "localization",
  "details": [
    {
      "operatorName": "additionalProperties",
      "specifiedAs": {
        "additionalProperties": false
      },
      "additionalProperties": ["description_cz"]
    }
  ]
}



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 25/Jun/21 ]

Author:

{'name': 'Denis Grebennicov', 'email': 'denis.grebennicov@mongodb.com', 'username': 'denis631'}

Message: SERVER-56207 Return JSON Schema `description` in document validation error message
Branch: master
https://github.com/mongodb/mongo/commit/5100e995dfc1bd729d73e25b53007cfd3dc5c6f1

Generated at Thu Feb 08 05:38:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.