Skip to content

feat: typed param registry with schema validation#190

Merged
mrhillsman merged 7 commits into
mainfrom
feat/typed-param-registry
Jun 12, 2026
Merged

feat: typed param registry with schema validation#190
mrhillsman merged 7 commits into
mainfrom
feat/typed-param-registry

Conversation

@mrhillsman

@mrhillsman mrhillsman commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replaces 27 ad-hoc private getter methods across 9 workloads with a centralized ParamSchema and a single GetParam method on BaseWorkload
  • Extends Registry to carry param schemas alongside factories via RegistryEntry, enabling ValidateParams (unknown key detection with "did you mean?" suggestions, type checking) and AllParamSchemas (for future CLI help/doc generation)
  • Wires ValidateParams into the orchestrator so invalid params fail fast at deploy time with clear error messages
  • Defines all five standard value types upfront: ParamString, ParamInt, ParamBool, ParamList, ParamDict

Test plan

  • ParamSchema.Find() — known key, unknown key, each type
  • ParamDef.Validate() — all 5 types with positive and negative cases
  • GetParam — nil params, empty params, user values, partial params, empty string falls back to default, panic on unknown key
  • ValidateParams — valid params, empty params, unknown keys, typo suggestions, type mismatches, unknown workload
  • AllParamSchemas — all 9 workloads present with correct param counts
  • Orchestrator rejects invalid params and unknown param keys
  • All existing behavioral tests pass unchanged (242+ specs)
  • go vet and golangci-lint clean

Resolves #188

Introduce ParamType (String, Int, Bool, List, Dict), ParamDef, and
ParamSchema types with per-type validation. Add ParamSchema field and
GetParam method to BaseWorkload so workloads can look up param values
against a declared schema with defaults.

Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
Replace 27 private getter methods across 9 workloads with GetParam
calls backed by per-workload ParamSchema declarations. Each workload
now declares an exported XxxParamSchema var and sets it on the embedded
BaseWorkload in its constructor.

Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
Change Registry from map[string]WorkloadFactory to
map[string]RegistryEntry, pairing each factory with its ParamSchema.
Add ValidateParams (rejects unknown keys with "did you mean?"
suggestions, validates values against declared types) and
AllParamSchemas (enables future CLI help and doc generation).

Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
Wire ValidateParams in the orchestrator before workload construction
so invalid param keys and type-mismatched values produce clear errors
instead of silently falling through to defaults.

Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
@exe-prow-github-app exe-prow-github-app Bot requested a review from OchiengEd June 12, 2026 17:03
@exe-prow-github-app

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mrhillsman

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@exe-prow-github-app exe-prow-github-app Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 12, 2026
@mrhillsman mrhillsman removed the request for review from OchiengEd June 12, 2026 17:07
@mrhillsman mrhillsman merged commit d35a2d1 into main Jun 12, 2026
3 of 4 checks passed
@mrhillsman mrhillsman deleted the feat/typed-param-registry branch June 15, 2026 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. related-to/workloads

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Typed param registry with schema validation

1 participant