MULTI schema handling

This commit is contained in:
2026-06-19 20:03:23 +05:30
parent 9a80a52fd5
commit f5bc7adc37
2 changed files with 9 additions and 2 deletions

View File

@@ -62,5 +62,9 @@ export function ListCellRenderer({ field, value, displayFormat }: ListCellProps)
return <Chip label={value ? "Yes" : "No"} size="small" color={value ? "success" : "default"} />;
}
if (typeof value === "object") {
return <Typography variant="body2">{applyDisplayFormat(value, displayFormat ?? "")}</Typography>;
}
return <Typography variant="body2">{String(value)}</Typography>;
}

View File

@@ -13,12 +13,15 @@ export function extractFields(schemaName: string, schema: any, schemas: Record<s
.map(([name, prop]: [string, any]) => {
const isDirectRef = !!prop.$ref;
const isItemsRef = prop.type === "array" && !!prop.items?.$ref;
const isRef = isDirectRef || isItemsRef;
const isOneOf = !!prop.oneOf;
const isRef = isDirectRef || isItemsRef || isOneOf;
const refSchemaName = isDirectRef
? resolveRef(prop.$ref)
: isItemsRef
? resolveRef(prop.items.$ref)
: isOneOf && prop.oneOf[0]?.$ref
? resolveRef(prop.oneOf[0].$ref)
: undefined;
const refSchema = refSchemaName ? schemas[refSchemaName] : undefined;
@@ -31,7 +34,7 @@ export function extractFields(schemaName: string, schema: any, schemas: Record<s
name,
label: prop["x-label"],
description: prop["x-description"] ?? prop["x-label"] ?? name,
type: isRef && refSchema ? "object" : (prop.type ?? "string"),
type: isRef && refSchema ? "object" : isOneOf ? "object" : (prop.type ?? "string"),
format: prop.format,
order: prop["x-order"],
hidden: prop["x-hidden"] ?? {},