oav icon indicating copy to clipboard operation
oav copied to clipboard

Error when instantiating a subclass in x-ms-examples: Discriminator value "latency" not found

Open franklixuefei opened this issue 3 years ago • 3 comments

Hi,

I've been trying everything I could to figure out why "instantiating" a new instance of the discriminating schema didn't work for me. The below is my schema and x-ms-examples:

    "ipControl": {
      "type": "object",
      "description": "The control object that mutates the TCP traffic",
      "discriminator": "controlType",
      "properties": {
        "controlType": {
          "type": "string",
          "enum": [
            "latency",
            "bandwidth",
            "https",
            "qos"
          ]
        }
      },
      "required": [
        "controlType"
      ]
    },
...
    "latency": {
      "type": "object",
      "description": "Model that represents the IP Latency Control",
      "allOf": [
        {
          "$ref": "#/definitions/ipControl"
        }
      ],
      "properties": {
        "delayMilliseconds": {
          "type": "integer",
          "description": "The latency in milliseconds"
        },
        "delaySigma": {
          "type": "integer",
          "description": "The latency sigma in milliseconds"
        },
        "correlationPercent": {
          "type": "number",
          "description": "the percentage of correlation"
        },
        "distribution": {
          "type": "string",
          "description": "The distribution of the latency"
        }
      },
      "required": [
        "delayMilliseconds",
        "delaySigma",
        "correlationPercent",
        "distribution"
      ]
    },

Usage in x-ms-examples:

  "responses": {
    "200": {
      "headers": {},
      "body": {
        "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/exampleRG/providers/Microsoft.Moxy/vnetInterceptorConfigurations/exampleInterceptorConfig",
        "type": "Microsoft.Moxy/vnetInterceptorConfigurations",
        "name": "exampleInterceptorConfig",
        "location": "westus2",
        "properties": {
          "routes": [
            {
              "name": "exampleRoute",
              "priority": 1,
              "destination": "10.140.1.2:8080",
              "ipControls": [
                {
                  "controlType": "latency",
                  "delayMilliseconds": 850,
                  "delaySigma": "100",
                  "correlationPercent": 10,
                  "distribution": "normal"
                }
              ]
            }
          ],
          "provisioningState": "Succeeded"
        },
...

When I ran the oav validate-example command, I get the following error:

{ code: 'DISCRIMINATOR_VALUE_NOT_FOUND', message: 'Discriminator value "latency" not found', schemaUrl: 'types\vnetInterceptorConfiguration.json', exampleUrl: 'examples\vnetInterceptorConfigurations\CreateOrUpdateVnetInterceptorConfiguration.json', schemaPosition: { line: 242, column: 18 }, schemaJsonPath: '#/discriminatorMap', examplePosition: { line: 82, column: 34 }, exampleJsonPath: '$responses.201.body.properties.routes[0].ipControls[0].controlType', severity: 0, source: 'response', operationId: 'VnetInterceptorConfiguration_CreateOrUpdate', level: '\u001b[31merror\u001b[39m' }

I wonder if anyone hit the same problem? Any help would be greatly appreciated!

franklixuefei avatar Dec 07 '21 22:12 franklixuefei

It’s a false alarm, and we have created a work item to trace it.

tianxchen-ms avatar Dec 09 '21 09:12 tianxchen-ms

Thanks! Please keep us updated! We are currently blocked on CI validation due to this problem.

Thanks! Frank

On Thu, Dec 9, 2021 at 1:02 AM tianxchen-ms @.***> wrote:

It’s a false alarm, and we have created a work item to trace it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Azure/oav/issues/720#issuecomment-989647245, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKF5RRA5D45UD4XJIBRSQDUQBWDZANCNFSM5JSK2YQA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

franklixuefei avatar Dec 09 '21 09:12 franklixuefei

Oh sorry, just read your internal email. I’ll fix other problems first. Thanks! Frank

On Thu, Dec 9, 2021 at 1:32 AM Frank Li @.***> wrote:

Thanks! Please keep us updated! We are currently blocked on CI validation due to this problem.

Thanks! Frank

On Thu, Dec 9, 2021 at 1:02 AM tianxchen-ms @.***> wrote:

It’s a false alarm, and we have created a work item to trace it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Azure/oav/issues/720#issuecomment-989647245, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKF5RRA5D45UD4XJIBRSQDUQBWDZANCNFSM5JSK2YQA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

franklixuefei avatar Dec 09 '21 09:12 franklixuefei