MCPcopy Index your code
hub / github.com/github/copilot-sdk / goDefinitionRefForEquivalentSchema

Function goDefinitionRefForEquivalentSchema

scripts/codegen/go.ts:2142–2156  ·  view source on GitHub ↗
(schema: JSONSchema7, ctx: GoCodegenCtx)

Source from the content-addressed store, hash-verified

2140}
2141
2142function goDefinitionRefForEquivalentSchema(schema: JSONSchema7, ctx: GoCodegenCtx): string | undefined {
2143 const schemaKey = stableStringify(normalizeSchemaForMatch(schema, ctx));
2144 const definitions = {
2145 ...(ctx.definitions?.definitions ?? {}),
2146 ...(ctx.definitions?.$defs ?? {}),
2147 };
2148 for (const [definitionName, definition] of Object.entries(definitions)) {
2149 if (!definition || typeof definition !== "object") continue;
2150 const definitionKey = stableStringify(normalizeSchemaForMatch(definition as JSONSchema7, ctx));
2151 if (definitionKey === schemaKey) {
2152 return `#/definitions/${definitionName}`;
2153 }
2154 }
2155 return undefined;
2156}
2157
2158function goDefinitionName(definitionName: string): string {
2159 return toGoSchemaTypeName(definitionName);

Calls 2

normalizeSchemaForMatchFunction · 0.85
stableStringifyFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…