Skip to content

patternProperties not working #153

@phhoef

Description

@phhoef

Hi,

I am trying to validate a quite simple schema, but I've problems and probably it's related to my setup.
I am using Svelte 5 in a Wails3 project.

This is my CodeMirror instance in a component.

<CodeMirror
  value={mapping}
  on:change={onChange}
  class="flex-1 w-full"
  lineWrapping
  theme={$mode === "dark" ? oneDark : undefined}
  extensions={[
    jsonSchema(schema),
  ]}
/>

And this is my schema definition:

export const schema: JSONSchema7 = {
    type: "object",
    patternProperties: {
      "^[1-9]\d*$": {
        type: "array",
        items: {
          type: "object",
          properties: {
            doc: { type: "integer", minimum: 1 },
            after: { type: "integer", minimum: 1 },
            blank: { type: "boolean" }
          },
          required: ["doc"],
          additionalProperties: false
        }
      }
    },
    additionalProperties: false
  };

I do not get any errors.
Image

The properties must be numbers starting from 1.
Can please someone give me some guidance?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions