add ~standard toJSONSchema support - #1493
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for the ~standard toJSONSchema functionality, implementing the StandardJSONSchemaSourceV1 specification. This enables arktype schemas to be converted to JSON Schema format according to the standardschema.dev spec.
- Implements the StandardJSONSchemaSourceV1 interface with a
toJSONSchemamethod - Updates version numbers across packages for a new release
- Adds comprehensive test coverage for the new JSON Schema conversion functionality
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ark/schema/shared/standardSchema.ts | Defines the StandardJSONSchemaSourceV1 interface and types |
| ark/schema/roots/root.ts | Implements the toJSONSchema method in BaseRoot class |
| ark/type/tests/standardSchema.test.ts | Adds test coverage for toJSONSchema functionality |
| ark/type/CHANGELOG.md | Documents the new feature in the changelog |
| Various package.json files | Version bumps for the new release |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| /** The options for the ~toJSONSchema method. */ | ||
| export interface Options { | ||
| /** @ Specifies whether the generated JSON Schema should reflect the expected input or output values. */ |
There was a problem hiding this comment.
The comment contains an invalid character '@'. Should be '/**' followed by the description.
| /** @ Specifies whether the generated JSON Schema should reflect the expected input or output values. */ | |
| /** Specifies whether the generated JSON Schema should reflect the expected input or output values. */ |
| if (opts.io === "input") return this.in.toJsonSchema() as never | ||
| return this.out.toJsonSchema() as never |
There was a problem hiding this comment.
Using as never type assertions hides potential type mismatches. Consider returning the proper type or using a more specific type assertion that matches the expected return type Record<string, unknown>.
| if (opts.io === "input") return this.in.toJsonSchema() as never | |
| return this.out.toJsonSchema() as never | |
| if (opts.io === "input") return this.in.toJsonSchema() as Record<string, unknown> | |
| return this.out.toJsonSchema() as Record<string, unknown> |
No description provided.