Azure / Azure/azure-rest-api-specs
Static Web Site: The `provider` in `StaticSite` model is not read only
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 444
Description
Given following static site resource:
```shell
GET /api-version=2021-02-01
```
Response:
```json
{
"id": "REDACTED",
"name": "example",
"type": "Microsoft.Web/staticSites",
"location": "West Europe",
"tags": {
"foo": "bar"
},
"properties": {
"defaultHostname": "REDACTED",
"repositoryUrl": "https://github.com/magodo/my-first-static-web-app",
"branch": "main",
"customDomains": [],
"privateEndpointConnections": [],
"stagingEnvironmentPolicy": "Enabled",
"allowConfigFileUpdates": true,
"contentDistributionEndpoint": "https://content-am2.infrastructure.1.azurestaticapps.net",
"keyVaultReferenceIdentity": "SystemAssigned",
"userProvidedFunctionApps": [],
"linkedBackends": null,
"provider": "Github",
"enterpriseGradeCdnStatus": "Disabled",
"publicNetworkAccess": null
},
"sku": {
"name": "Standard",
"tier": "Standard"
},
"identity": {
"type": "SystemAssigned",
"tenantId": "REDACTED",
"principalId": "REDACTED"
}
}
```
If I copy the model above and take it as the request body in another `PUT`, removing the read only properties:
```
PUT /api-version=2021-02-01
```
Request:
```json
{
"id": "REDACTED",
"name": "example",
"type": "Microsoft.Web/staticSites",
"location": "West Europe",
"tags": {
"foo": "bar"
},
"properties": {
"repositoryUrl": "https://github.com/magodo/my-first-static-web-app",
"branch": "main",
"stagingEnvironmentPolicy": "Enabled",
"allowConfigFileUpdates": true
},
"sku": {
"name": "Standard",
"tier": "Standard"
},
"identity": {
"type": "SystemAssigned",
"tenantId": "REDACTED",
"principalId": "REDACTED"
}
}
```
The API returns:
```json
{
"Code": "BadRequest",
"Message": "Provider is invalid. Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider.",
"Target": null,
"Details": [
{
"Message": "Provider is invalid. Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider."
},
{
"Code": "BadRequest"
},
{
"ErrorEntity": {
"ExtendedCode": "51021",
"MessageTemplate": "{0} is invalid. {1}",
"Parameters": [
"Provider",
"Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider."
],
"Code": "BadRequest",
"Message": "Provider is invalid. Cannot change the Provider. Please detach your static site first if you wish to use to another deployment provider."
}
}
],
"Innererror": null
}
```
To fix this, I need to add `"provider": "Github"` in above request. This indicates that either [the `provider` property](https://github.com/Azure/azure-rest-api-specs/blob/aeb8c9f96a43f66d8362cdaf26876fb6dd8aecd3/specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/StaticSites.json#L2895) in the `StaticSite` model is incorrectly marked as read only, or the service behavior is not expected.
Contributor guide
Research direction
Start with the provider property in specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/StaticSites.json, at the line linked in the issue. Compare its read-only marking with the shown GET and PUT behavior, then determine whether the specification or the service is incorrect; the issue is done when that expectation is clarified and the specification reflects the confirmed behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100