[codex] Add adextensions CalloutFieldNames flag#359
Conversation
There was a problem hiding this comment.
Pull request overview
Adds strict CLI support for the Yandex Direct API AdExtensions.get nested projection CalloutFieldNames, exposed as the kebab-case flag --callout-field-names, and verifies the resulting request payloads via dry-run tests.
Changes:
- Added
direct adextensions get --callout-field-namesand wired it into the request body asCalloutFieldNames. - Ensured
--fieldscontinues to control only top-levelFieldNames, whileCalloutTextis requested only viaCalloutFieldNames. - Added dry-run and
--helpregression tests, plus validation rejecting explicitly empty--callout-field-names.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| direct_cli/commands/adextensions.py | Adds the --callout-field-names option, parses it via shared CSV parsing, validates non-empty input when provided, and includes CalloutFieldNames in the request params. |
| tests/test_dry_run.py | Adds dry-run payload coverage + help visibility + empty-input rejection coverage for --callout-field-names. |
|
@codex review. Focus on critical issues: bugs, security vulnerabilities, logical errors, data loss risks, performance problems. Do NOT nitpick style, naming conventions, minor formatting, or subjective preferences — only flag issues that could break functionality or cause real harm in production. |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…nd keywordbids
Per Yandex Direct API WSDL (tests/wsdl_cache/sitelinks.xml,
tests/wsdl_cache/keywordbids.xml), the GetRequest of both services
declares nested *FieldNames request parameters that are independent
of the top-level FieldNames:
sitelinks.get -> SitelinkFieldNames (SitelinkFieldEnum)
keywordbids.get -> SearchFieldNames (KeywordBidSearchFieldEnum)
NetworkFieldNames (KeywordBidNetworkFieldEnum)
Previously the CLI either folded these into --fields (overloading the
top-level FieldNames projection) or auto-emitted defaults with no way
to override. Mirroring the reference pattern from PR #359
(--callout-field-names), this change exposes each *FieldNames
parameter as a dedicated kebab-case option.
- direct_cli/commands/sitelinks.py: add --sitelink-field-names. Empty
CSV input rejected with UsageError; omitted means the parameter is
not sent (server default).
- direct_cli/commands/keywordbids.py: add --fields,
--search-field-names, --network-field-names. Each falls back to the
COMMON_FIELDS default when not provided so existing behavior is
preserved.
- tests/test_dry_run.py: 11 new dry-run tests covering payload shape,
--help surface, and empty-CSV rejection for the new flags.
- tests/test_api_coverage.py: new regression test
test_every_nested_fieldnames_param_has_cli_option scans every cached
WSDL get request for *FieldNames parameters and verifies that each
one has a matching kebab-case CLI option, ensuring future separate
field-list parameters cannot silently disappear. Acknowledged
remaining gaps registered in NESTED_FIELDNAMES_EXCLUSIONS with a
pointer to follow-up issue #402.
Closes #360.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…nd keywordbids (#403) Per Yandex Direct API WSDL (tests/wsdl_cache/sitelinks.xml, tests/wsdl_cache/keywordbids.xml), the GetRequest of both services declares nested *FieldNames request parameters that are independent of the top-level FieldNames: sitelinks.get -> SitelinkFieldNames (SitelinkFieldEnum) keywordbids.get -> SearchFieldNames (KeywordBidSearchFieldEnum) NetworkFieldNames (KeywordBidNetworkFieldEnum) Previously the CLI either folded these into --fields (overloading the top-level FieldNames projection) or auto-emitted defaults with no way to override. Mirroring the reference pattern from PR #359 (--callout-field-names), this change exposes each *FieldNames parameter as a dedicated kebab-case option. - direct_cli/commands/sitelinks.py: add --sitelink-field-names. Empty CSV input rejected with UsageError; omitted means the parameter is not sent (server default). - direct_cli/commands/keywordbids.py: add --fields, --search-field-names, --network-field-names. Each falls back to the COMMON_FIELDS default when not provided so existing behavior is preserved. - tests/test_dry_run.py: 11 new dry-run tests covering payload shape, --help surface, and empty-CSV rejection for the new flags. - tests/test_api_coverage.py: new regression test test_every_nested_fieldnames_param_has_cli_option scans every cached WSDL get request for *FieldNames parameters and verifies that each one has a matching kebab-case CLI option, ensuring future separate field-list parameters cannot silently disappear. Acknowledged remaining gaps registered in NESTED_FIELDNAMES_EXCLUSIONS with a pointer to follow-up issue #402. Closes #360. Co-authored-by: axisrow <[email protected]> Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Adds strict Yandex Direct API contract support for
AdExtensions.getCalloutFieldNames.Changes
direct adextensions get --callout-field-namesas the kebab-case CLI projection of APICalloutFieldNames.--fieldsscoped to top-levelFieldNames;CalloutTextis emitted only underCalloutFieldNames.--callout-field-namesinput.Validation
python3 -m black --check direct_cli/commands/adextensions.py tests/test_dry_run.pypython3 -m ruff check direct_cli/commands/adextensions.py tests/test_dry_run.pypython3 -m pytest tests/test_dry_run.py tests/test_cli.py -qpython3 -m pytest -qdirect adextensions get --types CALLOUT --fields Id,Type,State,Status --callout-field-names CalloutText --format json --dry-rungit diff --check