-
Notifications
You must be signed in to change notification settings - Fork 50
Closed
Description
In Azure/azure-rest-api-specs#36704, RequiredPropertiesMissingInResourceModel failed with what appears to be a false positive:
https://github.com/Azure/azure-rest-api-specs/actions/runs/17415866870
I believe the bug is here:
azure-openapi-validator/packages/rulesets/src/native/utilities/swagger-workspace.ts
Lines 94 to 99 in 2787ae4
| else if(reference){ | |
| const referenceSchema = resolveRef(createEnhancedSchema(model.properties.value.items, source.file), inventory) | |
| if (referenceSchema && referenceSchema.value && referenceSchema.value.properties) { | |
| model = referenceSchema.value | |
| } | |
| } |
In this spec, referenceSchema.value.properties is undefined, because the value is just allOf two other models, with no properties of its own:
"ContainerGroupProfile": {
"description": "A container group profile.",
"allOf": [
{
"$ref": "#/definitions/Resource"
},
{
"$ref": "#/definitions/ContainerGroupProfileProperties"
}
]
},
A workaround is to add an empty properties bag:
"ContainerGroupProfile": {
"description": "A container group profile.",
"allOf": [
{
"$ref": "#/definitions/Resource"
},
{
"$ref": "#/definitions/ContainerGroupProfileProperties"
}
],
"properties": { }
},
I think it should be fairly simple to fix this in the tool:

Metadata
Metadata
Assignees
Labels
No labels