UNPKG

@autorest/openapi-to-cadl

Version:

Autorest plugin to scaffold a Typespec definition from an OpenAPI document

23 lines 952 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addCorePageAlias = void 0; function addCorePageAlias(cadlObject) { var _a; if (!((_a = cadlObject.decorators) === null || _a === void 0 ? void 0 : _a.some((d) => d.name === "pagedResult"))) { return; } const value = cadlObject.properties.filter((p) => p.name === "value"); if (!cadlObject.properties.some((p) => p.name === "nextLink") || !value.length) { return; } cadlObject.decorators = cadlObject.decorators.filter((d) => d.name !== "pagedResult"); cadlObject.properties = cadlObject.properties.filter((p) => p.name !== "nextLink" && p.name !== "value"); cadlObject.alias = { alias: "Azure.Core.Page", params: [value[0].type.replace("[]", "")], module: "@azure-tools/typespec-azure-core", }; return; } exports.addCorePageAlias = addCorePageAlias; //# sourceMappingURL=alias.js.map