Skip to content

Commit 336ed3c

Browse files
Added total numer of examples to the stats.
1 parent 56fc28a commit 336ed3c

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/scripts/examples-stats/ExamplesStatsGenerator.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ class ExampleStats:
1111
num_endpoints_with_only_response_examples: int = 0
1212
num_endpoints_with_both_request_and_response_examples: int = 0
1313
num_endpoints_with_non_200_response_code_examples: int = 0
14+
num_request_examples: int = 0
15+
num_response_examples: int = 0
1416
max_examples_per_endpoint: int = 0
1517

1618
class ExamplesStatsGenerator:
@@ -38,6 +40,9 @@ def get_stats(self) -> ExampleStats:
3840
else:
3941
stats.num_endpoints_with_no_examples += 1
4042

43+
stats.num_request_examples += endpoint_info.num_request_examples
44+
stats.num_response_examples += endpoint_info.num_response_examples
45+
4146
non_200_response_codes = endpoint_info.examples_response_codes - {"200"}
4247
if len(non_200_response_codes) > 0:
4348
stats.num_endpoints_with_non_200_response_code_examples += 1

src/scripts/examples-stats/main.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ def print_stats(stats: ExampleStats):
99
print ("===============")
1010
print ("==== Stats ====")
1111
print ("===============")
12-
print(f"Number of endpoints: {stats.num_endpoints}")
13-
print(f"Number of endpoints with no request or response examples: {stats.num_endpoints_with_no_examples}")
14-
print(f"Number of endpoints with examples: {stats.num_endpoints_with_examples}")
12+
print(f"Endpoints: {stats.num_endpoints}")
13+
print(f"Endpoints with no request or response examples: {stats.num_endpoints_with_no_examples}")
14+
print(f"Endpoints with examples: {stats.num_endpoints_with_examples}")
1515
print(f" {stats.num_endpoints_with_only_request_examples:>4}: Only request examples")
1616
print(f" {stats.num_endpoints_with_only_response_examples:>4}: Only response examples")
1717
print(f" {stats.num_endpoints_with_both_request_and_response_examples:>4}: Both request and response examples")
18-
print(f"Number of endpoints with non-200 response code examples: {stats.num_endpoints_with_non_200_response_code_examples}")
18+
print(f"Endpoints with non-200 response code examples: {stats.num_endpoints_with_non_200_response_code_examples}")
19+
print("------------------------")
20+
print(f"Examples: {stats.num_request_examples + stats.num_response_examples}")
21+
print(f" {stats.num_request_examples:>4}: Request examples")
22+
print(f" {stats.num_response_examples:>4}: Response examples")
1923
print(f"Max examples per endpoint: {stats.max_examples_per_endpoint}")
2024
print ("===============\n")
2125

0 commit comments

Comments
 (0)