Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should the regex for deepProperties be improved? #384

Open
jeremycare opened this issue Mar 8, 2023 · 0 comments
Open

Should the regex for deepProperties be improved? #384

jeremycare opened this issue Mar 8, 2023 · 0 comments

Comments

@jeremycare
Copy link

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.

if (/[0-9]+/.test(segment)) {

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant