Skip to content

Validate output data matching expected schema from sources / functions #735

@georgeh0

Description

@georgeh0

Currently, for sources / functions implemented in Rust, since the executor code directly construct values in the generic cocoindex::value::Value type, there's no enforcement to make sure the value type actually matches the schema declared by the executor.

Downstream logic just assumes value's type matching the expected schema. If not true, there can be hard to debug problems. #725 is a recent example.

We want to:

  • For each source / function, validate its returned value matched the declared schema. It should happen within the evaluator. Raise an error with clear message if mismatch.
  • Only do this validation under "cocoindex debug mode". We can let users to set a COCOINDEX_DEBUG environment variable for users to turn on this debug mode.

❤️ Contributors, please refer to 📙Contributing Guide.
Unless the PR can be sent immediately (e.g. just a few lines of code), we recommend you to leave a comment on the issue like I'm working on it or Can I work on this issue? to avoid duplicating work. Our Discord server is always open and friendly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions