Skip to content

Rule for x-ms-enum crashes when "name" property is missing. #654

@tjprescott

Description

@tjprescott

The following Swagger causes LintDiff to crash with a fatal error:
image

The error is:
openapiValidatorPluginFunc: Failed validating:TypeError: Cannot read property 'toLowerCase' of undefined Location

Here's the failing CI run:
https://github.com/Azure/azure-rest-api-specs/pull/27356/checks?check_run_id=20396982945

Per the specification for x-ms-enum, name is an optional field, so any rule that is operating on x-ms-enum needs to have appropriate logic. In this case, the rule seems to be assuming name exists and calling toLowerCase on it, resulting in the fatal crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions