Skip to content

feat(framework): align FactoryFunc signature with EPP (json.RawMessage → *json.Decoder) #293

Description

@szedan-rh

Parent

Sub-issue of #221

Summary

Align IPP's FactoryFunc signature with EPP's to use *json.Decoder instead of json.RawMessage, enabling strict parameter parsing via DisallowUnknownFields.

Context

This is independent of the CycleState → request attributes migration (#288) and can be done in parallel.

Current (IPP):

type FactoryFunc func(name string, parameters json.RawMessage, handle Handle) (Plugin, error)

Target (EPP):

type FactoryFunc func(name string, parameters *json.Decoder, handle Handle) (Plugin, error)

Changes

1. Import FactoryFunc and StrictDecoder from EPP

  • Add FactoryFunc = eppplugin.FactoryFunc type alias in epp.go (same pattern as Phase 1)
  • Import StrictDecoder from EPP (converts json.RawMessage → strict *json.Decoder)

2. Update all plugin factory implementations

  • Change json.Unmarshal(rawParameters, &config) to rawParameters.Decode(&config)
  • Handle nil decoder (no parameters) instead of len(rawParameters) == 0
  • All 15 in-tree factories in cmd/runner/runner.go need updating

3. Update config loader

  • Use StrictDecoder at the call site where raw config parameters are passed to factories

Acceptance criteria

  • FactoryFunc imported from EPP via type alias
  • All plugin factories use *json.Decoder parameter
  • StrictDecoder used at config loading call site
  • Unknown fields in plugin config now cause errors (strict parsing)
  • make test passes
  • make lint passes

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions