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

[Question] How to create rule so that some fields can depend on other(s)? #31

Open
JeremieBergeron opened this issue Oct 24, 2024 · 0 comments

Comments

@JeremieBergeron
Copy link

Is there a way to create a rule so that some fields can depend on each other?
For example, if c=10, then b is a random number and a is regex="[a-zA-Z]THE_B_VARIABLE[a-zA-Z]"?

If it isn't possible to create this kinds of rules, is it possible to generate some random values for the field d, but not for a, b and c? I tried to add a arg.properties that doesn't specify a value for the d column, but it doesn't work;

{
    "namespace": "datagen.example",
    "name": "users",
    "type": "record",
    "fields": [
        {
            "name": "a",
            "type": "string"
        },
        {
            "name": "b",
            "type": "int"
        },
        {
            "name": "c",
            "type": "int"
        },
        {
            "name": "d",
            "type": {
                "type": "string",
                "arg.properties": {
                    "regex": "[1-9][0-9]",
                    "length": 2
                }
            }
        }
    ],
    "arg.properties": {
        "options": [
            {
                "a": "XXX20XXX",
                "b": 20,
                "c": 10
            },
            {
                "a": "XXX25XXX",
                "b": 25,
                "c": 10
            },
            {
                "a": "QWERTY",
                "b": 90978,
                "c": 6
            }
        ]
    }
}
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

1 participant