Skip to content

Improved Hey API configuration#33

Merged
spietras merged 1 commit into
mainfrom
hey-api
Feb 10, 2026
Merged

Improved Hey API configuration#33
spietras merged 1 commit into
mainfrom
hey-api

Conversation

@spietras
Copy link
Copy Markdown
Member

No description provided.

@spietras spietras self-assigned this Feb 10, 2026
@spietras spietras added the cleanup Stay fresh label Feb 10, 2026
@spietras spietras requested a review from Copilot February 10, 2026 18:50
@spietras spietras merged commit 4709201 into main Feb 10, 2026
6 checks passed
@spietras spietras deleted the hey-api branch February 10, 2026 18:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the generated Hey API client + schemas configuration for the icanhazdadjoke OpenAPI integration, aiming to improve robustness of JSON parsing and expand date/datetime handling in the Zod generator.

Changes:

  • Switched generated Zod import style to a namespace import (import * as z from "zod").
  • Made Fetch client JSON parsing tolerant of 200 responses with an empty body (no Content-Length).
  • Extended openapi-ts Zod plugin config to allow local/offset datetimes.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/src/common/apis/icanhazdadjoke/schemas.ts Updates Zod import style in generated schemas.
src/src/common/apis/icanhazdadjoke/client/clnt.ts Adjusts JSON parsing for empty-body 200s; passes serializedBody into SSE client.
src/openapi-ts.config.mts Adds dates configuration for Zod schema generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// Some servers return 200 with no Content-Length and empty body.
// response.json() would throw; read as text and parse if non-empty.
const text = await response.text();
data = text ? JSON.parse(text) : {};
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

response.text() can return whitespace-only bodies (e.g., "\n"); text ? JSON.parse(text) : {} will treat that as non-empty and throw on JSON.parse. Consider trimming before the emptiness check (e.g., const trimmed = text.trim()), so whitespace-only responses are handled the same as empty bodies.

Suggested change
data = text ? JSON.parse(text) : {};
const trimmed = text.trim();
data = trimmed ? JSON.parse(trimmed) : {};

Copilot uses AI. Check for mistakes.
Comment thread src/src/common/apis/icanhazdadjoke/client/clnt.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Stay fresh

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants