Skip to content

Response drift: suibets — offers[].id is integer in live API; interface declares string #2013

Description

@realfishsam

Exchange

suibets

Severity

LOW

What Our Normalizer Expects

core/src/exchanges/suibets/fetcher.ts declares SuibetsRawOffer.id as string:

// fetcher.ts — SuibetsRawOffer
id: string;

The normalizer uses raw.id as a string identifier (e.g. in ID construction and deduplication).

What The Live API Returns

The live GET https://www.suibets.com/api/p2p/offers response returns id as an integer, not a string:

[].id: int   ← integer (interface expects string)

Endpoint tested: GET https://www.suibets.com/api/p2p/offers?status=all

Impact

LOW: JavaScript silently coerces integers to strings at template-literal and string-concatenation boundaries, so no immediate crash occurs. However:

  • The TypeScript interface misrepresents the actual type, misleading developers
  • Any code path calling string-only methods on raw.id before coercion (.toLowerCase(), .split(), .replace()) will throw TypeError: raw.id.toLowerCase is not a function
  • If raw.id is compared against a string-typed ID from another source after a JSON round-trip, identity lookups silently fail (integer 123 !== string "123" in strict equality)

Suggested Fix

Update the interface and coerce explicitly:

// fetcher.ts — SuibetsRawOffer
id: number;   // was: string

// normalizer.ts — wherever raw.id is used as a string key
id: String(raw.id),

Found by automated response shape drift audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    response-driftLive API response shape differs from normalizer expectations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions