Skip to content

Commit 1804b5c

Browse files
committed
remove log from guides
1 parent 9a02be0 commit 1804b5c

File tree

12 files changed

+20
-7
lines changed

12 files changed

+20
-7
lines changed

scripts/specs/snippets.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ export function transformCodeSamplesToGuideMethods(snippetSamples: SnippetSample
2727
}
2828

2929
for (const [sampleName, sample] of Object.entries(samples)) {
30-
const sampleMatch = sample.match(/.*Initialize the client.*\n(.*)((.|\n)*)(.*Call the API\n)((.|\n)*)/);
30+
const sampleMatch = sample.match(
31+
/.*Initialize the client.*\n(.*)((.|\n)*)(.*Call the API\n)((.|\n)*)(#|\/\/) >LOG/,
32+
);
3133
if (!sampleMatch) {
3234
continue;
3335
}
@@ -37,11 +39,11 @@ export function transformCodeSamplesToGuideMethods(snippetSamples: SnippetSample
3739

3840
if (!('init' in snippetSamples[language])) {
3941
snippetSamples[language].init = {
40-
default: initLine.replace(/\n$/, ''),
42+
default: initLine.trim(),
4143
};
4244
}
4345

44-
snippetSamples[language][operation][sampleName] = callLine.replace(/\n$/, '');
46+
snippetSamples[language][operation][sampleName] = callLine.trim();
4547
}
4648
}
4749
}
@@ -72,7 +74,7 @@ export async function transformSnippetsToCodeSamples(clientName: string): Promis
7274
const importMatch = snippetFileContent.match(/>IMPORT\n([\s\S]*?)\n.*IMPORT</);
7375
if (importMatch) {
7476
snippetSamples[gen.language].import = {
75-
default: importMatch[1].replace(/\n$/, ''),
77+
default: importMatch[1].trim(),
7678
};
7779
}
7880

templates/csharp/snippets/method.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class Snippet{{client}}
2929

3030
// Call the API
3131
{{#hasResponse}}var response = {{/hasResponse}}{{> tests/method}};
32+
// >LOG
3233
// SEPARATOR<
3334
}
3435

templates/dart/snippets/method.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ void snippetFor{{method}}{{testIndex}}() async {
3737
),
3838
{{/hasRequestOptions}}
3939
);
40+
// >LOG
4041
// SEPARATOR<
4142
}
4243

templates/go/snippets/method.mustache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ func SnippetFor{{#lambda.titlecase}}{{method}}{{/lambda.titlecase}}Of{{#lambda.p
2929
// handle the eventual error
3030
panic(err)
3131
}
32-
32+
33+
// >LOG
3334
{{#hasResponse}}
3435
// use the model directly
3536
print(response)

templates/java/snippets/method.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Snippet{{client}} {
1919

2020
// Call the API
2121
{{> tests/method}};
22+
// >LOG
2223
// SEPARATOR<
2324
}
2425

templates/javascript/snippets/method.mustache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ export {{#isAsync}}async{{/isAsync}} function snippetFor{{#lambda.pascalcase}}{{
1818

1919
// Call the API
2020
{{#hasResponse}}const response = {{/hasResponse}}{{> tests/method}};
21-
21+
22+
// >LOG
2223
{{#hasResponse}}
2324
// use typed response
2425
console.log(response);

templates/kotlin/snippets/method.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class Snippet{{client}} {
2222
// Call the API
2323
{{#hasResponse}}var response = {{/hasResponse}}client.{{> tests/method}}
2424

25+
// >LOG
2526
{{#hasResponse}}
2627
// Use the response
2728
println(response)

templates/php/snippets/method.mustache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class Snippet{{client}}
2525

2626
// Call the API
2727
{{#hasResponse}}$response = {{/hasResponse}}{{> tests/method}};
28-
28+
29+
// >LOG
2930
{{#hasResponse}}
3031
// play with the response
3132
var_dump($response);

templates/python/snippets/method.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ async def snippet_for_{{#lambda.snakecase}}{{method}}{{/lambda.snakecase}}{{test
1818
# Call the API
1919
{{#hasResponse}}response = {{/hasResponse}}{{#isAsync}}await {{/isAsync}}_client.{{#lambda.snakecase}}{{method}}{{/lambda.snakecase}}({{#parametersWithDataType}}{{> tests/generateParams}}{{/parametersWithDataType}}{{#hasRequestOptions}} request_options={ {{#requestOptions.headers.parameters}}"headers":loads("""{{{.}}}"""),{{/requestOptions.headers.parameters}}{{#requestOptions.queryParameters.parameters}}"query_parameters":loads("""{{{.}}}"""),{{/requestOptions.queryParameters.parameters}} }{{/hasRequestOptions}})
2020

21+
# >LOG
2122
{{#hasResponse}}
2223
# use the class directly
2324
print(response)

templates/ruby/snippets/method.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def snippet_for_{{#lambda.snakecase}}{{method}}{{/lambda.snakecase}}{{testIndex}
1616
# Call the API
1717
{{#hasResponse}}response = {{/hasResponse}}client.{{#lambda.snakecase}}{{method}}{{/lambda.snakecase}}({{#parametersWithDataType}}{{> tests/generateParams}}{{/parametersWithDataType}}{{#hasRequestOptions}}{ {{#requestOptions.headers.parameters}}:header_params => JSON.parse('{{{.}}}', :symbolize_names => true),{{/requestOptions.headers.parameters}}{{#requestOptions.queryParameters.parameters}}:query_params => JSON.parse('{{{.}}}', :symbolize_names => true){{/requestOptions.queryParameters.parameters}} }{{/hasRequestOptions}})
1818

19+
# >LOG
1920
{{#hasResponse}}
2021
# use the class directly
2122
puts response

templates/scala/snippets/method.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class Snippet{{client}} {
3434
// Call the API
3535
{{#hasResponse}}val response = {{/hasResponse}}{{> tests/method}}
3636

37+
// >LOG
3738
{{#hasResponse}}
3839
// Use the response
3940
val value = Await.result(response, Duration(100, "sec"))

templates/swift/snippets/method.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ final class {{client}}Snippet {
2222
{{#requestOptions.headers}}{{#requestOptions.queryParameters}},{{/requestOptions.queryParameters}}{{/requestOptions.headers}}{{#requestOptions.queryParameters}}
2323
queryParameters: [{{#parametersWithDataType}}"{{key}}": {{> tests/paramValue }}{{^-last}}, {{/-last}}{{/parametersWithDataType}}]{{/requestOptions.queryParameters}}
2424
){{/hasRequestOptions}})
25+
// >LOG
2526
// SEPARATOR<
2627
}
2728
{{/snippets}}

0 commit comments

Comments
 (0)