@canard/schema-form
Version:
React-based component library that renders forms based on JSON Schema with plugin system support for validators and UI components
18 lines (17 loc) • 714 B
TypeScript
import { ENHANCED_KEY } from '../../../../../app/constants';
import type { JsonSchema } from '../../../../../types';
/**
* Processes a oneOf schema by adding an enhanced key property that tracks the selected variant.
* This allows the form system to know which oneOf option is currently active.
*
* @param schema - The partial JSON Schema to process
* @param variant - The index of the selected oneOf variant
* @returns The schema merged with an enhanced key property containing the variant index
*/
export declare const processOneOfSchema: (schema: Partial<JsonSchema>, variant: number) => Partial<JsonSchema> & {
properties: {
[ENHANCED_KEY]: {
const: number;
};
};
};