Azure / Azure/azure-libraries-for-java
Appservice response for the `availableStacks` API does not match the swagger model
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 97
- Forks
- 102
- PR merge metrics
- No merged PRs in 30d
Description
The swagger spec for the get operation for availableStacks API does not match the data on the wire.
Here is what I see returned by the service :
[main] INFO com.microsoft.azure.management.appservice.Providers getAvailableStacks - --> GET https://management.azure.com/providers/Microsoft.Web/availableStacks?osTypeSelected=Windows&api-version=2018-02-01
[main] INFO com.microsoft.azure.management.appservice.Providers getAvailableStacks - 1650-byte body:
{
"value": [{
"id": null,
"name": "aspnet",
"type": "Microsoft.Web/availableStacks?osTypeSelected=Windows",
"properties": {
"name": "aspnet",
"display": "Net Framework Version",
"dependency": null,
"majorVersions": [{
"displayVersion": "v4.7",
"runtimeVersion": "v4.0",
"isDefault": true,
"minorVersions": [],
"applicationInsights": false
}, {
"displayVersion": "v3.5",
"runtimeVersion": "v2.0",
"isDefault": false,
"minorVersions": [],
"applicationInsights": false
}],
"frameworks": []
}
},
…
...
],
"nextLink": null,
"id": null
}
The swagger declaration is causing the classes in the java SDK to be created like this :
public class ApplicationStackInner {
/**
* Application stack name.
*/
@JsonProperty(value = "name")
private String name;
/**
* Application stack display name.
*/
@JsonProperty(value = "display")
private String display;
/**
* Application stack dependency.
*/
@JsonProperty(value = "dependency")
private String dependency;
/**
* List of major versions available.
*/
@JsonProperty(value = "majorVersions")
private List<StackMajorVersion> majorVersions;
….
Which breaks when we try tp parse the data that is returned by the server.
In order to correctly get the data out, I have to now edit the autogenerated class to add the properties sub class...
The service needs to change the on the swagger modelling.
Suggested Fix
Change the swagger model.
Good examples of what needs to be done, model like the following
AzureStoragePropertyDictionaryResource- A little more relevant example id
BackupItemsandBackupItemCollection
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the availableStacks GET definition in Provider.json and compare its schema with the response payload shown in the issue and the AzureStoragePropertyDictionaryResource, BackupItems, and BackupItemCollection examples. Check the generated ApplicationStackInner.java model and the referenced parsing change; done means the swagger model generates a Java class that correctly deserializes the returned properties structure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100