Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-56207

Return JSON Schema `description` in document validation error message

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • Query Execution 2021-06-14, Query Execution 2021-06-28

      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"]
          }
        ]
      }
      

            Assignee:
            denis.grebennicov@mongodb.com Denis Grebennicov
            Reporter:
            kateryna.kamenieva@mongodb.com Katya Kamenieva
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: