Skip to content

add ~standard toJSONSchema support - #1493

Merged
ssalbdivad merged 4 commits into
mainfrom
standard-json-schema-source
Sep 2, 2025
Merged

add ~standard toJSONSchema support#1493
ssalbdivad merged 4 commits into
mainfrom
standard-json-schema-source

Conversation

@ssalbdivad

Copy link
Copy Markdown
Member

No description provided.

@ssalbdivad
ssalbdivad requested a review from Copilot September 2, 2025 20:10

Copilot AI left a comment

Copy link
Copy Markdown

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 ~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 toJSONSchema method
  • 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. */

Copilot AI Sep 2, 2025

Copy link

Choose a reason for hiding this comment

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

The comment contains an invalid character '@'. Should be '/**' followed by the description.

Suggested change
/** @ 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. */

Copilot uses AI. Check for mistakes.
Comment thread ark/schema/roots/root.ts
Comment on lines +102 to +103
if (opts.io === "input") return this.in.toJsonSchema() as never
return this.out.toJsonSchema() as never

Copilot AI Sep 2, 2025

Copy link

Choose a reason for hiding this comment

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

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>.

Suggested change
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>

Copilot uses AI. Check for mistakes.
@ssalbdivad
ssalbdivad merged commit 11d68b9 into main Sep 2, 2025
6 checks passed
@ssalbdivad
ssalbdivad deleted the standard-json-schema-source branch September 2, 2025 21:06
@github-project-automation github-project-automation Bot moved this from To do to Done (merged or closed) in arktypeio Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done (merged or closed)

Development

Successfully merging this pull request may close these issues.

2 participants