Skip to content

iaas component is trying to regex match on an UUID #3534

Closed

Description

@mhenselin

Description

after adding support for UUID in iaas the use of the SDK is failing with expected string or bytes-like object, got 'UUID'

Steps to reproduce

from uuid import UUID
from stackit.core.configuration import Configuration
from stackit.iaas.api.default_api import DefaultApi

def mytest():
    config_kwargs = {
        # 'region': self.region,
        'service_account_key_path': ".../svc_acc.json",
    }
    config = Configuration(**config_kwargs)

    client = DefaultApi(config)

    srv = client.list_servers(project_id=UUID("uuid"), region="eu01")

    print(srv)

if __name__ == "__main__":
    mytest()

Actual behavior

error message expected string or bytes-like object, got 'UUID'

Expected behavior

no error

Environment

  • OS: Linux
  • Python version (see python --version): 3.14.3
  • Version of the Python STACKIT SDK:
# please run the following command to get the versions of the STACKIT Python SDK versions and add the output here in this code block

$ pip list | grep "stackit"

latest stackit.iaas

Additional information

Feel free to add any additional information here.

Activity

  1. mhenselin commented on Mar 23, 2026

    @mhenselin
    Author

    I assume this needs to be fixed in the sdk generator as it seems to generate this for all:

        @field_validator("id")
        def id_validate_regular_expression(cls, value):
            """Validates the regular expression"""
            if value is None:
                return value
    
            if not re.match(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", value):
                raise ValueError(
                    r"must validate the regular expression /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/"
                )
            return value
    

    there should be a check if it is string or UUID. this re.match is obsolete on UUID.

    but it could be handled by wrapping value with str()

  2. gimbald commented on Mar 24, 2026

    @gimbald

    I ran into the same issue just today, temporary fix for it is the str wrapper as suggested above

    if isinstance(value, UUID):
                value = str(value)
    

    Probably related to this recent change no idea OpenAPITools/openapi-generator#23295

  3. cgoetz-inovex commented on Apr 27, 2026

    @cgoetz-inovex
    Contributor

    We've merged a fix upstream and are waiting for the next release

  4. cgoetz-inovex commented on May 19, 2026

    @cgoetz-inovex
    Contributor

    https://github.com/stackitcloud/stackit-sdk-python/releases/tag/release-2026-05-13
    contains the regex fix, please reopen this issue if there are still problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions