Skip to content

Prevent PydanticUserError #90

@oxesoft

Description

@oxesoft

high

In the generated ApiClient.send method, TypeAdapter(type_) will raise a PydanticUserError if type_ is None. This occurs for API endpoints that return no content (e.g., 204 No Content). Additionally, the method should return None when type_ is None to remain consistent with the method's overloads.

                if type_ is None:
                    return None
                adapter = TypeAdapter(type_)
                if type_ == bytes:
                    return adapter.validate_python(response.content)
                return adapter.validate_python(response.json())

Originally posted by @gemini-code-assist[bot] in #86 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions