Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
raych1 authored May 23, 2022
2 parents e876213 + dff4f11 commit 7e50db4
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 6 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log - oav

## 04/20/2022 2.12.2

- LiveValidator - Get real schema and data while error's schema has allOf property

## 04/20/2022 2.12.1

- Fix bug about copyfiles command during build
Expand Down
7 changes: 6 additions & 1 deletion lib/swaggerValidator/ajvSchemaValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,13 @@ const ReValidateIfNeed = (
};

const shouldSkipError = (error: ErrorObject, cxt: SchemaValidateContext) => {
const { schema, parentSchema: parentSch, params, keyword, data } = error;
const { parentSchema: parentSch, params, keyword } = error;
const parentSchema = parentSch as Schema;
// If schema has allof property, we can get schema in "_realschema", so is data
const schema = Object.keys(error).includes("_realSchema")
? (error as any)._realSchema
: error.schema;
const data = Object.keys(error).includes("_realData") ? (error as any)._realData : error.data;

if (schema?._skipError || parentSchema._skipError) {
return true;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oav",
"version": "2.12.1",
"version": "2.12.2",
"author": {
"name": "Microsoft Corporation",
"email": "[email protected]",
Expand Down
2 changes: 2 additions & 0 deletions test/liveValidation/payloads/dateTime.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@
"validationEnvironment": false,
"ring": null,
"registrationInfo": {
"timeType": "RemindDueDate",
"expirationTime": "2024-02-29T02:33:35",
"remindTime": "2024-01-29T02:33:35",
"token": "a",
"registrationTokenOperation": "Update"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,34 @@
}
}
},
"RemindDueDate": {
"description": "Remind the due date of registration.",
"type": "object",
"allOf": [
{
"$ref": "#/definitions/RegistrationInfo"
}
],
"properties": {
"remindTime": {
"format": "date-time",
"type": "string",
"description": "Remind time of registration due date."
}
},
"x-ms-discriminator-value": "RemindDueDate"
},
"RegistrationInfo": {
"description": "Represents a RegistrationInfo definition.",
"type": "object",
"required": [
"timeType"
],
"properties": {
"timeType": {
"description": "Type of time.",
"type": "string"
},
"expirationTime": {
"format": "date-time",
"type": "string",
Expand All @@ -501,7 +525,8 @@
"description": "The type of resetting the token.",
"x-nullable": false
}
}
},
"discriminator": "timeType"
},
"MigrationRequestProperties": {
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion test/liveValidatorTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ describe("Live Validator", () => {
isPathCaseSensitive: false,
useRelativeSourceLocationUrl: true,
swaggerPathsPattern: [
"specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/*.json",
"specification/date-time/resource-manager/Microsoft.DateTime/test.json",
],
git: {
shouldClone: false,
Expand Down

0 comments on commit 7e50db4

Please sign in to comment.