schema2typebox
Version:
Creates typebox code from JSON schemas
50 lines • 2.8 kB
JavaScript
;
/**
* ATTENTION. This code was AUTO GENERATED by schema2typebox.
* While I don't know your use case, there is a high chance that direct changes
* to this file get lost. Consider making changes to the underlying JSON schema
* you use to generate this file instead. The default file is called
* "schema.json", perhaps have a look there! :]
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DayOfWeek = void 0;
const typebox_1 = require("@sinclair/typebox");
const value_1 = require("@sinclair/typebox/value");
typebox_1.TypeRegistry.Set("ExtendedOneOf", (schema, value) => 1 ===
schema.oneOf.reduce((acc, schema) => acc + (value_1.Value.Check(schema, value) ? 1 : 0), 0));
const OneOf = (oneOf, options = {}) => typebox_1.Type.Unsafe({
...options,
[typebox_1.Kind]: "ExtendedOneOf",
oneOf,
});
exports.DayOfWeek = OneOf([
typebox_1.Type.Literal("Friday", {
description: "The day of the week between Thursday and Saturday.",
}),
typebox_1.Type.Literal("Monday", {
description: "The day of the week between Sunday and Tuesday.",
}),
typebox_1.Type.Literal("PublicHolidays", {
description: 'This stands for any day that is a public holiday; it is a placeholder for all official public holidays in some particular location. While not technically a "day of the week", it can be used with [[OpeningHoursSpecification]]. In the context of an opening hours specification it can be used to indicate opening hours on public holidays, overriding general opening hours for the day of the week on which a public holiday occurs.',
}),
typebox_1.Type.Literal("Saturday", {
description: "The day of the week between Friday and Sunday.",
}),
typebox_1.Type.Literal("Sunday", {
description: "The day of the week between Saturday and Monday.",
}),
typebox_1.Type.Literal("Thursday", {
description: "The day of the week between Wednesday and Friday.",
}),
typebox_1.Type.Literal("Tuesday", {
description: "The day of the week between Monday and Wednesday.",
}),
typebox_1.Type.Literal("Wednesday", {
description: "The day of the week between Tuesday and Thursday.",
}),
], {
$schema: "https://json-schema.org/draft/2020-12/schema",
$id: "schema:DayOfWeek",
description: "The day of the week, e.g. used to specify to which day the opening hours of an OpeningHoursSpecification refer.\n\nOriginally, URLs from [GoodRelations](http://purl.org/goodrelations/v1) were used (for [[Monday]], [[Tuesday]], [[Wednesday]], [[Thursday]], [[Friday]], [[Saturday]], [[Sunday]] plus a special entry for [[PublicHolidays]]); these have now been integrated directly into schema.org.\n ",
});
//# sourceMappingURL=dayOfWeek.js.map