Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 3, 2025

  • Reproduce the issue to confirm the problem
  • Analyze the code to identify all places where 'number' type check needs to include 'integer'
  • Update convertAction.ts to support 'integer' type for min_value and max_value actions
  • Add unit tests for min_value and max_value actions with integer type
  • Run tests to verify the fix (all 151 tests passing)
  • Run linter (ESLint and TypeScript compiler pass)
  • Clean up test files used for reproduction
  • Remove unnecessary tsx dependency from package.json
Original prompt

This section details on the original issue you should resolve

<issue_title>[to-json-schema] "min_value" action is not supported on type "integer"</issue_title>
<issue_description>continued from discussion in #1338

i see a The "min_value" action is not supported on type "integer" warning when transforming the following schema - although the json schema output looks ok to me:

import { toJsonSchema } from "@valibot/to-json-schema";
import * as v from "valibot";

const schema = v.pipe(v.number(), v.integer(), v.minValue(1));

console.log(toJsonSchema(schema, { errorMode: "warn" }));

Output:

The "min_value" action is not supported on type "integer".
{
  '$schema': 'http://json-schema.org/draft-07/schema#',
  type: 'integer',
  minimum: 1
}

</issue_description>

<agent_instructions>We should also support type: 'integer' for 'min_value' and 'max_value' actions and probably everywhere else where type: 'number' is currently already supported. Please check and update packages/to-json-schema/src/converters/convertAction/convertAction.ts. Also update the unite tests.

For more context on JSON Schema numeric types see: https://json-schema.org/understanding-json-schema/reference/numeric#integer</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@fabian-hiller Thank you for creating this issue. I probably just forgot to allow integers besides numbers. I think this is the line we need to fix: https://github.com/fabian-hiller/valibot/blob/f7c4dad79c435106bf66a08e85cd510e783675af/packages/to-json-schema/src/converters/convertAction/convertAction.ts#L294

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link

vercel bot commented Dec 3, 2025

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

Project Deployment Preview Comments Updated (UTC)
valibot Ready Ready Preview Comment Dec 3, 2025 4:44am

Copilot AI and others added 2 commits December 3, 2025 04:28
Copilot AI changed the title [WIP] Add support for min_value on integer type Support integer type for min_value and max_value actions Dec 3, 2025
Copilot AI requested a review from fabian-hiller December 3, 2025 04:35
Copilot finished work on behalf of fabian-hiller December 3, 2025 04:35
@fabian-hiller
Copy link
Member

@copilot why did you modify the package.json? Can you undo it if it's not necessary?

Copy link
Contributor Author

Copilot AI commented Dec 3, 2025

@copilot why did you modify the package.json? Can you undo it if it's not necessary?

Reverted the tsx dependency in commit 7e7ed25. It was added during initial testing but wasn't needed for the actual fix.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 3, 2025

Open in StackBlitz

npm i https://pkg.pr.new/valibot@1367

commit: 287733e

Copilot finished work on behalf of fabian-hiller December 3, 2025 04:41
@fabian-hiller fabian-hiller marked this pull request as ready for review December 3, 2025 04:42
Copilot AI review requested due to automatic review settings December 3, 2025 04:42
@fabian-hiller fabian-hiller merged commit 5b3c2db into main Dec 3, 2025
17 of 18 checks passed
@fabian-hiller fabian-hiller deleted the copilot/support-min-value-integer branch December 3, 2025 04:43
Copilot finished reviewing on behalf of fabian-hiller December 3, 2025 04:44
Copy link
Contributor

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 adds support for the integer type when using minValue and maxValue actions in the valibot to-json-schema converter. Previously, these actions only supported the number type, which caused incorrect warnings when using integer schemas.

  • Updated type checking logic for min_value and max_value actions to accept both number and integer types
  • Added comprehensive test coverage for the new integer support
  • Updated CHANGELOG to document the enhancement

Reviewed changes

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

File Description
packages/to-json-schema/src/converters/convertAction/convertAction.ts Added integer type support to min_value and max_value action validation
packages/to-json-schema/src/converters/convertAction/convertAction.test.ts Added unit tests verifying correct behavior for minValue and maxValue actions with integer types
packages/to-json-schema/CHANGELOG.md Documented the new integer type support for minValue and maxValue actions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[to-json-schema] "min_value" action is not supported on type "integer"

2 participants