Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[azeventgrid] Removing the empty Interface any from PublishCloudEventsResponse #21081

Merged
merged 2 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions sdk/messaging/azeventgrid/autorest.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,16 @@ directive:
- response_types.go
where: $
transform: return $.replace(/\*CloudEvent/g, "messaging.CloudEvent");

# remove the 'Interface any' that's generated for an empty response object.
richardpark-msft marked this conversation as resolved.
Show resolved Hide resolved
- from:
- client.go
where: $
transform: |
return $.replace(/if err := runtime.UnmarshalAsJSON\(resp, &result.Interface\).+?\s+}/sg, "");
- from:
- response_types.go
where: $
transform: |
return $.replace(/\/\/ Anything\s+Interface any/g, "");
```
4 changes: 1 addition & 3 deletions sdk/messaging/azeventgrid/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions sdk/messaging/azeventgrid/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@ func TestFailedAck(t *testing.T) {
ce, err := messaging.NewCloudEvent("hello-source", "world", []byte("ack this one"), nil)
require.NoError(t, err)

pubResp, err := c.PublishCloudEvents(context.Background(), c.TestVars.Topic, []messaging.CloudEvent{ce}, nil)
_, err = c.PublishCloudEvents(context.Background(), c.TestVars.Topic, []messaging.CloudEvent{ce}, nil)
require.NoError(t, err)

// just documenting this, I don't think the return value is useful.
require.Equal(t, map[string]interface{}{}, pubResp.Interface)

recvResp, err := c.ReceiveCloudEvents(context.Background(), c.TestVars.Topic, c.TestVars.Subscription, &azeventgrid.ReceiveCloudEventsOptions{
MaxEvents: to.Ptr[int32](1),
MaxWaitTime: to.Ptr[int32](10),
Expand Down
2 changes: 0 additions & 2 deletions sdk/messaging/azeventgrid/response_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdk/messaging/azeventgrid/shared_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ func loadEnv() (testVars, error) {
// Setting this variable will cause the test clients to dump out the pre-master-key
// for your HTTP connection. This allows you decrypt a packet capture from wireshark.
//
// If you want to do this just set SSLKEYLOGFILE_TEST env var to a path on disk and
// If you want to do this just set SSLKEYLOGFILE env var to a path on disk and
// Go will write out the key.
tv.KeyLogPath = os.Getenv("SSLKEYLOGFILE_TEST")
tv.KeyLogPath = os.Getenv("SSLKEYLOGFILE")
return tv, nil
}

Expand Down