Skip to content

specta-jsonschema: Exported schemas drop type info that specta-typescript preserves #491

@xpepermint

Description

@xpepermint

specta-jsonschema 0.0.3 loses information from the source specta::DataType in three places:

  1. Primitives (String, i32, bool, …) are emitted as $ref to a definition with an empty body {}. A consumer can't tell a String field from one of unknown type.

  2. Generic parameters are stripped. A Vec<T> field becomes a $ref to a Vec definition that is also {} — the element type is gone.

  3. /// doc comments on struct fields are not emitted as description. Only the root-schema description (set via the builder) makes it into the output.

specta-typescript renders the same DataType tree correctly — primitives become string / number / boolean, Vec<T> becomes T[], and doc comments turn into JSDoc — so the information exists in specta; it just isn't carried into the JSON Schema output.

#ref

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions