Type inference issue in Compute Module – Optional numeric fields (Type.Optional(Type.Integer())) showing as string in console

I’m facing a schema inference issue with @palantir/compute-module when using TypeBox to define input types for my compute module.

Here’s the relevant part of my schema:

const MultiHotelRateRequestSchema = Type.Object({
  hotel_codes: Type.Array(Type.String()),
  date_check_in: Type.String(),
  date_check_out: Type.String(),
  promo_codes: Type.Array(Type.String()),
  adults_count: Type.Integer(),
  children_count: Type.Optional(Type.Integer()),
  children_age: Type.Optional(Type.Array(Type.Integer()))
});

When I deploy this Compute Module, Foundry’s schema discovery seems to infer the optional numeric fields (children_count, children_age) as strings

During API testing via the Compute Module Console:

  • If I send "children_count": "2":white_check_mark: request succeeds

  • If I send "children_count": 2:cross_mark: request fails with a type validation error (“expected string”)

So Foundry’s schema validation layer is treating optional numeric fields as strings.

Environment

  • Foundry Compute Module (function backed container)

  • @palantir/compute-module (0.2.9)

  • @sinclair/typebox v0.34.41