API Spec link
|
customVMScrapeConfig?: unknown[]; |
API Spec version
2024-03-11 (may also impact newer versions)
Describe the bug
When the Microsoft.Insights Swagger went through TypeSpec conversion, it seems to have (mistakenly?) produced a widening on one property.
Here's Microsoft.Insights sample before TypeSpec migration for the customVMScrapeConfig field.
"customVMScrapeConfig": {
"description": "Custom VM Scrape Config that defines scrape jobs",
"type": "array",
"items": {
"type": "object"
}
},
In TypeSpec that was modelled as:
customVMScrapeConfig?: unknown[];
Which renders into OpenAPI as:
"customVMScrapeConfig": {
"type": "array",
"description": "Custom VM Scrape Config that defines scrape jobs",
"items": {}
},
Which has a loosened set of restrictions on the array items (allows bool, int, etc, whereas before it had to be an object).
See OAI/OpenAPI-Specification#1388 for a discussion of why "type": "object" and "no type specified" do not mean the same thing.
I think the TypeSpec should have been Record<unknown>[] to preserve the old object restriction.
Expected behavior
"customVMScrapeConfig": {
"type": "array",
"description": "Custom VM Scrape Config that defines scrape jobs",
"items": {}
},
items should be of type object.
Actual behavior
items is not of type object.
Reproduction Steps
Read the openAPI specification links above?
Environment
No response
API Spec link
azure-rest-api-specs/specification/monitor/resource-manager/Microsoft.Insights/Insights/DataCollectionApi/models.tsp
Line 1805 in 8d52135
API Spec version
2024-03-11 (may also impact newer versions)
Describe the bug
When the Microsoft.Insights Swagger went through TypeSpec conversion, it seems to have (mistakenly?) produced a widening on one property.
Here's Microsoft.Insights sample before TypeSpec migration for the
customVMScrapeConfigfield.In TypeSpec that was modelled as:
Which renders into OpenAPI as:
Which has a loosened set of restrictions on the array items (allows bool, int, etc, whereas before it had to be an object).
See OAI/OpenAPI-Specification#1388 for a discussion of why
"type": "object"and "no type specified" do not mean the same thing.I think the TypeSpec should have been
Record<unknown>[]to preserve the oldobjectrestriction.Expected behavior
items should be of type object.
Actual behavior
items is not of type object.
Reproduction Steps
Read the openAPI specification links above?
Environment
No response