Skip to content

Invalid validation result with bundled schema #82

@ekzobrain

Description

@ekzobrain

Hi. Seems like bundled subschemas are not validated at all. This example:

const schema = compileSchema({
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "1c_list_Document_СборкаЗапасов": {
      "$ref": "1c_list_Document_%D0%A1%D0%B1%D0%BE%D1%80%D0%BA%D0%B0%D0%97%D0%B0%D0%BF%D0%B0%D1%81%D0%BE%D0%B2"
    }
  },
  "required": [
    "1c_list_Document_СборкаЗапасов"
  ],
  "$id": "json-schemer://schema",
  "$defs": {
    "json-schemer://schema/1c_list_Document_%D0%A1%D0%B1%D0%BE%D1%80%D0%BA%D0%B0%D0%97%D0%B0%D0%BF%D0%B0%D1%81%D0%BE%D0%B2": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "properties": {
        "$filter": {
          "type": "string",
          "title": "Фильтр"
        }
      },
      "$id": "json-schemer://schema/1c_list_Document_%D0%A1%D0%B1%D0%BE%D1%80%D0%BA%D0%B0%D0%97%D0%B0%D0%BF%D0%B0%D1%81%D0%BE%D0%B2"
    }
  }
})

const { valid, errors } = schema.validate({
  "1c_list_Document_СборкаЗапасов": 1
});

Should return valid: false and a error stating that "1c_list_Document_СборкаЗапасов" must be object. But it returns success validation result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions