* Fixed nullable value bug

Avoid adding nullable value for parameter when its' type isn't string.
This commit is contained in:
Ray Chen 2020-05-25 17:30:58 +08:00 коммит произвёл GitHub
Родитель 8de3343464
Коммит 46f761f01a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 81 добавлений и 75 удалений

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

@ -1,6 +1,11 @@
# Changelog
## 04/10/2020 0.21.5
## 05/21/2020 0.21.6
- Avoid adding nullable value for parameter when its' type isn't string
- Output exception infomation for semantic validation
## 04/20/2020 0.21.5
- Output exception information when pretty switch is enabled.

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

@ -647,7 +647,7 @@ export function allowNullableParams(parameter: ParameterObject): ParameterObject
if (parameter.in && parameter.in === "body" && parameter.schema) {
parameter.schema = allowNullableTypes(parameter.schema)
} else {
if (parameter.in && parameter.in !== "path") {
if (parameter.in && parameter.in !== "path" && parameter.type === "string") {
parameter = allowNullType(parameter, parameter.required)
}
}

2
package-lock.json сгенерированный
Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "oav",
"version": "0.21.5",
"version": "0.21.6",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

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

@ -1,6 +1,6 @@
{
"name": "oav",
"version": "0.21.5",
"version": "0.21.6",
"author": {
"name": "Microsoft Corporation",
"email": "azsdkteam@microsoft.com",

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

@ -2,7 +2,7 @@
"parameters": {
"serviceName": "sampleServiceName",
"isGroupbySite": true,
"takeCount": "1",
"takeCount": "string",
"nextPartitionKey": " ",
"nextRowKey": " ",
"api-version": "2014-01-01"
@ -10,80 +10,80 @@
"responses": {
"200": {
"body": {
"value": [
{
"domainName": "sampleDomainName",
"siteName": "Default-First-Site-Name",
"addsRoles": [
"sampleRole"
],
"gcReachable": true,
"isAdvertising": true,
"pdcReachable": true,
"sysvolState": true,
"dcTypes": [
"GC"
],
"lastReboot": "2018-04-28T23:17:00.511864Z",
"lastDisabled": "2018-04-28T23:17:00.511864Z",
"lastUpdated": "2018-04-30T18:00:41.6956022Z",
"activeAlerts": 0,
"resolvedAlerts": 0,
"createdDate": "2018-04-28T23:17:00.511864Z",
"disabled": false,
"dimensions": [
{
"key": "key1",
"value": "value1"
}
],
"additionalInformation": "SampleAdditionalInformation",
"tenantId": "00000000-0000-0000-0000-000000000000",
"serviceId": "serviceIdGuid",
"serviceMemberId": "ServiceMemberIdGuid",
"machineId": "machineIdGuid",
"machineName": "sampleMachineName",
"role": "SampleRole",
"status": "Healthy",
"properties": [
{
"key": "key1",
"value": "value1"
}
],
"installedQfes": [{
"value": [
{
"domainName": "sampleDomainName",
"siteName": "Default-First-Site-Name",
"addsRoles": ["sampleRole"],
"gcReachable": true,
"isAdvertising": true,
"pdcReachable": true,
"sysvolState": true,
"dcTypes": ["GC"],
"lastReboot": "2018-04-28T23:17:00.511864Z",
"lastDisabled": "2018-04-28T23:17:00.511864Z",
"lastUpdated": "2018-04-30T18:00:41.6956022Z",
"activeAlerts": 0,
"resolvedAlerts": 0,
"createdDate": "2018-04-28T23:17:00.511864Z",
"disabled": false,
"dimensions": [
{
"key": "key1",
"value": "value1"
}
],
"additionalInformation": "SampleAdditionalInformation",
"tenantId": "00000000-0000-0000-0000-000000000000",
"serviceId": "serviceIdGuid",
"serviceMemberId": "ServiceMemberIdGuid",
"machineId": "machineIdGuid",
"machineName": "sampleMachineName",
"role": "SampleRole",
"status": "Healthy",
"properties": [
{
"key": "key1",
"value": "value1"
}
],
"installedQfes": [
{
"kbName": "KB3019978",
"link": "SampleLink",
"installedDate": "2016-11-06T04:00:00Z"
}],
"recommendedQfes": [{
}
],
"recommendedQfes": [
{
"kbName": "KB3019978",
"link": "SampleLink",
"installedDate": "2016-11-06T04:00:00Z"
}],
"monitoringConfigurationsComputed": [
{
"key": "key1",
"value": "value1"
}
],
"monitoringConfigurationsCustomized": [
{
"key": "key1",
"value": "value1"
}
],
"osVersion": "osVersion",
"osName": "osName",
"disabledReason": 0,
"serverReportedMonitoringLevel": "Off",
"lastServerReportedMonitoringLevelChange": "2018-04-30T18:00:41.6956022Z"
}
],
"nextLink": null,
"totalCount": 0,
"continuationToken": null
}
}
],
"monitoringConfigurationsComputed": [
{
"key": "key1",
"value": "value1"
}
],
"monitoringConfigurationsCustomized": [
{
"key": "key1",
"value": "value1"
}
],
"osVersion": "osVersion",
"osName": "osName",
"disabledReason": 0,
"serverReportedMonitoringLevel": "Off",
"lastServerReportedMonitoringLevelChange": "2018-04-30T18:00:41.6956022Z"
}
],
"nextLink": null,
"totalCount": 0,
"continuationToken": null
}
}
}
}

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

@ -16,7 +16,8 @@ describe("sourceMap", () => {
assert.strictEqual(result.length, 1)
const result0 = result[0]
const e = result0.details as any
assert.strictEqual(e.url, file)
assert.deepStrictEqual(e.position, { line: 76, column: 11 })
assert.strictEqual(e.jsonPath, "$.parameters.takeCount")
assert.strictEqual(e.code, "INVALID_TYPE")
assert.strictEqual(e.message, "Expected type integer but found type string")
})
})