Version
@adcp/sdk@14.0.0-beta.1 (ADCP_VERSION is 3.2.0-beta.0)
Problem
The runtime schemas exported from @adcp/sdk/schemas are substantially weaker than the 3.2 contract they represent. In particular, BiddingPolicySchema accepts empty policies, negative monetary values, and combinations that the protocol says MUST be rejected. CanonicalBudgetAllocationSchema accepts an empty optimization_goals array for seller_optimized allocation.
This prevents adopters from retiring local 3.2 validators in favor of the SDK schemas without losing correctness.
Reproduction
import {
BiddingPolicySchema,
CanonicalBudgetAllocationSchema,
} from '@adcp/sdk/schemas'
for (const value of [
{},
{ automatic: true, max_bid: 1 },
{ bid_amount: 1, max_bid: 2 },
{ bid_amount: -1 },
{
cost_per: { amount: 1, strength: 'cap' },
roas: { value: 2, strength: 'target' },
},
]) {
console.log(BiddingPolicySchema.safeParse(value).success)
}
console.log(
CanonicalBudgetAllocationSchema.safeParse({
mode: 'seller_optimized',
optimization_goals: [],
}).success,
)
On beta.1 every result is true.
The generated declarations also expose these as loose objects (z.core.$loose), so arbitrary keys are accepted as well.
Expected
The SDK's public runtime schemas should enforce the normative constraints encoded by the 3.2 schemas/protocol, including at least:
- positive monetary values;
- a non-empty bidding policy;
automatic as the only field when present;
bid_amount exclusivity relative to max_bid, cost_per, and roas;
cost_per / roas exclusivity;
- non-empty
seller_optimized.optimization_goals; and
- the relevant nested cross-field rules (for example campaign duration and required custom event names).
If the generated structural schemas intentionally cannot provide semantic validation, the package should export a clearly named strict/semantic validation surface and document that the generated schemas are not safe protocol admission validators. Ideally server request validation and public leaf-schema validation should share the same refinements so they cannot drift.
Adoption impact
We currently maintain a quarantined repo-owned copy of these validators while preparing 3.2 support. The SDK now exports the desired types and shapes, but replacing the local runtime boundary with these schemas would admit invalid requests before provider mutation. This is therefore a blocker to retiring that compatibility work.
Version
@adcp/sdk@14.0.0-beta.1(ADCP_VERSIONis3.2.0-beta.0)Problem
The runtime schemas exported from
@adcp/sdk/schemasare substantially weaker than the 3.2 contract they represent. In particular,BiddingPolicySchemaaccepts empty policies, negative monetary values, and combinations that the protocol says MUST be rejected.CanonicalBudgetAllocationSchemaaccepts an emptyoptimization_goalsarray forseller_optimizedallocation.This prevents adopters from retiring local 3.2 validators in favor of the SDK schemas without losing correctness.
Reproduction
On beta.1 every result is
true.The generated declarations also expose these as loose objects (
z.core.$loose), so arbitrary keys are accepted as well.Expected
The SDK's public runtime schemas should enforce the normative constraints encoded by the 3.2 schemas/protocol, including at least:
automaticas the only field when present;bid_amountexclusivity relative tomax_bid,cost_per, androas;cost_per/roasexclusivity;seller_optimized.optimization_goals; andIf the generated structural schemas intentionally cannot provide semantic validation, the package should export a clearly named strict/semantic validation surface and document that the generated schemas are not safe protocol admission validators. Ideally server request validation and public leaf-schema validation should share the same refinements so they cannot drift.
Adoption impact
We currently maintain a quarantined repo-owned copy of these validators while preparing 3.2 support. The SDK now exports the desired types and shapes, but replacing the local runtime boundary with these schemas would admit invalid requests before provider mutation. This is therefore a blocker to retiring that compatibility work.