Skip to content

feat!: sync SDK with OpenAPI spec, remove stale resources, v3.0.0#170

Merged
benminer merged 1 commit into
mainfrom
feature/full-api-schema-regeneration
May 27, 2026
Merged

feat!: sync SDK with OpenAPI spec, remove stale resources, v3.0.0#170
benminer merged 1 commit into
mainfrom
feature/full-api-schema-regeneration

Conversation

@benminer
Copy link
Copy Markdown
Collaborator

Summary

  • Fixes schema generation regex escaping bug that broke automated regeneration since April 17
  • Regenerates all buyer Zod schemas from the live OpenAPI spec (~255 schemas)
  • Removes 12 stale/storefront-only resources: agents, billing (storefront), bundles, conversion-events, creative-sets, inventory-sources, notifications, products, readiness, sales-agents, signals, storefront
  • Adds 8 missing buyer resources: accounts, audit-logs, discovery, moderation, notification-preferences, planning-briefs, storefronts, billing (buyer invoices)
  • Expands existing resources with missing endpoints (campaigns CRUD, measurement-data, event-sources, creatives, advertisers, test-cohorts)

Test plan

  • tsc --noEmit passes
  • All 39 test suites pass (417 tests + 12 todo placeholders for removed resources)
  • Prettier and ESLint clean
  • CI passes
  • Run npm run detect-drift to confirm reduced endpoint drift

Fix schema generation regex escaping bug that broke Prettier since April 17.
Regenerate buyer schemas from live spec. Remove all storefront-only and
deprecated resources (agents, billing/storefront, inventory-sources,
notifications, readiness, bundles, signals, sales-agents, conversion-events,
creative-sets). Add missing buyer endpoints (discovery, accounts,
planning-briefs, moderation, storefronts, audit-logs, notification-preferences).
Replace typed campaign creation methods with generic create/update/delete.

BREAKING CHANGE: Storefront persona removed. Multiple resources deleted.
Campaign API surface changed from typed methods to generic CRUD.
@benminer benminer requested a review from a team May 27, 2026 17:06
@benminer benminer merged commit e26b97b into main May 27, 2026
6 checks passed
@benminer benminer deleted the feature/full-api-schema-regeneration branch May 27, 2026 17:37
});
});
describe('removed', () => {
it.todo('resource removed in v3');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the resource is gone, just delete the test file - the describe('removed') placeholder is noise. also 'resource removed in v3' is a temporal reference in code (same issue with the other it.todo stubs across the removed test files)

Comment thread src/client.ts
throw new Error(`Unknown persona: ${_exhaustive}`);
}
}
this._advertisers = new AdvertisersResource(this.adapter);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the exhaustive switch with _exhaustive: never caught unhandled personas at compile time - now that it's gone, new Scope3Client({ persona: 'storefront' }) silently gets buyer resources with no error. if storefront persona is being dropped, narrow Persona to 'buyer'. if not, the behavior change is a footgun

Comment thread src/types/index.ts
brief?: string;
constraints?: CampaignConstraints;
performanceConfig?: PerformanceConfig;
[key: string]: unknown;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this index signature effectively turns off the type checker for CreateCampaignInput - anything goes. if campaign types need different optional fields depending on type, a discriminated union would be safer. intentional?

result.data = validateResponse(campaignSchemas.response, result.data) as unknown as Campaign;
}
return result;
async create(data: CreateCampaignInput): Promise<ApiResponse<Campaign>> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the old typed create methods called validateResponse(campaignSchemas.response, ...) - dropped here. intentional?

* @param data Optional configuration for product selection
* @returns Auto-selection result
*/
async autoSelectProducts(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are response shapes defined in the spec for autoSelectProducts, getMediaBuyStatus, getProducts? if so worth typing them rather than Record<string, unknown>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants