Skip to content

Update openapitools/openapi-generator-cli Docker tag to v7

Merge Request

Breaking Changes

Migration

If you do not want to use the new Python client yet, you can switch to the old client, which is now considered deprecated. Please note that in the future there may be a reason to remove the old Python client altogether. Therefore, you should definitely consider migrating.

Configuration

It is no longer necessary to set the conf.access_token to None. This was a bug in the old client that no longer exists in the new one:

Old

conf = Configuration(host=HOST, api_key={"apikey": APIKEY})
conf.access_token = None
client = ApiClient(configuration=conf)

New

conf = Configuration(host=HOST, api_key={"apikey": APIKEY})
client = ApiClient(configuration=conf)

Imports

Unfortunately, the new python client no longer provide a common import package, so you have to import everything from the respective module:

Old

from shepard_client import (
    ApiClient,
    Collection,
    CollectionApi,
    Configuration
)

New

from shepard_client.api.collection_api import CollectionApi
from shepard_client.api_client import ApiClient
from shepard_client.configuration import Configuration
from shepard_client.models.collection import Collection

Attributes in camelCase

Although Python normally uses the snake_case naming convention, the new Python client uses the attribute names directly from Shepard and thus the camelCase naming convention:

Old

    data_object = DataObject(
        name="MyDataObject",
        description="A data object",
        parent_id=123,
        predecessor_ids=[456],
    )

New

    data_object = DataObject(
        name="MyDataObject",
        description="A data object",
        parentId=123,
        predecessorIds=[456],
    )

Attributes are dictionaries of the type dict[str, str]

The attributes of a DataObject or a collection must now be dictionaries that only contain strings. The old client secretly converted other values anyway:

Old

    collection = Collection(
        attributes={"a": "b", "c": 123},
        name="A Collection",
        description="A collection for testing purposes",
    )

New

    collection = Collection(
        attributes={"a": "b", "c": "123"},
        name="A Collection",
        description="A collection for testing purposes",
    )

Strict type checks

The new Python client uses strict type checking. Therefore, if you have enabled strict type checking in your IDE, you may need to ensure that a return value is not None before using it further:

    file_api = FileApi(client)
    container = FileContainer(name="A File Container")
    container = file_api.create_file_container(container)

    if not container.id:
        raise RuntimeError("No file container")

    file1 = file_api.create_file(container.id, "./file1.txt")

Description

This MR contains the following updates:

Package Type Update Change
openapitools/openapi-generator-cli image-name major v6.6.0 -> v7.3.0

This MR has been generated by Renovate Bot.

Checklist

  • The code compiles without any warnings.
  • I followed the code review checklist.
  • The documentation has been added/updated.
  • There are no System.out.println() statements.

Related Issues

Edited by Tobias Haase

Merge request reports