Skip to content

[Migrate-Check-TypeSpec-Mitigate]sdk/resourcemanager/resourcegraph/armresourcegraph ##26345

Closed
jliusan wants to merge 1 commit intomainfrom
mitigate-resourcegraph-mg2
Closed

[Migrate-Check-TypeSpec-Mitigate]sdk/resourcemanager/resourcegraph/armresourcegraph ##26345
jliusan wants to merge 1 commit intomainfrom
mitigate-resourcegraph-mg2

Conversation

@jliusan
Copy link
Member

@jliusan jliusan commented Mar 20, 2026

based on branch:ruih/resourcegraph-tsp-convert

Copilot AI review requested due to automatic review settings March 20, 2026 02:47
@github-actions github-actions bot added the Mgmt This issue is related to a management-plane library. label Mar 20, 2026
- Struct `ErrorResponse` has been removed
- Struct `Table` has been removed
- Field `Interface` of struct `ClientResourcesHistoryResponse` has been removed

Copy link
Member Author

@jliusan jliusan Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New Breaking changes:

  • Enum ColumnDataType has been removed
  • Struct Column has been removed
  • Struct Error has been removed
  • Struct ErrorResponse has been removed
  • Struct Table has been removed

removed breaking changes:

  • Function NewClientFactory parameter(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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New Features Added:

  • New function *Client.NewGraphQueryClient() *GraphQueryClient
  • New function *Client.NewOperationsClient() *OperationsClient
  • New function *ClientFactory.NewGraphQueryClient(subscriptionID string) *GraphQueryClient
  • New field NextLink in struct OperationListResult

Removed features added:

  • New function *ClientFactory.NewGraphQueryClient() *GraphQueryClient
  • New struct ErrorFieldContract
  • New struct GraphQueryError
  • New struct GraphQueryErrorError
  • New struct Resource
  • New struct ResourceSnapshotData

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +37 to +39
func (client *Client) NewGraphQueryClient() *GraphQueryClient {
return &GraphQueryClient{
internal: client.internal,
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
func (client *Client) NewGraphQueryClient() *GraphQueryClient {
return &GraphQueryClient{
internal: client.internal,
func (client *Client) NewGraphQueryClient(subscriptionID string) *GraphQueryClient {
return &GraphQueryClient{
internal: client.internal,
subscriptionID: subscriptionID,

Copilot uses AI. Check for mistakes.

```go
client := clientFactory.NewClient()
client := clientFactory.NewGraphQueryClient()
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
client := clientFactory.NewGraphQueryClient()
subscriptionID := "00000000-0000-0000-0000-000000000000"
client := clientFactory.NewGraphQueryClient(subscriptionID)

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,4 @@
directory: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/ResourceGraph
commit: 5eed3b9a301906268af21bbe256898387661ed42
repo: i-specs
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
repo: i-specs
repo: Azure/azure-rest-api-specs

Copilot uses AI. Check for mistakes.
// "location": "westus",
// "tags":map[string]any{
// res = armresourcegraph.ClientResourceChangeDetailsResponse{
// undefined: &[]*armresourcegraph.ResourceChangeData{
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
// undefined: &[]*armresourcegraph.ResourceChangeData{
// ResourceChangeDataArray: []*armresourcegraph.ResourceChangeData{

Copilot uses AI. Check for mistakes.
Comment on lines +177 to +180
// res = armresourcegraph.ClientResourceChangesResponse{
// ResourceChangeList: &armresourcegraph.ResourceChangeList{
// Changes: []*armresourcegraph.ResourceChangeData{
// {
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 134 to +168
@@ -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,
}
}
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

API Change Check

APIView identified API level changes in this PR and created the following API reviews

sdk/resourcemanager/resourcegraph/armresourcegraph

@jliusan jliusan closed this Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Mgmt This issue is related to a management-plane library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants