in eng/tools/typespec-migration-validation/src/document.ts [221:256]
function processProperty(property: OpenAPI2SchemaProperty): OpenAPI2SchemaProperty {
const newProperty: OpenAPI2SchemaProperty = deepCopy(property);
const isRef = (property as OpenAPI2SchemaRefProperty).$ref !== undefined;
if (isRef) {
const refPath = (property as OpenAPI2SchemaRefProperty).$ref;
if (refPath.startsWith("#/definitions/")) {
const definitionName = refPath.substring("#/definitions/".length);
const originalDefinition = originalDocument?.definitions?.[definitionName];
if (originalDefinition && originalDefinition.enum) {
const processedDefinition = processDefinition(originalDefinition);
for (const key in processedDefinition) {
(newProperty as any)[key] = (processedDefinition as any)[key as string];
}
delete (newProperty as any).$ref;
}
}
} else {
processEnumInplace(newProperty as OpenAPI2Schema);
}
newProperty
if (newProperty["x-ms-mutability"]) {
newProperty["x-ms-mutability"] = newProperty["x-ms-mutability"].sort((a, b) => a.localeCompare(b));
}
if ((newProperty as any)["uniqueItems"] === false) {
delete (newProperty as any)["uniqueItems"];
}
if (configuration.ignoreDescription) {
delete newProperty.description;
if ((newProperty as any).items?.description) {
delete (newProperty as any).items?.description;
}
}
return newProperty;
}