Skip to content

Extending schemas? #23

@alturkovic

Description

@alturkovic

Is it possible to write our own schemas to extend the current definitions? For an example, there is a https://json-schema-faker.js.org/ project that allows users to define "faker" value for their properties. An example of such schema is:

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "faker": "name.findName"
    },
    "email": {
      "type": "string",
      "faker": "internet.email"
    }
  },
  "required": [
    "name",
    "email"
  ]
}

json-sKema will parse all properties except "faker" since it is not a registered keyword. I would like to write my own FakerSchema and extend the SchemaVisitor to allow visiting the new schemas.

Is something like this possible with the library?

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