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

Function resolveRef

scripts/codegen/utils.ts:1029–1040  ·  view source on GitHub ↗
(
    ref: string,
    definitions: DefinitionCollections | undefined
)

Source from the content-addressed store, hash-verified

1027
1028/** Resolve a `$ref` path against a definitions map, returning the referenced schema. */
1029export function resolveRef(
1030 ref: string,
1031 definitions: DefinitionCollections | undefined
1032): JSONSchema7 | undefined {
1033 const match = ref.match(/^#\/(definitions|\$defs)\/(.+)$/);
1034 if (!match || !definitions) return undefined;
1035 const [, namespace, key] = match;
1036 const primary = namespace === "$defs" ? definitions.$defs : definitions.definitions;
1037 const fallback = namespace === "$defs" ? definitions.definitions : definitions.$defs;
1038 const def = primary?.[key] ?? fallback?.[key];
1039 return typeof def === "object" ? (def as JSONSchema7) : undefined;
1040}
1041
1042export function resolveSchema(
1043 schema: JSONSchema7 | null | undefined,

Callers 10

tryEmitRustUnionFunction · 0.70
resolveRustTypeFunction · 0.70
getVariantSchemaFunction · 0.70
resolveRpcTypeFunction · 0.70
resolveSchemaFunction · 0.70
visitDefinitionFunction · 0.70
resolveGoPropertyTypeFunction · 0.70
resolveGoUnionMemberFunction · 0.70
goUnionFieldNameFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…