Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .generation/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Patched version of openapi-generator-cli with python3 support

FROM docker.io/openapitools/openapi-generator-cli:v7.11.0
FROM docker.io/openapitools/openapi-generator-cli:v7.12.0

RUN apt-get update && apt-get install -y python3
6 changes: 3 additions & 3 deletions .generation/config.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[input]
backendTag = nightly-2025-02-09
backendTag = nightly-2025-03-14

[general]
githubUrl = https://github.com/geo-engine/openapi-client

[python]
name = geoengine_openapi_client
version = 0.0.21
version = 0.0.22

[typescript]
name = @geoengine/openapi-client
version = 0.0.21
version = 0.0.22

31 changes: 25 additions & 6 deletions .generation/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,28 @@ def build_container():
)


def clean_test_dirs(*, language: Literal['python', 'typescript']):
'''Remove the test directory, since it will not be overwritten by the generator.'''
test_path = Path(language) / 'test'
if os.path.isdir(test_path):
shutil.rmtree(test_path)
def clean_dirs(*, language: Literal['python', 'typescript']):
'''Remove some directories because they are not be overwritten by the generator.'''

dirs_to_remove = [
Path(language) / 'test'
]

match language:
case 'typescript':
dirs_to_remove.extend([
Path(language) / 'src',
Path(language) / 'dist',
])
case 'python':
dirs_to_remove.extend([
Path(language) / 'geoengine_openapi_client',
])

for the_dir in dirs_to_remove:
if not os.path.isdir(the_dir):
continue
shutil.rmtree(the_dir)


def generate_python_code(*, package_name: str, package_version: str, package_url: str):
Expand All @@ -175,6 +192,7 @@ def generate_python_code(*, package_name: str, package_version: str, package_url
]),
"--enable-post-process-file",
"-o", "/local/python/",
"--openapi-normalizer", "REF_AS_PARENT_IN_ALLOF=true",
],
check=True,
)
Expand Down Expand Up @@ -210,6 +228,7 @@ def generate_typescript_code(*, npm_name: str, npm_version: str, repository_url:
"--git-repo-id", git_repo_id,
"--enable-post-process-file",
"-o", "/local/typescript/",
"--openapi-normalizer", "REF_AS_PARENT_IN_ALLOF=true",
],
check=True,
)
Expand All @@ -232,7 +251,7 @@ def main():
if args.build_container:
build_container()

clean_test_dirs(language=args.language)
clean_dirs(language=args.language)

if args.language == 'python':
generate_python_code(
Expand Down
Loading