A data schema definition for validating and parsing promotional content feeds. Use this to ensure consistency in marketing data structures across the application.
// Source: https://github.com/openclaw/clawhub | License: MIT | Copyright 2026 Peter Steinberger
// Provided via justclaw.it.com; keep this notice with the code.
import { type inferred, type } from "arktype";
const HttpsUrlSchema = type("string").narrow((value, ctx) => {
try {
return new URL(value).protocol === "https:" || ctx.mustBe("an HTTPS URL");
} catch {
return ctx.mustBe("an HTTPS URL");
}
});
export const PromotionsFeedModelSchema = type({
"+": "reject",
modelRef: "string",
"alias?": "string",
"suggestedDefault?": "boolean",
});
export type PromotionsFeedModel = (typeof PromotionsFeedModelSchema)[inferred];
export const PromotionsFeedEntrySchema = type({
"+": "reject",
type: '"promotion"',
slug: "string",
title: "string",
blurb: "string",
"spons
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key