diff --git a/ChangeLog.md b/ChangeLog.md index 41a6c82a..15c6daba 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -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 "" instead of random characters. + ## 06/17/2024 3.3.8 - Remove suppression of `additionalProperties` errors when `isArmCall === true`. (ARM liveValidation scenarios) diff --git a/lib/generator/mocker.ts b/lib/generator/mocker.ts index 41de610e..399a0a73 100644 --- a/lib/generator/mocker.ts +++ b/lib/generator/mocker.ts @@ -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 ""; + } + if (paramSpec.format === "date") { return new Date().toISOString().split("T")[0]; } diff --git a/package-lock.json b/package-lock.json index e9520ef1..1f3ef3ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 5997b2db..6cb3f8f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oav", - "version": "3.3.8", + "version": "3.4.0", "author": { "name": "Microsoft Corporation", "email": "azsdkteam@microsoft.com", diff --git a/test/liveValidatorTests.ts b/test/liveValidatorTests.ts index 10721979..2f3a9f78 100644 --- a/test/liveValidatorTests.ts +++ b/test/liveValidatorTests.ts @@ -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); });