Repository navigation
Type Bazaar bodyType as json, form-data or text - #165
Conversation
createBazaarDiscovery typed bodyType as 'json' | 'form', but the x402 discovery schema only accepts json, form-data and text, so a declaration using 'form' fails validation. Tests run each accepted value through the upstream validator after enrichment and confirm 'form' is rejected.
Review: Bazaar bodyType union (head
|
|
Body wording corrected: the tests fail if upstream drops one of the three accepted values or starts accepting 'form', and would not catch a value upstream adds later. Merging after #164, then updating from main so the dependency scan picks up the qs fix. |
Summary
createBazaarDiscoverytypedbodyTypeas'json' | 'form', but the x402 discovery schema accepts onlyjson,form-dataandtext. A declaration using'form'is rejected by the upstream validator (/input/bodyType: must be equal to one of the allowed values), and the types offered no way to declare a multipart or text body. This narrows the type to upstream's set.Type of change
Public API
BazaarDiscoveryConfig.bodyTypeis now'json' | 'form-data' | 'text'. A caller passing'form'now gets a type error. Such a declaration already failed upstream validation, so this changes no working behavior.Test plan
tests/discovery/bazaar.test.tsdeclare each accepted value, enrich it withenrichBazaarDiscoveryExtensions, and run upstream'svalidateDiscoveryExtension, which returns{ valid: true }. A separate test confirms'form'comes back invalid with abodyTypeerror, so the suite fails if upstream drops one of our three values or starts accepting'form'. A value upstream adds later would not fail it.bun run lint,typecheck,test(1641 passed, 4 skipped) andknipall exit 0.srcandexamples, nottests, so the runtime tests are what hold this in place.body_typeas a plainstr, so it has no equivalent wrong value.Checklist
bodyType: 'form')