Let fields be sent raw in table schema definition

As per https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#TableFieldSchema
the `fields` attribute can recursively define more fields if the `type`
attribute is RECORD. There is no way to define recursive argument spec
in ansible modules, but if sent as `raw`:

> The raw type, performs no type validation or type casting, and maintains the type of the passed value.

(from https://docs.ansible.com/ansible/latest/dev_guide/developing_program_flow_modules.html#argument-spec)

Which works for what we're trying to accomplish here.

Also added integration test for this change
This commit is contained in:
Jorge Gallegos 2025-06-27 12:12:06 -06:00
commit 63d7025012
No known key found for this signature in database
3 changed files with 101 additions and 4 deletions

View file

@ -181,7 +181,7 @@ options:
fields:
description:
- Describes the nested schema fields if the type property is set to RECORD.
elements: str
elements: raw
required: false
type: list
mode:
@ -296,7 +296,7 @@ options:
description:
- Describes the nested schema fields if the type property is set to
RECORD .
elements: str
elements: raw
required: false
type: list
mode:
@ -1045,7 +1045,7 @@ def main():
elements='dict',
options=dict(
description=dict(type='str'),
fields=dict(type='list', elements='str'),
fields=dict(type='list', elements='raw'),
mode=dict(type='str'),
name=dict(type='str'),
type=dict(type='str'),
@ -1072,7 +1072,7 @@ def main():
elements='dict',
options=dict(
description=dict(type='str'),
fields=dict(type='list', elements='str'),
fields=dict(type='list', elements='raw'),
mode=dict(type='str'),
name=dict(type='str'),
type=dict(type='str'),