plugins icon indicating copy to clipboard operation
plugins copied to clipboard

testing plugin: syntax error in ScenarioRunner code

Open xeger opened this issue 4 weeks ago • 0 comments

I have an endpoint in my bff service that returns ArrayOf(AccessControl) and we're generating the following:

// callValidator calls the user-specified validator function.
// The validator function must be defined in the test package.
func (r *ScenarioRunner) callValidator(t *testing.T, method string, result any, expect Expectation) {
        // For each validator found in YAML, we generate a direct call
        // Users must define these functions in their test files

        validatorName := expect.Validator
        _ = validatorName // avoid unused variable in case no validators are defined

        switch method {
        case "get_application_config":
                typedResult := result.(*bff.ApplicationConfig)
                _ = typedResult // no validators defined in YAML
                t.Errorf("validator %!q(MISSING) specified but not generated - add it to scenarios.yaml first", validatorName)
        case "get_access_control":
                typedResult := result.(*bff.[]*AccessControl)

Of course, *bff.[]AccessControl is wrong .. seems like []*bff.AccessControl is what's needed in this case.

Similar to #206 (likely the same root cause applies) but with a different call site.

xeger avatar Dec 23 '25 00:12 xeger