Skip to content

fix: WSDL FieldName enums not validated — default fields diverge from API schema #108

Description

@axisrow

Problem

CLI default FieldNames for several get commands contain values that don't exist in the corresponding WSDL *FieldEnum definitions. The current test suite (test_api_coverage.py) validates method-level coverage and dry-run payload shapes, but does not check whether default FieldNames match WSDL enums.

This causes error_code=8000 (Invalid request) at runtime when the API rejects unknown field names.

Confirmed mismatches

1. Invalid field names (cause API error 8000)

Resource CLI sends Invalid field(s) WSDL-valid alternatives
strategies ["Id", "Name", "Type", "IsArchived"] IsArchived StatusArchived
turbopages ["Id", "Name", "Status", "Href"] Status TurboSiteHref, PreviewHref, BoundWithHref
businesses ["Id", "Name", "Url"] Url ProfileUrl, InternalUrl, Urls
smartadtargets ["Id", "CampaignId", "AdGroupId", "Status", "ServingStatus"] Status, ServingStatus State

Note: strategies, turbopages, businesses are already fixed in #107. smartadtargets is still broken.

2. Missing fields (data silently omitted from response)

Resource CLI sends Missing useful field
adextensions ["Id", "Type", "Status"] State (exists in WSDL)

3. Dual-source inconsistency

Some commands hardcode default fields instead of using COMMON_FIELDS from utils.py, creating two independent sources of truth that can diverge:

Resource COMMON_FIELDS (utils.py) Hardcoded in command Diverges?
strategies (not defined) ["Id", "Name", "Type", "IsArchived"] N/A
turbopages ["Id", "Name", ...] ["Id", "Name", ...] No
businesses ["Id", "Name", ...] ["Id", "Name", ...] No
ads [..., "TextAd"] ["Id", "CampaignId", "AdGroupId", "Status", "State", "Type"] Yes — COMMON_FIELDS includes TextAd, command doesn't
adextensions ["Id", "Type", "Status"] ["Id", "Type", "Status"] No

Typical mismatch patterns

  1. Renamed field: API renamed the field but CLI wasn't updated (e.g. IsArchivedStatusArchived)
  2. Removed field: Field existed in older API version but was removed (e.g. Status in turbopages)
  3. Invented field: Developer assumed a field name that was never in the schema (e.g. Url in businesses — API has ProfileUrl, InternalUrl, Urls)
  4. Wrong enum: Field valid for a different resource type was used (e.g. Status/ServingStatus from campaigns applied to smartadtargets which only has State)

What broke in tests

All 6 failures from the integration test run (#96):

strategies get  → error_code=8000: "IsArchived" invalid enum value
turbopages get  → error_code=8000: "Status" invalid enum value  
businesses get  → error_code=8000: "Url" invalid enum value + requires SelectionCriteria filter
leads get       → exit_code=2: test used --campaign-ids (nonexistent option, requires --turbo-page-ids)
advideos get    → error_code=8000: omitted required parameter Ids (no list-all endpoint)
agencyclients   → error_code=54: not an agency account (test didn't catch error_code=54)

Proposed fix

Add a test in test_api_coverage.py that:

  1. Parses all *FieldEnum definitions from tests/wsdl_cache/*.xml
  2. Extracts default FieldNames from each CLI get command (both COMMON_FIELDS and hardcoded)
  3. Asserts every default field exists in the corresponding WSDL enum
  4. Reports mismatches with the exact WSDL-expected values

This would have caught all 4 invalid-field bugs before they reached integration tests.

Remaining work after #107

  • Fix smartadtargets default fields: Status/ServingStatusState
  • Add State to adextensions default fields
  • Remove Type from businesses COMMON_FIELDS (not in WSDL enum)
  • Add FieldNames WSDL validation test to test_api_coverage.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions