gapic-generator-python icon indicating copy to clipboard operation
gapic-generator-python copied to clipboard

Determine if mock_value should populate multiple nested fields

Open parthea opened this issue 1 year ago • 1 comments

The mock_value method which is show below is used for test purposes. There is a limitation where mock_value only populates a single nested field in a message. When a method signature contains multiple nested fields, this leads to failures in generated tests like https://github.com/googleapis/gapic-generator-python/issues/1955.

https://github.com/googleapis/gapic-generator-python/blob/af3396665b40c748423599c4658ada8685f7bd36/gapic/schema/wrappers.py#L176-L184

https://github.com/googleapis/gapic-generator-python/blob/af3396665b40c748423599c4658ada8685f7bd36/gapic/schema/wrappers.py#L202-L210

field.mock_value shown below only includes a single nested field and this is appears to be as intended based on the comment If this is another message, set one value on the message. .

https://github.com/googleapis/gapic-generator-python/blob/af3396665b40c748423599c4658ada8685f7bd36/gapic/templates/tests/unit/gapic/%25name_%25version/%25sub/test_macros.j2#L431

parthea avatar Feb 23 '24 17:02 parthea

Bumping to p3 as we don't currently have any APIs that are blocked on https://github.com/googleapis/gapic-generator-python/issues/1955

parthea avatar Apr 16 '24 18:04 parthea