Skip to content

fix: cli unit_test task is failing on master #776

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

Merged
merged 9 commits into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this was the fix

3 changes: 1 addition & 2 deletions tools/cli/internal/openapi/filter/code_sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"golang.org/x/text/language"
)

//go:embed go_sdk_code_sample.go.tmpl
//go:embed template/go_sdk_code_sample.go.tmpl
var goSDKTemplate string

const codeSampleExtensionName = "x-codeSamples"
Expand Down Expand Up @@ -137,7 +137,6 @@ func (f *CodeSampleFilter) newGoSdkCodeSamplesForOperation(op *openapi3.Operatio
operationID := cases.Title(language.English, cases.NoLower).String(op.OperationID)
tag := strings.ReplaceAll(op.Tags[0], " ", "")
tag = strings.ReplaceAll(tag, ".", "")

t, err := template.New("goSDK").Parse(goSDKTemplate)
if err != nil {
return nil, err
Expand Down
6 changes: 5 additions & 1 deletion tools/cli/internal/openapi/filter/code_sample_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,11 @@ func TestCodeSampleFilter(t *testing.T) {

require.NoError(t, filter.Apply())
if !reflect.DeepEqual(tt.expectedOas, tt.oas) {
t.Errorf("expected %v, got %v", tt.expectedOas, oas)
expectedOas, err := tt.expectedOas.MarshalJSON()
require.NoError(t, err)
oasFromTest, err := tt.oas.MarshalJSON()
require.NoError(t, err)
t.Errorf("expected: %q,\ngot: %q", string(expectedOas), string(oasFromTest))
}
})
}
Expand Down
Loading