diff --git a/eng/tools/generator/cmd/v2/common/changelogProcessor.go b/eng/tools/generator/cmd/v2/common/changelogProcessor.go index 2ad14f40d6f6..d81a162879fb 100644 --- a/eng/tools/generator/cmd/v2/common/changelogProcessor.go +++ b/eng/tools/generator/cmd/v2/common/changelogProcessor.go @@ -305,7 +305,7 @@ func funcOperation(content *delta.Content) { if funcValue.Returns != nil { rs := strings.Split(*funcValue.Returns, ",") clientFuncResponse := rs[0] - if strings.Contains(clientFunc[1], "runtime.Poller") { + if strings.Contains(clientFuncResponse, "runtime") { re := regexp.MustCompile("\\[(?P.*)\\]") clientFuncResponse = re.FindString(clientFuncResponse) clientFuncResponse = re.ReplaceAllString(clientFuncResponse, "${response}") @@ -337,7 +337,7 @@ func LROFilter(changelog *model.Changelog) { clientFunc := strings.Split(bFunc, ".") if len(clientFunc) == 2 { if strings.Contains(clientFunc[1], "Begin") { - clientFunc[1] = strings.ReplaceAll(clientFunc[1], "Being", "") + clientFunc[1] = strings.TrimPrefix(clientFunc[1], "Begin") beginFunc = fmt.Sprintf("%s.%s", clientFunc[0], clientFunc[1]) } else { beginFunc = fmt.Sprintf("%s.Begin%s", clientFunc[0], clientFunc[1]) diff --git a/eng/tools/generator/cmd/v2/common/changelogProcessor_test.go b/eng/tools/generator/cmd/v2/common/changelogProcessor_test.go index afa5ca3dc424..676ffb5ae7dc 100644 --- a/eng/tools/generator/cmd/v2/common/changelogProcessor_test.go +++ b/eng/tools/generator/cmd/v2/common/changelogProcessor_test.go @@ -53,7 +53,7 @@ func TestFuncFilter(t *testing.T) { common.FilterChangelog(changelog, common.FuncFilter) - excepted := fmt.Sprint("### Breaking Changes\n\n- Function `*Client.Update` has been removed\n\n### Features Added\n\n- New function `*Client.BeginCreateOrUpdate(string, *ClientBeginCreateOrUpdateOptions) (ClientBeginCreateOrUpdateResponse, error)`\n") + excepted := fmt.Sprint("### Breaking Changes\n\n- Function `*Client.BeingDelete` has been removed\n- Function `*Client.NewListPager` has been removed\n- Function `*Client.Update` has been removed\n\n### Features Added\n\n- New function `*Client.BeginCreateOrUpdate(string, *ClientBeginCreateOrUpdateOptions) (ClientBeginCreateOrUpdateResponse, error)`\n- New function `*Client.NewListBySubscriptionPager(*ClientListBySubscriptionOptions) *runtime.Pager[ClientListBySubscriptionResponse]`\n") assert.Equal(t, excepted, changelog.ToCompactMarkdown()) } @@ -75,7 +75,7 @@ func TestLROFilter(t *testing.T) { common.FilterChangelog(changelog, common.FuncFilter, common.LROFilter) - excepted := fmt.Sprint("### Breaking Changes\n\n- Operation `*Client.CreateOrUpdate` has been changed to LRO, use `*Client.BeginCreateOrUpdate` instead.\n") + excepted := fmt.Sprint("### Breaking Changes\n\n- Operation `*Client.BeginDelete` has been changed to non-LRO, use `*Client.Delete` instead.\n- Operation `*Client.CreateOrUpdate` has been changed to LRO, use `*Client.BeginCreateOrUpdate` instead.\n") assert.Equal(t, excepted, changelog.ToCompactMarkdown()) } diff --git a/eng/tools/generator/cmd/v2/common/testdata/new/lro/lrofilter.go b/eng/tools/generator/cmd/v2/common/testdata/new/lro/lrofilter.go index 0ac663e79d73..d6042e048645 100644 --- a/eng/tools/generator/cmd/v2/common/testdata/new/lro/lrofilter.go +++ b/eng/tools/generator/cmd/v2/common/testdata/new/lro/lrofilter.go @@ -13,3 +13,12 @@ func (client *Client) BeginCreateOrUpdate(resourceGroupName string, options *Cli type ClientBeginCreateOrUpdateOptions struct{} type ClientBeginCreateOrUpdateResponse struct{} + +func (client *Client) Delete(resourceGroupName string, options *ClientDeleteOptions) (ClientDeleteResponse, error) { + + return ClientDeleteResponse{}, nil +} + +type ClientDeleteOptions struct{} + +type ClientDeleteResponse struct{} diff --git a/eng/tools/generator/cmd/v2/common/testdata/new/operation/funcfilter.go b/eng/tools/generator/cmd/v2/common/testdata/new/operation/funcfilter.go index 9ab1f58fe0c6..5671d6ff07ae 100644 --- a/eng/tools/generator/cmd/v2/common/testdata/new/operation/funcfilter.go +++ b/eng/tools/generator/cmd/v2/common/testdata/new/operation/funcfilter.go @@ -13,3 +13,11 @@ func (client *Client) BeginCreateOrUpdate(resourceGroupName string, options *Cli type ClientBeginCreateOrUpdateOptions struct{} type ClientBeginCreateOrUpdateResponse struct{} + +func (client *Client) NewListBySubscriptionPager(options *ClientListBySubscriptionOptions) *runtime.Pager[ClientListBySubscriptionResponse] { + return &runtime.Pager[ClientListBySubscriptionResponse] +} + +type ClientListBySubscriptionOptions struct{} + +type ClientListBySubscriptionResponse struct{} diff --git a/eng/tools/generator/cmd/v2/common/testdata/old/lro/lrofilter.go b/eng/tools/generator/cmd/v2/common/testdata/old/lro/lrofilter.go index 3dcaccb8c50d..030781bdc458 100644 --- a/eng/tools/generator/cmd/v2/common/testdata/old/lro/lrofilter.go +++ b/eng/tools/generator/cmd/v2/common/testdata/old/lro/lrofilter.go @@ -13,3 +13,12 @@ func (client *Client) CreateOrUpdate(resourceGroupName string, options *ClientCr type ClientCreateOrUpdateOptions struct{} type ClientCreateOrUpdateResponse struct{} + +func (client *Client) BeginDelete(resourceGroupName string, options *ClientBeginDeleteOptions) (ClientBeginDeleteResponse, error) { + + return ClientBeginDeleteResponse{}, nil +} + +type ClientBeginDeleteOptions struct{} + +type ClientBeginDeleteResponse struct{} diff --git a/eng/tools/generator/cmd/v2/common/testdata/old/operation/funcfilter.go b/eng/tools/generator/cmd/v2/common/testdata/old/operation/funcfilter.go index 17c1be9f25e7..8fd89cdf7501 100644 --- a/eng/tools/generator/cmd/v2/common/testdata/old/operation/funcfilter.go +++ b/eng/tools/generator/cmd/v2/common/testdata/old/operation/funcfilter.go @@ -13,3 +13,20 @@ func (client *Client) Update(resourceGroupName string, options *ClientUpdateOpti type ClientUpdateOptions struct{} type ClientUpdateResponse struct{} + +func (client *Client) BeingDelete(resourceGroupName string, options *ClientBeginDeleteOptions) (*runtime.Poller[ClientBeginDeleteResponse], error) { + + return &runtime.Poller[ClientBeginDeleteResponse]{}, nil +} + +type ClientBeginDeleteOptions struct{} + +type ClientBeginDeleteResponse struct{} + +func (client *Client) NewListPager(resourceGroupName string, options *ClientListOptions) *runtime.Pager[ClientListResponse] { + return &runtime.Pager[ClientListResponse] +} + +type ClientListOptions struct{} + +type ClientListResponse struct{}