Open2
openapi-fetch

以下のようにcreateClient
しつつpathsを渡して使う
import createClient from "openapi-fetch";
import type { paths } from "./my-openapi-3-schema"; // openapi-typescriptで生成された型
const client = createClient<paths>({ baseUrl: "https://myapi.dev/v1/" });
const {
data, // 2XXレスポンスの場合のみ存在
error, // 4XXまたは5XXレスポンスの場合のみ存在
} = await client.GET("/blogposts/{post_id}", {
params: {
path: { post_id: "123" },
},
});

packageの構成について
- packages/openapi-fetch/src/index.js がメインの実装
- test
- noStrictNullChecks.test
- packages/openapi-fetch/test/index.bench.js で benchとってる
- index.e2e.ts でplaywrightを使ったe2e
- index.test.ts で基本的な動作のテストとexpectTypeOfを使用した型のテスト
e2eでどんなことを書いているか
index.testでどんなことを書いているか