Skip to content

Commit f3d0d83

Browse files
feat: update Processes API to support pagination with limit and offset parameters
1 parent 43120f9 commit f3d0d83

File tree

19 files changed

+274
-132
lines changed

19 files changed

+274
-132
lines changed

api-client/post-process.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@
1616

1717

1818
def file_modifications() -> Generator[tuple[Path, FileModifier], None, None]:
19+
"""Return a generator of file paths and their corresponding modification functions."""
20+
1921
yield Path("types/ObjectParamAPI.ts"), object_param_api_ts
2022
yield Path("types/PromiseAPI.ts"), promise_api_ts
21-
yield Path("apis/ProcessesApi.ts"), processes_api_ts
23+
yield Path("models/ObjectSerializer.ts"), object_serializer_ts
24+
yield Path("models/Results.ts"), results_ts
2225

2326

2427
def main():
28+
"""Main function to perform file modifications."""
29+
2530
logging.basicConfig(level=logging.INFO, format="[%(levelname)s] %(message)s")
2631

2732
subdir = Path("typescript")
@@ -37,7 +42,7 @@ def main():
3742
with open(file_path, "w", encoding="utf-8") as f:
3843
for line in modify_fn(file_contents):
3944
f.write(line)
40-
except Exception as e:
45+
except Exception as e: # pylint: disable=broad-exception-caught
4146
logging.error("Error modifying %s: %s", file_path, e)
4247

4348

@@ -57,15 +62,19 @@ def promise_api_ts(file_contents: list[str]) -> Generator[str, None, None]:
5762
yield line
5863

5964

60-
def processes_api_ts(file_contents: list[str]) -> Generator[str, None, None]:
61-
"""Modify the ProcessesAPI.ts file."""
65+
def results_ts(file_contents: list[str]) -> Generator[str, None, None]:
66+
"""Modify the Results.ts file."""
67+
for line in file_contents:
68+
if dedent(line).startswith("import { HttpFile } from '../http/http';"):
69+
line = line + "import { InlineOrRefData } from './InlineOrRefData';\n"
70+
yield line
71+
72+
73+
def object_serializer_ts(file_contents: list[str]) -> Generator[str, None, None]:
74+
"""Modify the ObjectSerializer.ts file."""
6275
for line in file_contents:
63-
# TODO: fix in ogcapi's OpenAPI spec instead of patching the generated code
64-
if dedent(line).startswith('"{ [key: string]: InlineOrRefData; }", ""'):
65-
line = line.replace(
66-
'"{ [key: string]: InlineOrRefData; }", ""',
67-
'"any", ""',
68-
)
76+
if dedent(line).startswith('"Results": ResultsClass,'):
77+
line = "" # lead to call of missing `getAttributeTypeMap` method
6978
yield line
7079

7180

api-client/typescript/.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api-client/typescript/apis/ProcessesApi.ts

Lines changed: 30 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api-client/typescript/docs/ProcessesApi.md

Lines changed: 16 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api-client/typescript/models/ObjectSerializer.ts

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api-client/typescript/models/Results.ts

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api-client/typescript/models/all.ts

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api-client/typescript/types/ObjectParamAPI.ts

Lines changed: 23 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)