swagger-typescript-api icon indicating copy to clipboard operation
swagger-typescript-api copied to clipboard

fix: incorrect format detection when using `$ref #/responses/*`

Open axel7083 opened this issue 1 week ago • 2 comments

Fixes https://github.com/acacode/swagger-typescript-api/issues/1547


The snapshots have been updated using vitest --update


[!NOTE] Fixes response format detection when responses use $ref, resulting in proper "json" format in generated requests; adds test coverage and updates snapshots.

  • Core
    • Update src/schema-routes/schema-routes.ts to pass contentTypes into getRequestInfoTypes, ensuring correct contentKind/format resolution for $ref-based responses.
  • Tests
    • Add tests/spec/extractResponseRef/basic.test.ts and tests/spec/extractResponseRef/schema.json with snapshot tests/spec/extractResponseRef/__snapshots__/basic.test.ts.snap.
    • Refresh snapshots across projects to reflect explicit format: "json" in generated requests.
  • Release
    • Add changeset (.changeset/stale-masks-hug.md) for a patch bump of swagger-typescript-api.

Written by Cursor Bugbot for commit 5971174250a777b8ebf20c54d1894d3ae938de92. This will update automatically on new commits. Configure here.

axel7083 avatar Dec 10 '25 12:12 axel7083