ya-json-schema-types
v1.0.1
Published
TypeScript types for JSONSchema 2020-12
Downloads
1,256
Readme
ya-json-schema-types
TypeScript types for JSONSchema 2020-12
JSONSchema 2020-12 types for TypeScript with a focus on detecting syntax errors for a better developer experience.
import { type JSONSchema } from "ya-json-schema-types";
const mySchema: JSONSchema = {
type: "string",
};
Also export an alternative type for convenience allowing to create more expressive types for clarity and schemas that allow proper TypeScript types generation.
import { type ExpressiveJSONSchema } from "ya-json-schema-types";
// This still works
const mySchema: ExpressiveJSONSchema = {
type: "string",
};
// This is not considered "expressive"
const myComposedSchema: ExpressiveJSONSchema = {
$ref: "aRef",
type: "string",
anyof: [
{
const: "test",
},
{
const: true,
},
],
};