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

Traverse non-standard paths. #462

Open
caschbre opened this issue May 6, 2022 · 1 comment
Open

Traverse non-standard paths. #462

caschbre opened this issue May 6, 2022 · 1 comment

Comments

@caschbre
Copy link

caschbre commented May 6, 2022

Is your feature request related to a problem? Please describe.

From what I could see, traverse only goes down the 'properties' path. However if I were to setup a sibling node (e.g. x-foobar), I'm unable to traverse down that path.

const mySchema = {
  title: "baz",
  type: "object",
  properties: {
    foo: {
      title: "foo",
      type: "array",
      items: { type: "string" }
    },
    bar: {
      title: "bar",
      anyOf: [
        { title: "stringerific", type: "string" },
        { title: "numberoo", type: "number" }
      ]
    }
  },
  "x-foobar": {
    haz: { bar: "foo" }
  }
};

Describe the solution you'd like

Ability to traverse down any path in the schema.

@BelfordZ
Copy link
Member

BelfordZ commented Oct 7, 2022

Thanks @caschbre for the issue. Would love to work this in as an option.

What do you think about a constructor option:

interface customSubschemaPath: JSONPath | JSON-Pointer | regex

or maybe we should accept a JSON schema that extends the meta-schema

{
  type: "object",
  patternProperties: {
    "x-*": {
      properties: { $ref: `https://meta.json-schema.tools/` }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants