Skip to content

Implement parameter validation framework #5313

@ravi-kumar-pilla

Description

@ravi-kumar-pilla

Description

Implement native parameter validation + typed instantiation in Kedro core, following the consolidated validation framework design. The core deliverable is that accessing context.params performs fail-fast validation and (when applicable) returns typed objects (e.g., Pydantic models / dataclasses) rather than raw dicts.

Context

The KEP proposes a validation framework integrated at the context level (KedroContext.params as the entry point), orchestrated by ParameterValidator, which:

  1. Merges config parameters with runtime params
  2. Discovers required types from pipeline node signatures via TypeExtractor + source filters
  3. Instantiates typed objects via ModelFactory
  4. Caches results for performance.

Possible Implementation

1. Context integration

  • Implement _get_validated_params() (or equivalent) and wire it to KedroContext.params as described in the KEP
  • Add a cache keyed by environment + runtime params hash (or a safe equivalent) so repeated context.params calls are cheap.

2. Type discovery

  • Implement TypeExtractor to walk the active pipeline(s) and inspect node function signatures + annotations.
  • Use a SourceFilter abstraction; in this ticket, focus on the ParameterFilter path (datasets can be added in future).

3. Model instantiation

  • Implement ModelFactory to support:
    • Pydantic models when installed (optional dependency).
    • Python dataclasses.
    • Fallback behavior: if no type requirement exists, return raw values untouched.
  • Provide clear errors via custom exceptions (e.g., a specialized ValidationError that includes param path + expected type + source node info).

Draft implementation - https://github.com/kedro-org/kedro/tree/test/validate_no_hook/kedro/framework/validation

Possible Alternatives

NA

Metadata

Metadata

Labels

Issue: Feature RequestNew feature or improvement to existing feature

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions