Skip to content

In empty_call_test , test that an exception is raised if request=None and a field in the request message is marked as required #2158

@parthea

Description

@parthea

See feedback in #2126 (comment) from review of PR #2126 which calls out that empty_call_test should test that an exception is raised if request=None and a field in the request message is marked as required.

But we're applying this test even to methods where the API requires a non-empty request, right? It would be great if we type-hinted methods sufficiently so that for methods requiring a request, the type is specified as the proper request object, and for methods with optional requests, the type is specified as a nullable request of the appropriate type. Then this macro would be applied to just the latter set of methods (and we could also test that sending request=None to the former set would raise warnings or errors).

We won't be able to change the type hint because flattened fields could be sent instead of using the request argument but we should be able to raise an exception if request=None and a field in the request message is marked as required

We could also consider adding this as part of client library AIPs if it doesn't already exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: cleanupAn internal cleanup or hygiene concern.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions