1

Validation schema

{
  bsonType: 'object',
  required: [
    'text',
    'replaceLinkComponents'
  ],
  properties: {
    text: {
      bsonType: 'string',
      description: 'A introduction text string with replacement pattern \'${}\' that are replaced by replaceLinkComponents'
    },
    replaceLinkComponents: {
      bsonType: 'array',
      items: {
        bsonType: 'object',
        required: [
          'text',
          'link'
        ],
        properties: {
          text: {
            bsonType: 'string'
          },
          link: {
            bsonType: 'string'
          }
        }
      }
    }
  }
}
[
  {
    text: "${}, ${}, and ${} enthusiast with a knack for ${} graduating with a specialization in AI.",
    replaceLinkComponents: [
      { text: "Fullstack Developer", link: "https://github.com/akshaydohroo" },
      { text: "App Developer", link: "https://github.com/akshaydohroo" },
      { text: "Machine Learning", link: "https://www.kaggle.com/akshaydohroo" },
      { text: "problem-solving", link: "https://leetcode.com/akshay23codes/" },
    ],
  },
  {
    text: "Working with my hands to make magic happen on the internet. View my ${}, ${}, ${}, or send me an email at ${}.",
    replaceLinkComponents: [
      { text: "Projects", link: "/projects" },
      {
        text: "Resume",
        link: "/resume",
      },
      {
        text: "Contact Me",
        link: "/contact",
      },
      {
        text: "akshay.dohroo3@gmail.com",
        link: "mailto:akshay.dohroo3@gmail.com",
      },
    ],
  },
]

Error Image

And the worst part is that there is no prompt why my document validation and even mongosh doesnt give me a detailed reason as well, to debug the issue

mongosh error

What is the issue here and is there a better way to do json schema validation?

akshay23codes
  • 19
  • 1
  • 3

0 Answers0