Skip to content

Conversation

@Perdolique
Copy link

  • Add important notes about pipe execution for missing keys
  • Explain that default values are required for pipe execution
  • Improve clarity across optional, exactOptional, and guides
  • Enhance understanding of transformation behavior

Copilot AI review requested due to automatic review settings September 11, 2025 18:53
@vercel
Copy link

vercel bot commented Sep 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
valibot Ready Ready Preview Comment Sep 13, 2025 5:36pm

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Sep 11, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR clarifies the behavior of pipe execution when using optional schemas (optional and exactOptional) with missing object keys. The documentation explains that pipe actions only execute when default values are provided or keys are present.

  • Added comprehensive documentation about pipe execution behavior for missing keys
  • Enhanced API documentation for optional and exactOptional schemas with pipe examples
  • Improved clarity around when transformations and other pipe actions execute

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
website/src/routes/guides/(schemas)/optionals/index.mdx Added new section explaining pipe execution behavior with and without default values
website/src/routes/api/(schemas)/optional/index.mdx Added important note and examples showing pipe behavior for missing keys
website/src/routes/api/(schemas)/exactOptional/index.mdx Added similar important note and pipe examples for exact optional schemas

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


With `exactOptional` the validation of your schema will pass missing object entries, and if you specify a `default_` input value, the schema will use it if the object entry is missing. For this reason, the output type may differ from the input type of the schema.

> **Important**: When a key is missing and no `default_` value is provided, the schema's pipe (including transformations) will not be executed. To ensure pipes run for missing keys, provide a `default_` value.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should mention that this is only the cases when using this schema with an object schema. If think this is not clear enough.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabian-hiller, added a couple of words about it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I will take a closer look an merge this PR in the next days.

- Add important notes about pipe execution for missing keys
- Explain that default values are required for pipe execution
- Improve clarity across optional, exactOptional, and guides
- Enhance understanding of transformation behavior
@fabian-hiller
Copy link
Owner

I haven't forgotten you and will probably merge this PR in 1 to 2 weeks. I am currently focused on Formisch a few other things.

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

Labels

documentation Improvements or additions to documentation size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants