How to config schema like STATSD in my custom plugin?


i want to implement above in my custom plugin.but why like this?

this is my code:

return {
    name = "xh-canary-release",
    fields = {
        { protocols = typedefs.protocols_http }, {
            config = {
                type = "record",
                fields = {
                    {
                        rule_name = {
                            type = "string",
                            required = true,
                        },
                    },
                    {
                        upstream = {
                            type = "string",
                            required = true,
                        },
                    },
                    {
                        service = {
                            type = "string",
                            required = true,
                        },
                    },
                    {
                        ruleType = {
                            type = "boolean",
                            required = true,
                            default = false
                        },
                    },
                    {
                        whitelist = {
                            type = "string",
                            required = false,
                        },
                    },
                    {
                        test = {
                            type = "string",
                            required = true,
                            one_of = {
                                "production",
                                "development",
                            },
                        },
                    },
                    {
                        methods = {
                            type = "array",
                            elements = {
                                type = "string",
                                one_of = METHODS,
                            },
                        },
                    },
                    {
                        rules = {
                            type = "array",
                            elements = {
                                type = "record",
                                fields = {
                                    { parameter_type = { type = "string", required = true, one_of = { "header", "parameter" } }, },
                                    { parameter_name = { type = "string", required = true, }, },
                                    { condition = { type = "string", required = true, one_of = { "=", "<" } }, },
                                    { parameter_value = { type = "string", required = true, }, },
                                },
                            },
                        },
                    },
                },
            },
        },
    },
}

it’s anything wrong?