Skip to content

Conversation

@pmilliotte
Copy link
Collaborator

Description 🦫

Add optional validation of an event input, and implement input validation for ZodEventTypes

Type of change 📝

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested? 🧑‍🔬

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration: 🔧

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist: ✅

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@pmilliotte pmilliotte marked this pull request as draft December 1, 2023 13:50
@pmilliotte pmilliotte changed the title Validate input feature: validate event input Dec 1, 2023
@github-actions github-actions bot added the minor label Dec 1, 2023
@github-actions github-actions bot added minor and removed minor labels Dec 1, 2023
@oxc
Copy link

oxc commented Oct 14, 2025

If this is ever going to be picked up, please consider allowing the validate method to also return a Promise. At least for standard-schema support it would be extremely helpful if async results were supported out of the box, and would not have to be handled by throwing an exception.

Given that validateEventDetail is called in pushEvent which is async anyway, this should hopefully not a major issue. (Not sure how well it would work with groupEvent, which does not yet seem to be considered in this draft... 😟)

EDIT: In standard-schema, the validate method is defined like this:

    readonly validate: (
      value: unknown
    ) => Result<Output> | Promise<Result<Output>>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants