extendObjectSchema (oomol_console/actions.ts)

open-connector · src/providers/oomol_console/actions.ts · typescript · Apache-2.0
payments

Utility to extend a JSON schema with additional properties and required fields.

// Source: https://github.com/oomol-lab/open-connector | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import type { ProviderActionDefinition } from "../../core/provider-definition.ts";
import type { JsonSchema } from "../../core/types.ts";

import { jsonSchema as s } from "../../core/json-schema.ts";
import { defineProviderAction } from "../../core/provider-definition.ts";

function extendObjectSchema(description: string, base: JsonSchema, properties: Record<string, JsonSchema>): JsonSchema {
  const baseProperties = (base.properties ?? {}) as Record<string, JsonSchema>;
  const baseRequired = Array.isArray(base.required) ? (base.required as string[]) : [];
  return {
    ...base

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key