Skip to content

Commit 5dbf15b

Browse files
Update code_sample.go
1 parent c031fb1 commit 5dbf15b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tools/cli/internal/openapi/filter/code_sample.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ func (f *CodeSampleFilter) Apply() error {
5454
return nil
5555
}
5656

57-
func (f *CodeSampleFilter) newCurlCodeSamplesForOperation(pathName, opK string) codeSample {
57+
func (f *CodeSampleFilter) newCurlCodeSamplesForOperation(pathName, opMethod string) codeSample {
5858
source := "curl --user \"{PUBLIC-KEY}:{PRIVATE-KEY}\" \\\n --digest \\\n " +
5959
"--header \"Accept: application/vnd.atlas." + apiVersion(f.metadata.targetVersion) + "+json\" \\\n "
6060

61-
switch opK {
61+
switch opMethod {
6262
case "GET":
63-
source += "-X " + opK + " \"" + pathName + "?pretty=true\""
63+
source += "-X " + opMethod + " \"" + pathName + "?pretty=true\""
6464
case "DELETE":
65-
source += "-X " + opK + " \"" + pathName + "\""
65+
source += "-X " + opMethod + " \"" + pathName + "\""
6666
case "POST", "PATCH", "PUT":
67-
source += "-X " + opK + " \"" + pathName + "\"\n "
67+
source += "-X " + opMethod + " \"" + pathName + "\"\n "
6868
source += "-d " + "{ <Payload> }"
6969
}
7070

@@ -96,8 +96,8 @@ func newAtlasCliCodeSamplesForOperation(op *openapi3.Operation) codeSample {
9696
}
9797
}
9898

99-
func (f *CodeSampleFilter) includeCodeSamplesForOperation(pathName, opK string, op *openapi3.Operation) error {
100-
if op == nil || opK == "" || pathName == "" {
99+
func (f *CodeSampleFilter) includeCodeSamplesForOperation(pathName, opMethod string, op *openapi3.Operation) error {
100+
if op == nil || opMethod == "" || pathName == "" {
101101
return nil
102102
}
103103

@@ -106,7 +106,7 @@ func (f *CodeSampleFilter) includeCodeSamplesForOperation(pathName, opK string,
106106
}
107107

108108
op.Extensions[codeSampleExtensionName] = []codeSample{
109-
f.newCurlCodeSamplesForOperation(pathName, opK),
109+
f.newCurlCodeSamplesForOperation(pathName, opMethod),
110110
newAtlasCliCodeSamplesForOperation(op),
111111
}
112112
return nil

0 commit comments

Comments
 (0)