kongplete icon indicating copy to clipboard operation
kongplete copied to clipboard

Allow kong mappers to define predictors

Open andrewbaxter opened this issue 4 years ago • 1 comments

This allows predictors to be tied into Kong's Mappers, which can in turn be automatically attached to fields based on the field type or a type: tag. I didn't see another way to do this in kongplete, it looked like predictor attachment needed to be manually tagged in all cases.

The usage is pretty simple, if you already have a mapper just implement kongplete.PredictorProvider like:

func (_ *MyMapper) Predictor(flag *kong.Flag) complete.Predictor {
    return complete.PredictSet("val1", "val2")
}

andrewbaxter avatar Jun 09 '21 06:06 andrewbaxter

@WillAbides if you have a chance, would you mind taking a look at this?

andrewbaxter avatar Jul 15 '24 12:07 andrewbaxter