-
Notifications
You must be signed in to change notification settings - Fork 325
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
Custom walker #841
Comments
@alturkovic This project focuses on validation and is not really suitable for transformations. You may be able to achieve your goal by using walkers, listeners and collectors but I suspect the solution will be quite complicated as you would have to deal with transitions across objects, arrays, properties, items and other schemas. For example, consider this simple refactor of your schema. Your solution would have to take these types of constructs into consideration. I recommend looking for another solution before pursuing this one.
You can find an examples of how to use |
I would not worry about refs since I could always resolve them beforehand and inline all the refs. To be more specific, I am trying to implement something like: https://json-schema-faker.js.org/#gist/1902737e7bef9573af02a3fc49761c13 and this library seemed like a way to go using walkers, but I am not sure if my assumption was correct. I am having difficulties recognizing which property is both required and has the "faker" extension. Would you advise against using this library for such usecase? |
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: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 customfaker
field value. I would like to call something likefaker.fake(input, jsonPointerToName, "name.findName")
.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.The text was updated successfully, but these errors were encountered: