Don't generate examples for `password` with a random string (#1042)
* generate a single known string for password related fields
This commit is contained in:
Родитель
4b59d8e0ff
Коммит
d24383eb55
|
@ -1,5 +1,9 @@
|
|||
# Change Log - oav
|
||||
|
||||
## 07/12/2024 3.4.0
|
||||
|
||||
- During example generation, fields `password`, `adminPassword`, and `pwd` are all generated with a single value of "<a-password-goes-here>" instead of random characters.
|
||||
|
||||
## 06/17/2024 3.3.8
|
||||
|
||||
- Remove suppression of `additionalProperties` errors when `isArmCall === true`. (ARM liveValidation scenarios)
|
||||
|
|
|
@ -29,10 +29,16 @@ export default class Mocker {
|
|||
}
|
||||
|
||||
private generateString(paramSpec: any, paramName: string) {
|
||||
const pwdParams = ["password", "pwd", "adminPassword"];
|
||||
|
||||
if (paramSpec.name === "subscriptionId") {
|
||||
return uuid.v4().toUpperCase();
|
||||
}
|
||||
|
||||
if (pwdParams.includes(paramName)) {
|
||||
return "<a-password-goes-here>";
|
||||
}
|
||||
|
||||
if (paramSpec.format === "date") {
|
||||
return new Date().toISOString().split("T")[0];
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "oav",
|
||||
"version": "3.3.7",
|
||||
"version": "3.4.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "oav",
|
||||
"version": "3.3.7",
|
||||
"version": "3.4.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@apidevtools/swagger-parser": "10.0.3",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "oav",
|
||||
"version": "3.3.8",
|
||||
"version": "3.4.0",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation",
|
||||
"email": "azsdkteam@microsoft.com",
|
||||
|
|
|
@ -1071,7 +1071,7 @@ describe("Live Validator", () => {
|
|||
const result = await liveValidator.validateLiveRequestResponse(payload);
|
||||
|
||||
assert.strictEqual(result.responseValidationResult.errors.length, 1);
|
||||
assert.strictEqual(result.responseValidationResult.errors[0].code, "INVALID_TYPE")
|
||||
assert.strictEqual(result.responseValidationResult.errors[0].code, "INVALID_TYPE");
|
||||
assert.strictEqual(result.responseValidationResult.isSuccessful, false);
|
||||
assert.strictEqual(result.requestValidationResult.isSuccessful, true);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче