tdegrunt / jsonschema

JSON Schema validation
Other
1.83k stars 263 forks source link

Deeper arrays are not being validated #377

Closed Khanon closed 2 years ago

Khanon commented 2 years ago

Hello, second level arrays are not being validated:

Schema:

{
      type: 'object',
      required: ['id', 'name', 'richText', 'plainText', 'parameters', 'attachments'],
      properties: {
        id: { type: 'number' },
        name: { type: 'string' },
        richText: { type: 'string' },
        plainText: { type: 'string' },
        parameters: {
          type: 'array',
          items: {
            type: 'object',
            required: ['label', 'type'],
            properties: {
              label: { type: 'string' },
              type: { type: 'string' },
            }
          }
        },
        attachments: {
          type: 'array',
          items: {
            type: 'object',
            required: ['codeMappingKey', 'fileName', 'contentType', 'blob'],
            properties: {
              codeMappingKey: { type: 'string' },
              fileName: { type: 'string' },
              contentType: { type: 'string' },
              blob: { type: 'string' }
            }
          }
        }
      }
    }

parameters and attachments arrays data types and requirements are not being validated, no error is thrown.

Khanon commented 2 years ago

Sorry it was a mistake in my json. I don't find the way to remove the issue.