[Migrate-Check-TypeSpec-Mitigate]sdk/resourcemanager/resourcegraph/armresourcegraph ##26345
[Migrate-Check-TypeSpec-Mitigate]sdk/resourcemanager/resourcegraph/armresourcegraph ##26345
Conversation
| - Struct `ErrorResponse` has been removed | ||
| - Struct `Table` has been removed | ||
| - Field `Interface` of struct `ClientResourcesHistoryResponse` has been removed | ||
|
|
There was a problem hiding this comment.
New Breaking changes:
- Enum
ColumnDataTypehas been removed - Struct
Columnhas been removed - Struct
Errorhas been removed - Struct
ErrorResponsehas been removed - Struct
Tablehas been removed
removed breaking changes:
- Function
NewClientFactoryparameter(s) have been changed from(credential azcore.TokenCredential, options *arm.ClientOptions)to(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)
| - Field `Interface` of struct `ClientResourcesHistoryResponse` has been removed | ||
|
|
||
| ### Features Added | ||
|
|
There was a problem hiding this comment.
New Features Added:
- New function
*Client.NewGraphQueryClient() *GraphQueryClient - New function
*Client.NewOperationsClient() *OperationsClient - New function
*ClientFactory.NewGraphQueryClient(subscriptionID string) *GraphQueryClient - New field
NextLinkin structOperationListResult
Removed features added:
- New function
*ClientFactory.NewGraphQueryClient() *GraphQueryClient - New struct
ErrorFieldContract - New struct
GraphQueryError - New struct
GraphQueryErrorError - New struct
Resource - New struct
ResourceSnapshotData
There was a problem hiding this comment.
Pull request overview
This PR migrates sdk/resourcemanager/resourcegraph/armresourcegraph from the older AutoRest-generated shape to the newer TypeSpec/Go Code Generator output, updating clients, models, fakes, and module metadata accordingly.
Changes:
- Adds new Graph Query client surface (client + fakes) and resource change APIs, and updates paging behavior.
- Regenerates models/serde and response/option types to match the newer API versions and generator patterns.
- Updates module metadata/dependencies (version.go, go.mod/go.sum, tsp-location.yaml) and removes legacy AutoRest artifacts.
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/resourcemanager/resourcegraph/armresourcegraph/version.go | Adds generated module name/version constants. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/tsp-location.yaml | Adds TypeSpec source metadata for regeneration. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/time_rfc3339.go | Removes legacy custom RFC3339 time handling helper. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/testdata/_metadata.json | Adds generator/test metadata (apiVersions/emitterVersion). |
| sdk/resourcemanager/resourcegraph/armresourcegraph/responses.go | Introduces updated response wrapper types for new methods/clients. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/response_types.go | Removes legacy response types file. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/polymorphic_helpers.go | Updates null-handling for polymorphic unmarshal helpers. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/options.go | Adds new options types for newly introduced operations. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/operations_client.go | Updates Operations client API version + paging implementation. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/models_serde.go | Updates model JSON serde; adds time helpers using azcore datetime types. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/models.go | Updates model types to the new spec (GraphQuery/resource changes/systemData). |
| sdk/resourcemanager/resourcegraph/armresourcegraph/interfaces.go | Updates generator header and interface file baseline. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/graphquery_client.go | Adds new GraphQueryClient implementation. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/go.mod | Updates azcore and indirect dependencies. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/go.sum | Updates checksums for bumped dependencies. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/fake/time_rfc3339.go | Removes legacy fake time helper. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/fake/server_factory.go | Extends fake server factory routing for new clients. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/fake/server.go | Adds fakes for new methods and dispatch for additional clients. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/fake/operations_server.go | Updates pager fake to support NextLink injection and interception. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/fake/internal.go | Adds shared helper types (result/initServer) used by fake transports. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/fake/graphquery_server.go | Adds GraphQuery client fake server + transport implementation. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/constants.go | Updates enums/constants to new spec surface. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/client_factory.go | Refactors factory to share an internal arm.Client and expose GraphQuery client creation. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/client_example_test.go | Updates generated examples to new operations and shapes. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/client.go | Adds resource change operations and helper constructors; updates API versions. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/build.go | Removes legacy go:generate entrypoint for AutoRest flow. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/autorest.md | Removes AutoRest configuration file. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/README.md | Updates factory usage and client creation examples. |
| sdk/resourcemanager/resourcegraph/armresourcegraph/CHANGELOG.md | Adds 0.10.0 entry describing breaking changes and new features. |
| func (client *Client) NewGraphQueryClient() *GraphQueryClient { | ||
| return &GraphQueryClient{ | ||
| internal: client.internal, |
There was a problem hiding this comment.
Client.NewGraphQueryClient() returns a GraphQueryClient without setting subscriptionID, but all GraphQuery operations require a subscription ID and will error with "parameter client.subscriptionID cannot be empty". Consider changing this constructor to accept a subscriptionID parameter (and set the field), or remove it in favor of NewGraphQueryClient(subscriptionID, credential, options) / ClientFactory.NewGraphQueryClient(subscriptionID).
| func (client *Client) NewGraphQueryClient() *GraphQueryClient { | |
| return &GraphQueryClient{ | |
| internal: client.internal, | |
| func (client *Client) NewGraphQueryClient(subscriptionID string) *GraphQueryClient { | |
| return &GraphQueryClient{ | |
| internal: client.internal, | |
| subscriptionID: subscriptionID, |
|
|
||
| ```go | ||
| client := clientFactory.NewClient() | ||
| client := clientFactory.NewGraphQueryClient() |
There was a problem hiding this comment.
The README example calls clientFactory.NewGraphQueryClient() with no arguments, but ClientFactory.NewGraphQueryClient now requires a subscriptionID parameter. Update the example to pass a subscription ID (or to use the supported constructor pattern if NewGraphQueryClient is changed).
| client := clientFactory.NewGraphQueryClient() | |
| subscriptionID := "00000000-0000-0000-0000-000000000000" | |
| client := clientFactory.NewGraphQueryClient(subscriptionID) |
| @@ -0,0 +1,4 @@ | |||
| directory: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/ResourceGraph | |||
| commit: 5eed3b9a301906268af21bbe256898387661ed42 | |||
| repo: i-specs | |||
There was a problem hiding this comment.
tsp-location.yaml uses repo: i-specs, but other ARM TypeSpec modules in this repo use repo: Azure/azure-rest-api-specs (e.g., sdk/resourcemanager/resources/armbicep/tsp-location.yaml). Please update this to the standard repo value so tooling can resolve the spec location consistently.
| repo: i-specs | |
| repo: Azure/azure-rest-api-specs |
| // "location": "westus", | ||
| // "tags":map[string]any{ | ||
| // res = armresourcegraph.ClientResourceChangeDetailsResponse{ | ||
| // undefined: &[]*armresourcegraph.ResourceChangeData{ |
There was a problem hiding this comment.
The example response snippet is incorrect: ClientResourceChangeDetailsResponse doesn't have a field named undefined (it should be ResourceChangeDataArray). This makes the generated example misleading; please update the commented response to use the actual response struct field names.
| // undefined: &[]*armresourcegraph.ResourceChangeData{ | |
| // ResourceChangeDataArray: []*armresourcegraph.ResourceChangeData{ |
| // res = armresourcegraph.ClientResourceChangesResponse{ | ||
| // ResourceChangeList: &armresourcegraph.ResourceChangeList{ | ||
| // Changes: []*armresourcegraph.ResourceChangeData{ | ||
| // { |
There was a problem hiding this comment.
The example response snippet uses ResourceChangeList: &armresourcegraph.ResourceChangeList{...}, but ClientResourceChangesResponse embeds ResourceChangeList (non-pointer). Update the commented example to use the correct composite literal shape (and field name), otherwise the snippet can't be used as a reference.
| @@ -87,12 +149,47 @@ func PossibleResultFormatValues() []ResultFormat { | |||
| } | |||
| } | |||
|
|
|||
| // ResultFormat - Defines in which format query result returned. | |||
| type ResultFormat string | |||
|
|
|||
| const ( | |||
| // ResultFormatObjectArray - objectArray | |||
| ResultFormatObjectArray ResultFormat = "objectArray" | |||
| // ResultFormatTable - table | |||
| ResultFormatTable ResultFormat = "table" | |||
| ) | |||
|
|
|||
| // PossibleResultFormatValues returns the possible values for the ResultFormat const type. | |||
| func PossibleResultFormatValues() []ResultFormat { | |||
| return []ResultFormat{ | |||
| ResultFormatObjectArray, | |||
| ResultFormatTable, | |||
| } | |||
| } | |||
There was a problem hiding this comment.
ResultFormat (type, consts, and PossibleResultFormatValues) is declared twice in this file, which will cause a compile-time redeclaration error. Remove the duplicate block so ResultFormat is defined only once.
API Change CheckAPIView identified API level changes in this PR and created the following API reviews |
based on branch:ruih/resourcegraph-tsp-convert