Skip to content

add jsonSchema metadata property #1571

Closed

Description

@ssalbdivad

this would allow a type to be associated with arbitrary JSON schema that would be returned when calling toJsonSchema (or through Standard JSON Schema)

Activity

  1. yamcodes commented on Dec 22, 2025

    @yamcodes
    Contributor

    I can take this if you want to assign me. Correct me if I'm wrong but this looks like a good first "code" type issue, right?

  2. ssalbdivad commented on Dec 22, 2025

    @ssalbdivad
    MemberAuthor

    absolutely- go for it! I would take a look at NodeMeta in ark/schema/shared/declare.ts, which you could add this jsonSchema property to. I guess there are some footguns here, e.g. configure normally applies the config to all shallow nodes, but that would rarely be desirable for JSON Schema as it would lead to misleading results for nested nodes (although those would probably never be seen in the vast majority of cases).

    Also whether jsonSchema should accept some kind of function that would map the inner node to its jsonSchema value so it could be more general? I suppose we could support this in the future and just do the basic version now where the JSON schema provided has to be an actual value.

  3. ssalbdivad commented on Nov 18, 2026

    @ssalbdivad
    MemberAuthor

    Fixed in 3.0.0-beta.0 (#1728). Try it with npm i arktype@next.

  4. moved this from To do to Done (merged or closed) in arktypeioon Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Done (merged or closed)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions