Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
docs: support additionalProperties in tool schema rendering
Schemas using additionalProperties (e.g. JIRA_GET_ISSUE_CREATE_METADATA's FieldMetadata map) were silently dropped, rendering as empty "object" types. Now they display as [key: string] entries with full nested structure, matching the fumadocs-openapi convention. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sushmitha Mallesh committed
Mar 18, 2026 at 11:31 UTC
fb161d26400fb82ebed4dfc4679a36a1481c18ec
5 files changed
+92
-34
docs/app/llms.mdx/[[...slug]]/route.ts
+36
-13
@@ -137,6 +137,7 @@ interface OpenAPISchema {
137
maximum?: number;
138
minLength?: number;
139
maxLength?: number;
140
+ additionalProperties?: OpenAPISchema | boolean;
141
}
142
143
interface OpenAPIParameter {
@@ -221,8 +222,14 @@ function generateSampleValue(schema: OpenAPISchema, depth = 0): unknown {
222
for (const [key, prop] of Object.entries(schema.properties)) {
223
obj[key] = generateSampleValue(prop, depth + 1);
224
}
225
+ if (schema.additionalProperties && typeof schema.additionalProperties === 'object') {
226
+ obj['key'] = generateSampleValue(schema.additionalProperties, depth + 1);
227
+ }
228
return obj;
229
}
230
+ if (schema.additionalProperties && typeof schema.additionalProperties === 'object') {
231
+ return { key: generateSampleValue(schema.additionalProperties, depth + 1) };
232
+ }
233
return {};
234
default:
235
return null;
@@ -237,21 +244,37 @@ function renderSchema(schema: OpenAPISchema, indent = 0, maxDepth = 4): string[]
244
const prefix = ' '.repeat(indent);
245
const required = schema.required || [];
246
240
- if (schema.type === 'object' && schema.properties) {
241
- for (const [name, prop] of Object.entries(schema.properties)) {
242
- const isRequired = required.includes(name);
243
- const reqMark = isRequired ? ' *(required)*' : '';
244
- const typeStr = getTypeString(prop);
245
- const desc = prop.description ? `: ${prop.description}` : '';
246
-
247
- lines.push(`${prefix}- \`${name}\` (${typeStr})${reqMark}${desc}`);
247
+ if (schema.type === 'object' && (schema.properties || (schema.additionalProperties && typeof schema.additionalProperties === 'object'))) {
248
+ if (schema.properties) {
249
+ for (const [name, prop] of Object.entries(schema.properties)) {
250
+ const isRequired = required.includes(name);
251
+ const reqMark = isRequired ? ' *(required)*' : '';
252
+ const typeStr = getTypeString(prop);
253
+ const desc = prop.description ? `: ${prop.description}` : '';
254
+
255
+ lines.push(`${prefix}- \`${name}\` (${typeStr})${reqMark}${desc}`);
256
+
257
+ // Recurse for nested objects/arrays
258
+ if (prop.type === 'object' && (prop.properties || (prop.additionalProperties && typeof prop.additionalProperties === 'object'))) {
259
+ lines.push(...renderSchema(prop, indent + 1, maxDepth));
260
+ } else if (prop.type === 'array' && prop.items?.type === 'object' && (prop.items.properties || (prop.items.additionalProperties && typeof prop.items.additionalProperties === 'object'))) {
261
+ lines.push(`${prefix} - Array items:`);
262
+ lines.push(...renderSchema(prop.items, indent + 2, maxDepth));
263
+ }
264
+ }
265
+ }
266
249
- // Recurse for nested objects/arrays
250
- if (prop.type === 'object' && prop.properties) {
251
- lines.push(...renderSchema(prop, indent + 1, maxDepth));
252
- } else if (prop.type === 'array' && prop.items?.type === 'object' && prop.items.properties) {
267
+ // Render additionalProperties as [key: string]
268
+ if (schema.additionalProperties && typeof schema.additionalProperties === 'object') {
269
+ const ap = schema.additionalProperties;
270
+ const typeStr = getTypeString(ap);
271
+ const desc = ap.description ? `: ${ap.description}` : '';
272
+ lines.push(`${prefix}- \`[key: string]\` (${typeStr})${desc}`);
273
+ if (ap.type === 'object' && (ap.properties || (ap.additionalProperties && typeof ap.additionalProperties === 'object'))) {
274
+ lines.push(...renderSchema(ap, indent + 1, maxDepth));
275
+ } else if (ap.type === 'array' && ap.items?.type === 'object' && ap.items.properties) {
276
lines.push(`${prefix} - Array items:`);
254
- lines.push(...renderSchema(prop.items, indent + 2, maxDepth));
277
+ lines.push(...renderSchema(ap.items, indent + 2, maxDepth));
278
}
279
}
280
} else if (schema.oneOf || schema.anyOf) {
docs/components/schema-generator.tsx
+23
-9
@@ -175,16 +175,30 @@ export function generateSchemaData(
175
}
176
}
177
178
- // Handle object
179
- if ((schema.type === 'object' || schema.properties) && schema.properties) {
178
+ // Handle object (with properties and/or additionalProperties)
179
+ if ((schema.type === 'object' || schema.properties) && (schema.properties || (schema.additionalProperties && typeof schema.additionalProperties === 'object'))) {
180
const required = schema.required || [];
181
- const props = Object.entries(schema.properties)
182
- .filter(([_, propSchema]) => isVisible(propSchema))
183
- .map(([name, propSchema]) => ({
184
- name,
185
- $type: processSchema(propSchema as SimpleSchema),
186
- required: required.includes(name),
187
- }));
181
+ const props: { name: string; $type: string; required: boolean }[] = [];
182
+
183
+ if (schema.properties) {
184
+ for (const [name, propSchema] of Object.entries(schema.properties)) {
185
+ if (!isVisible(propSchema)) continue;
186
+ props.push({
187
+ name,
188
+ $type: processSchema(propSchema as SimpleSchema),
189
+ required: required.includes(name),
190
+ });
191
+ }
192
+ }
193
+
194
+ // Include additionalProperties as a synthetic [key: string] entry
195
+ if (schema.additionalProperties && typeof schema.additionalProperties === 'object') {
196
+ props.push({
197
+ name: '[key: string]',
198
+ $type: processSchema(schema.additionalProperties),
199
+ required: false,
200
+ });
201
+ }
202
203
refs[id] = {
204
...base,
docs/components/toolkits/toolkit-detail.tsx
+28
-12
@@ -64,25 +64,41 @@ function formatType(param: ParameterSchema): string {
64
return typeStr;
65
}
66
67
-// Get children from a param (object properties or array item properties)
67
+// Get children from a param (object properties, array item properties, or additionalProperties)
68
function getChildren(param: ParameterSchema): Record<string, ParameterSchema> | null {
69
const props = param.properties || param.items?.properties;
70
- if (!props || typeof props !== 'object') return null;
70
+ const additionalProps = param.additionalProperties || param.items?.additionalProperties;
71
+
72
+ if ((!props || typeof props !== 'object') && (!additionalProps || typeof additionalProps !== 'object')) return null;
73
74
const requiredList: string[] = param.requiredFields || param.items?.requiredFields || [];
75
const result: Record<string, ParameterSchema> = {};
74
- for (const [key, value] of Object.entries(props)) {
75
- if (typeof value === 'object' && value !== null) {
76
- const raw = value as ParameterSchema & { required?: string[] | boolean };
77
- result[key] = {
78
- ...raw,
79
- required: Array.isArray(requiredList) ? requiredList.includes(key) : false,
80
- // Map the child's own JSON Schema required array to requiredFields
81
- // so that deeper nesting levels preserve required info
82
- ...(Array.isArray(raw.required) ? { requiredFields: raw.required } : {}),
83
- };
76
+
77
+ if (props && typeof props === 'object') {
78
+ for (const [key, value] of Object.entries(props)) {
79
+ if (typeof value === 'object' && value !== null) {
80
+ const raw = value as ParameterSchema & { required?: string[] | boolean };
81
+ result[key] = {
82
+ ...raw,
83
+ required: Array.isArray(requiredList) ? requiredList.includes(key) : false,
84
+ // Map the child's own JSON Schema required array to requiredFields
85
+ // so that deeper nesting levels preserve required info
86
+ ...(Array.isArray(raw.required) ? { requiredFields: raw.required } : {}),
87
+ };
88
+ }
89
}
90
}
91
+
92
+ // Include additionalProperties as a synthetic [key: string] entry
93
+ if (additionalProps && typeof additionalProps === 'object') {
94
+ const raw = additionalProps as ParameterSchema & { required?: string[] | boolean };
95
+ result['[key: string]'] = {
96
+ ...raw,
97
+ required: false,
98
+ ...(Array.isArray(raw.required) ? { requiredFields: raw.required } : {}),
99
+ };
100
+ }
101
+
102
return Object.keys(result).length > 0 ? result : null;
103
}
104
docs/lib/toolkit-schema.ts
+3
@@ -21,6 +21,9 @@ function processParams(props: any, requiredList: string[]): Record<string, Param
21
...param.items,
22
...(Array.isArray(param.items.required) ? { requiredFields: param.items.required } : {}),
23
} } : {}),
24
+ ...(param.additionalProperties && typeof param.additionalProperties === 'object'
25
+ ? { additionalProperties: param.additionalProperties }
26
+ : {}),
27
};
28
}
29
}
docs/types/toolkit.ts
+2
@@ -12,6 +12,8 @@ export interface ParameterSchema {
12
requiredFields?: string[];
13
// Array item schema
14
items?: ParameterSchema;
15
+ // Additional properties schema (for map/dictionary types)
16
+ additionalProperties?: ParameterSchema | boolean;
17
}
18
19
export interface Tool {