Azure / Azure/azure-rest-api-specs
[SecurityCenter] The definition of SWAGGER is inconsistent with the actual return of Rest API
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 6k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 444
Description
* Path: \specification\security\resource-manager\Microsoft.Security\preview\2020-01-01-preview\securityContacts.json
* Operation: SecurityContacts_List
* API VERSION: 2020-01-01
#### SWAGGER
```
"properties": {
"value": {
"readOnly": true,
"description": "List of security contacts",
"type": "array",
"items": {
"$ref": "#/definitions/SecurityContact"
}
},
"nextLink": {
"readOnly": true,
"type": "string",
"description": "The URI to fetch the next page."
}
```
#### Actually API return
```
[
{
"properties": {
"notificationsByRole": {
"state": "Off",
"roles": []
},
"emails": "john3775@contoso.com",
"phone": "18800001111",
"alertNotifications": {
"state": "On",
"minimalSeverity": "High"
}
},
"id": "/subscriptions/*******-********-******-*******/providers/Microsoft.Security/securityContacts/default",
"name": "default",
"type": "Microsoft.Security/securityContacts",
"etag": "****************************",
"location": "West Europe"
}
]
```
It will throw `System.InvalidOperationException` : The requested operation requires an element of type 'Object', but the target element has type 'Array'
Contributor guide
Research direction
Read specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/securityContacts.json, focusing on the SecurityContacts_List response definition and the reported array response. Compare the schema with the example API payload and confirm the generated representation no longer raises the reported InvalidOperationException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100