-
Notifications
You must be signed in to change notification settings - Fork 865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unmarshalling JSON error in DeploymentOperationsClient.ListNextResults #938
Comments
Swagger bug? The statusMessage field is defined as an object. |
Here's the returned JSON in indented format. {
"value": [
{
"id": "/subscriptions/3014546b-7d1c-4f80-8523-f24a9976fe6a/resourceGroups/ds-acse-tst40/providers/Microsoft.Resources/deployments/agent-18-01-03T10.39.23-1324017081/operations/08586866021206228739",
"operationId": "08586866021206228739",
"properties": {
"provisioningOperation": "EvaluateDeploymentOutput",
"provisioningState": "Failed",
"timestamp": "2018-01-03T18:41:51.0473602Z",
"duration": "PT0.5431112S",
"trackingId": "98f19b12-ae95-49db-953b-6c983868f5e4",
"statusCode": "Conflict",
"statusMessage": "Template output evaluation skipped: at least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details."
}
}
]
} |
@vivsriaus Are you the owner of the resources swagger (I dug up your name from specs history)? I'm trying to understand why the statusMessage field is defined as object when it's coming across the wire as a string. |
@jhendrixMSFT yes, this is because the statusMessage property is defined as a JToken in ARM, and it could potentially contain an ErrorMessage object (with its own "Code", "Message", "Target", "Details", "Innererror" properties) |
The problem here is that the server didn't return an object but a simple string which doesn't fit the definition. @amarzavery do you have any thoughts on this? |
Ping @amarzavery. |
@jhendrixMSFT Like I mentioned above, the statusMessage property in DeploymentOperation can either return a string (like the case above) or an ErrorMessage object. Shouldn't autorest consider this as an object (which will then allow string to be processed as well), instead of string? |
In swagger (and JSON schema), a In this case, will the return type always be a string, or does it depend on the context? |
OK that's what I thought and is in fact how we model JSON objects in Go. map[string]interface{} So it would seem that the service isn't honoring the contract defined in the swagger yes? |
To answer @johanste 's question, yes, the return type depends on the context. I'll try to find a real world example where an object is returned for a DeploymentOperation |
@vivsriaus Any update? |
@jhendrixMSFT I'll talk to our team and see if we can make a fix to always return either a string or an object for DeploymentOperationProperties.StatusMessage. Like I mentioned, currently, the statusMessage type returned depends on the context. I'm not sure if this is a common scenario in other object models, but it looks like autorest currently doesn't have a way to work with both types (string and object) at the same time. |
This is not an autorest issue. What you're asking for cannot be modeled in swagger as string and object are fundamentally different types. |
This should be fixed in v14.0.0. The statusMessage field is now defined as |
Failure responding to next results request:
By comparing JSON data with DeploymentOperationProperties, the latter
The text was updated successfully, but these errors were encountered: