Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions library/agent/api-discovery/getDataSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ export function getDataSchema(data: unknown, depth = 0): DataSchema {
}
propertiesCount++;
if (Object.prototype.hasOwnProperty.call(data, key)) {
schema.properties![key] = getDataSchema(
(data as { [index: string]: unknown })[key],
depth + 1
);
if (!["__proto__", "constructor", "prototype"].includes(key)) {
schema.properties![key] = getDataSchema(
(data as { [index: string]: unknown })[key],
depth + 1
);
}
}
}
}
Expand Down
10 changes: 6 additions & 4 deletions library/agent/api-discovery/mergeDataSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ export function mergeDataSchemas(first: DataSchema, second: DataSchema) {

for (const key in second.properties) {
if (result.properties[key]) {
result.properties[key] = mergeDataSchemas(
result.properties[key],
second.properties[key]
);
if (!["__proto__", "constructor", "prototype"].includes(key)) {
result.properties[key] = mergeDataSchemas(
result.properties[key],
second.properties[key]
);
}
} else {
result.properties[key] = second.properties[key];
// If a property is not in the first schema, we can assume it is optional
Expand Down
Loading