Skip to content

Date transformers not generated for collection endpoints using $ref #2902

@ploca14

Description

@ploca14

Description

Description

Date transformers are not generated for collection endpoints, when:

  1. Collection items use $ref to reference component schemas (not inline schemas)
  2. The same schema component IS transformed correctly when used directly

Expected Behavior

The same schema component (UserMatch.jsonld-match.collection.read) IS transformed correctly when used directly:

  • Single-item endpoint (/api/admin/{company}/matches/{id}/{kind}) → transformer generated
  • Collection endpoint (/api/admin/{company}/matches) → transformer NOT generated

Generated code:

export function getAdminCompanyMatchesIdKind(...) {
  return client.get({
    responseTransformer: apiAdminCompanymatchesIdKindGetResponseTransformer,
    url: '/api/admin/{company}/matches/{id}/{kind}',
  })
}

export function listAdminCompanyMatches(...) {
  return client.get({
    // responseTransformer: MISSING
    url: '/api/admin/{company}/matches',
  })
}

Actual Behavior

  1. TypeScript types claim dates are Date: lastMessageSentAt?: Date | null
  2. Runtime data has dates as strings (JSON doesn't have Date types)
  3. Code expecting Date objects fails at runtime (e.g., calling .getTime() on a string)

Reproducible example or configuration

https://stackblitz.com/edit/hey-api-client-fetch-example-a95akxjr?file=repro-client%2Fsdk.gen.ts

OpenAPI specification (optional)

No response

System information (optional)

No response

Metadata

Metadata

Assignees

Labels

bug 🔥Something isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions