(targetDefs: JsonObject, name: string, definition: unknown)
| 136 | } |
| 137 | |
| 138 | function mergeDefinition(targetDefs: JsonObject, name: string, definition: unknown): void { |
| 139 | const existing = targetDefs[name]; |
| 140 | if (existing === undefined) { |
| 141 | targetDefs[name] = definition; |
| 142 | return; |
| 143 | } |
| 144 | |
| 145 | if (stableStringify(existing) !== stableStringify(definition)) { |
| 146 | throw new Error( |
| 147 | `Conflicting local $defs entry while bundling structured output schema: ${name}`, |
| 148 | ); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | function bundleSchema(rootSchema: JsonObject, commonSchema: JsonObject): JsonObject { |
| 153 | if (typeof rootSchema.$id !== 'string' || rootSchema.$id.length === 0) { |
no test coverage detected