-
Notifications
You must be signed in to change notification settings - Fork 50
Description
$ gh repo clone azure/azure-rest-api-specs
$ git checkout b8fbdcc1e60dc013870988ef563014a07e9c7f47
$ npm i
npm exec -- autorest \
--level=fatal \
--v3 \
--spectral --azure-validator --semantic-validator=false --model-validator=false \
--use=$(pwd)/node_modules/@microsoft.azure/openapi-validator \
--openapi-type=arm --openapi-subtype=arm \
--tag=package-2024-04 \
specification/monitor/resource-manager/readme.md
fatal | openapiValidatorPluginFunc: Failed validating: TypeError: azure-openapi-validator/core/src/runner.ts/LintRunner.runRules/processRule error. ruleName: RequiredPropertiesMissingInResourceModel, specFilePath: file:///home/mharder/specs-mh/specification/monitor/resource-manager/Microsoft.Insights/stable/2024-02-01/metrics_API.json, jsonPath: , errorName: TypeError, errorMessage: Cannot read properties of undefined (reading 'readOnly')
This is a regression between [email protected] and [email protected]. Using [email protected], this spec doesn't crash.
Details
I was able to log the error:
propName: 'name'
prop: {
file: 'file:///home/mharder/specs/specification/monitor/resource-manager/Microsoft.Insights/stable/2024-02-01/metrics_API.json',
value: [Object: null prototype] {
'$ref': '#/definitions/LocalizableString',
description: 'The name and the display name of the metric, i.e. it is localizable string.'
}
}
I think the bug is related to this code. It might be as simple, as these properties need to be marked readOnly. Or, it might be the case that name must be a regular string, not a LocalizableString.
"Metric": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The metric Id."
},
"type": {
"type": "string",
"description": "The resource type of the metric resource."
},
"name": {
"$ref": "#/definitions/LocalizableString",
"description": "The name and the display name of the metric, i.e. it is localizable string."
},
This file hasn't been touched in 2 years. So either it's always been broken, or the rule recently changed.
This may be a recent regression in the rule.