Azure / Azure/azure-rest-api-specs

[BUG] SourceControls.create uses ArmResourceRead for a PUT create operation

Open
#44,216 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

### API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/automation/Automation.Management/SourceControl.tsp#L94

### API Spec version

2024-10-23

### Describe the bug

The Automation TypeSpec currently models the `SourceControls.create` operation as a read operation template with a PUT override:

```typespec
@tag("SourceControlSyncJob")
@OpenAPI.externalDocs("http://aka.ms/azureautomationsdk/sourcecontrolsyncjoboperations")
@put
create is ArmResourceRead<
SourceControl,
BaseParameters = Azure.ResourceManager.Foundations.DefaultBaseParameters,
Response = ArmResourceCreatedSyncResponse,
Parameters = SourceControlSyncJobIdParameter & {
@body
parameters: SourceControlSyncJobCreateParameters;
}
>;
```
This is semantically inconsistent:
- The operation is named `create`
- The HTTP verb is `PUT`
- The response is `ArmResourceCreatedSyncResponse`
- But the operation template is `ArmResourceRead`

This makes the TypeSpec harder to reason about and could lead to incorrect SDK/resource metadata behavior.

### Expected behavior

The `create` operation should be modeled with a TypeSpec template that matches its actual semantics.
The operation should not use `ArmResourceRead` for a PUT create operation.

### Actual behavior

The create operation used the `ArmResourceRead` template.

### Reproduction Steps

Open `specification/automation/Automation.Management/SourceControl.tsp` and inspect `SourceControls.create`.

### Environment

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with specification/automation/Automation.Management/SourceControl.tsp at SourceControls.create and inspect nearby create operations and the referenced TypeSpec templates. Confirm which template matches the PUT create semantics and response type; done means the operation no longer uses ArmResourceRead and the specification remains valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.