Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

kzok/practice-static-json-schema-to-typescript

Repository files navigation

practice-static-json-schema-to-typescript

Json Schema to TypeScript conversion in static way. Based on draft 2019-09 core and validation.

Example

const schema = {
  type: "object";
  properties: {
    names: {
      type: "array";
      items: {type: "string"};
    };
  };
  required: ["names"];
} as const;

type ValidatedType = ParseJsonSchema<typeof schema>;
// type ValidatedType = {names: string[]};

Tasks

  • primitive types
  • array
    • items
    • array schema items (typed tuple)
    • additionalItems
  • object
    • properties
    • additionalProperties
  • enum
  • allOf (unneeded?)
  • anyOf
  • oneOf

About

Json Schema to TypeScript conversion in static way.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published