Skip to content

Custom walker #841

@alturkovic

Description

@alturkovic

I am a bit confused by the walk functionality and how to implement it...

I want to walk the following schema to detect which properties have non-standard faker field:

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "faker": "name.findName"
    },
    "email": {
      "type": "string"
    }
  }
}

How would I implement a JsonSchemaWalker to detect such fields?

For the payload below, I would like to pass the value of the name from the input object together with my custom faker field value. I would like to call something like faker.fake(input, jsonPointerToName, "name.findName").

{
  "name": "John Doe",
  "email": "john.doe@gmail.com"
}

This seems similar to "Applying defaults" functionality already present in the library, but instead of applying defaults, I would like to pass the current value of the field, where it is located at (so I can replace it), and the value of the faker field so I know how to generate its replacement.

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