ajv-keywords icon indicating copy to clipboard operation
ajv-keywords copied to clipboard

Should the regex for deepProperties be improved?

Open jeremycare opened this issue 1 year ago • 0 comments

Hi,

I open this issue because deepProperties doesn't work with keys that have numbers in them.

const schema = {
  type: 'object',
  deepProperties: {
    '/audio.2.0/requireForced': {
      const: true,
    },
  },
};

this produces the following error:

Error: schema is invalid: data/allOf/0/items must be object,boolean, data/allOf/0/items must be object,boolean, data/allOf/0/items must be object,boolean, data/allOf/0/items must be object,boolean, data/allOf/0/items must be object,boolean, data/allOf/0/items must be object,boolean, data/allOf/0/items must be object,boolean, data/allOf/0/items must be object,boolean

After my research, I've seen that this is due to this line in the deepProperties getSchema function.

https://github.com/ajv-validator/ajv-keywords/blob/a11389b4d1934d360fb2a24dd920ec597295c8fc/src/definitions/deepProperties.ts#L33

This raises multiples questions to me:

  1. is it compliant with the JSON Schema standard to have numbers part of string fields? (I wasn't able to properly find a answer for that)
  2. Is this project maintained? (I've seen that the last commit was 2 years ago.) 2.1 if yes -> Is a PR welcome to update that? 2.2 if no -> If it's not maintained anymore I can probably fork it and modify it for ourselves. And not bother you more (sorry for the Issue)

jeremycare avatar Mar 08 '23 20:03 jeremycare