Skip to content

fix: implement openapi-fetch compat without openapi-fetch dependency#13

Merged
skulidropek merged 6 commits intomainfrom
codex/no-openapi-fetch
Feb 13, 2026
Merged

fix: implement openapi-fetch compat without openapi-fetch dependency#13
skulidropek merged 6 commits intomainfrom
codex/no-openapi-fetch

Conversation

@skulidropek
Copy link
Contributor

  • Remove openapi-fetch dependency (no longer re-export).
  • Add local src/openapi-fetch/* compatibility layer (Promise API stays drop-in; internal flow uses Effect).
  • Keep existing strict Effect client exports unchanged.
  • Relax lint rules + exclude compat layer from Effect compliance lint.

@skulidropek
Copy link
Contributor Author

Usage example

import { Effect } from "effect"
import { createClient } from "@prover-coder-ai/openapi-effect"
import type { paths } from "./openapi"

const client = createClient<paths>({
  baseUrl: "https://api.example.com"
})

export const program = Effect.gen(function* () {
  const res = yield* client.POST("/api/auth/login", {
    body: { email: "user@example.com", password: "secret" }
  })

  // openapi-fetch-compatible envelope: non-2xx stays in res.error
  if (res.error) {
    return yield* Effect.fail(new Error("Login failed"))
  }

  return res.data
})

Notes:

  • Return type is Effect<FetchResponse<...>, Error>; transport failures are in the Effect error channel, HTTP non-2xx is in res.error.
  • Input options (params, body, headers, querySerializer, pathSerializer, middleware, etc.) match openapi-fetch.

@skulidropek skulidropek merged commit 8dafeb6 into main Feb 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant