Skip to content
Discussion options

You must be logged in to vote

Here's what I put together, it should cover most basic JSON schemas I think. If I have a problem with it, I'll update this:

json-schema.ts
import { Static, Type } from "@sinclair/typebox";

const { Optional: Maybe } = Type;

export type TypeSchema = Static<typeof TypeSchema>;
export const TypeSchema = Type.Object(
  {
    $schema: Maybe(Type.String({ description: "The JSON Schema" })),
    $id: Maybe(Type.String({ description: "Id for this schema" })),
    title: Maybe(Type.String({ description: "Title of this schema" })),
    description: Maybe(
      Type.String({ description: "Description of this schema" }),
    ),
    default: Maybe(Type.Any({ description: "Default value for this sch…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by waynesbrain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant