Migrate to ms-rest-js dependency (#995)

* Migrate to ms-rest-js dependency
* Update to new headers
* update changelog to mention of removal of ms-rest dependency in favor of @azure/ms-rest-js

---------

Co-authored-by: Scott Beddall <scbedd@microsoft.com>
This commit is contained in:
Jared Stein 2024-02-23 14:12:49 -06:00 коммит произвёл GitHub
Родитель 186bb06af3
Коммит 377354862e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
6 изменённых файлов: 402 добавлений и 505 удалений

Просмотреть файл

@ -3,6 +3,7 @@
## 02/12/2024 3.3.3
- #1014 Set armId format validation to always enabled, but allow suppression of errors when `isArmCall` validator argument is set to `false`. Update the special casing on additionalProperties validation. This error was was erroneously skipping validation validation error when isArmCall is set to `true`. This value is _defaulted_ to `true` when used for `Model Validation` and `Semantic Validation`.
- #995 Remove `ms-rest` dependency in favor of newer `@azure/ms-rest-js`
## 01/29/2024 3.3.2

Просмотреть файл

@ -2,8 +2,8 @@
// Licensed under the MIT License. See License.txt in the project root for license information.
import { URL } from "url";
import { mapEntries, MutableStringMap } from "@azure-tools/openapi-tools-common";
import * as msRest from "ms-rest";
import { MutableStringMap } from "@azure-tools/openapi-tools-common";
import * as msRest from "@azure/ms-rest-js";
export type Headers = MutableStringMap<string | undefined>;
@ -44,8 +44,8 @@ export class HttpTemplate {
result += `\n${padding}-H 'Content-Length: ${JSON.stringify(this.request.body).length}' \\`;
}
if (this.request.headers) {
for (const [headerName, header] of mapEntries(this.request.headers)) {
result += `\n${padding}-H '${headerName}: ${header}' \\`;
for (var header of this.request.headers.headersArray()) {
result += `\n${padding}-H '${header.name}: ${header.value}' \\`;
}
}
return result;

Просмотреть файл

@ -45,11 +45,11 @@ export class MarkdownHttpTemplate extends HttpTemplate {
result += `Content-Length: ${JSON.stringify(this.request.body).length}\n`;
}
if (this.request.headers) {
const headers = toArray(keys(this.request.headers));
const headers = this.request.headers.headersArray();
for (let i = 0; i < headers.length; i++) {
const headerName = headers[i];
result += `${headerName}: ${this.request.headers[headerName]}`;
const headerName = headers[i].name;
result += `${headerName}: ${headers[i].value}`;
if (i !== headers.length - 1) {
result += `\n`;
}

Просмотреть файл

@ -45,11 +45,11 @@ export class YamlHttpTemplate extends HttpTemplate {
result += ` Content-Length: ${JSON.stringify(this.request.body).length}\n`;
}
if (this.request.headers) {
const headers = toArray(keys(this.request.headers));
const headers = this.request.headers.headersArray();
for (let i = 0; i < headers.length; i++) {
const headerName = headers[i];
result += ` ${headerName}: ${this.request.headers[headerName]}`;
const headerName = headers[i].name;
result += ` ${headerName}: ${headers[i].value}`;
if (i !== headers.length - 1) {
result += `\n`;
}

884
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -13,6 +13,7 @@
"@autorest/schemas": "^1.3.4",
"@azure-tools/openapi-tools-common": "^1.2.2",
"@azure/core-http": "^3.0.1",
"@azure/ms-rest-js": "^2.7.0",
"@azure/openapi-markdown": "^0.9.4",
"@ts-common/commonmark-to-markdown": "^2.0.2",
"ajv": "^6.12.6",
@ -34,7 +35,6 @@
"md5-file": "^5.0.0",
"mkdirp": "^1.0.4",
"moment": "^2.29.3",
"ms-rest": "^2.5.6",
"mustache": "^4.2.0",
"newman": "^5.3.2",
"path-to-regexp": "^6.2.1",