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

Function selectSessionEventEnvelopePropertySchema

scripts/codegen/utils.ts:1198–1207  ·  view source on GitHub ↗
(propertySchemas: JSONSchema7[])

Source from the content-addressed store, hash-verified

1196}
1197
1198function selectSessionEventEnvelopePropertySchema(propertySchemas: JSONSchema7[]): JSONSchema7 {
1199 // Some variants further constrain a shared envelope property, e.g. ephemeral const true.
1200 // Generate the base property from the least restrictive schema that has useful metadata.
1201 return (
1202 propertySchemas.find((schema) => !isConstOrEnumSchema(schema) && schema.description) ??
1203 propertySchemas.find((schema) => !isConstOrEnumSchema(schema)) ??
1204 propertySchemas.find((schema) => schema.description) ??
1205 propertySchemas[0]
1206 );
1207}
1208
1209function isConstOrEnumSchema(schema: JSONSchema7): boolean {
1210 return "const" in schema || (Array.isArray(schema.enum) && schema.enum.length > 0);

Calls 1

isConstOrEnumSchemaFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…