[DOCS-14761] Investigate changes in SERVER-56207: Return JSON Schema `description` in document validation error message Created: 25/Aug/21  Updated: 13/Nov/23  Resolved: 22/Sep/21

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 5.1.0-rc0, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113

Type: Task Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Jeffrey Allen
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-56207 Return JSON Schema `description` in d... Closed
Participants:
Days since reply: 2 years, 20 weeks ago
Epic Link: DOCSP-14300
Story Points: 3

 Description   
Downstream Change Summary

If a document fails validation and JSON Schema is used in the validator, we will now include the "description" field as part of the error message. Users can now use "description" to include a human-friendly explanation of what the schema is intended to enforce.

Flagging documentation changes as potentially needed in case some examples in the docs need updating with this change.

Description of Linked Ticket

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 Githook User [ 22/Sep/21 ]

Author:

{'name': 'Jeff Allen', 'email': 'jeffrey.allen@10gen.com', 'username': 'jeff-allen-mongo'}

Message: (DOCS-14761): Validation failures include description
Branch: master
https://github.com/mongodb/docs/commit/db12978933e489be4dcec8df398872ae03204ca3

Comment by PM Bot [ 25/Aug/21 ]

Downstream changes updated for upstream SERVER-56207:
If a document fails validation and JSON Schema is used in the validator, we will now include the "description" field as part of the error message. Users can now use "description" to include a human-friendly explanation of what the schema is intended to enforce.

Flagging documentation changes as potentially needed in case some examples in the docs need updating with this change.

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