Skip to content

Docs: Update benchmarks & sizes #1850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/openapi-fetch/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ openapi-fetch is a type-safe fetch client that pulls in your OpenAPI schema. Wei

| Library | Size (min) | “GET” request\* |
| :------------------------- | ---------: | :------------------------- |
| openapi-fetch | `5 kB` | `300k` ops/s (fastest) |
| openapi-typescript-fetch | `4 kB` | `150k` ops/s (2× slower) |
| feature-fetch | `15 kB` | `300k` ops/s (not slower) |
| openapi-fetch | `6 kB` | `300k` ops/s (fastest) |
| openapi-typescript-fetch | `3 kB` | `300k` ops/s (fastest) |
| feature-fetch | `15 kB` | `300k` ops/s (fastest) |
| axios | `32 kB` | `225k` ops/s (1.3× slower) |
| superagent | `55 kB` | `50k` ops/s (6× slower) |
| openapi-typescript-codegen | `367 kB` | `100k` ops/s (3× slower) |
Expand Down Expand Up @@ -178,7 +178,9 @@ If you prefer selecting the path as a property, you can create a path based clie
import { createPathBasedClient } from "openapi-fetch";
import type { paths } from "./my-openapi-3-schema"; // generated by openapi-typescript

const client = createPathBasedClient<paths>({ baseUrl: "https://myapi.dev/v1" });
const client = createPathBasedClient<paths>({
baseUrl: "https://myapi.dev/v1",
});

client["/blogposts/{post_id}"].GET({
params: { post_id: "my-post" },
Expand Down
11 changes: 6 additions & 5 deletions packages/openapi-fetch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ openapi-fetch is a type-safe fetch client that pulls in your OpenAPI schema. Wei

| Library | Size (min) | “GET” request\* |
| :------------------------- | ---------: | :------------------------- |
| openapi-fetch | `5 kB` | `300k` ops/s (fastest) |
| openapi-typescript-fetch | `4 kB` | `150k` ops/s (2× slower) |
| openapi-fetch | `6 kB` | `300k` ops/s (fastest) |
| openapi-typescript-fetch | `3 kB` | `300k` ops/s (fastest) |
| feature-fetch | `15 kB` | `300k` ops/s (fastest) |
| axios | `32 kB` | `225k` ops/s (1.3× slower) |
| superagent | `55 kB` | `50k` ops/s (6× slower) |
| openapi-typescript-codegen | `367 kB` | `100k` ops/s (3× slower) |
Expand Down Expand Up @@ -59,7 +60,7 @@ npm i -D openapi-typescript typescript
```

> **Highly recommended**
>
>
> Enable [noUncheckedIndexedAccess](https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess) in your `tsconfig.json` ([docs](/advanced#enable-nouncheckedindexaccess-in-your-tsconfigjson))

Next, generate TypeScript types from your OpenAPI schema using openapi-typescript:
Expand All @@ -81,7 +82,7 @@ Lastly, be sure to **run typechecking** in your project. This can be done by add
And run `npm run test:ts` in your CI to catch type errors.

> **TIP:**
>
>
> Use `tsc --noEmit` to check for type errors rather than relying on your linter or your build command. Nothing will typecheck as accurately as the TypeScript compiler itself.

## Basic usage
Expand Down Expand Up @@ -118,4 +119,4 @@ const { data, error } = await client.PUT("/blogposts", {

## 📓 Docs

[View Docs](https://openapi-ts.dev/openapi-fetch/)
[View Docs](https://openapi-ts.dev/openapi-fetch/)
2 changes: 1 addition & 1 deletion packages/openapi-fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"devDependencies": {
"axios": "^1.7.4",
"del-cli": "^5.1.0",
"esbuild": "^0.20.2",
"esbuild": "^0.23.0",
"execa": "^8.0.1",
"feature-fetch": "^0.0.15",
"msw": "^2.3.1",
Expand Down
Loading