Skip to content

Doc: Update openapi-fetch minified size #1851

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
6 changes: 3 additions & 3 deletions docs/openapi-fetch/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: openapi-fetch

<img src="/assets/openapi-fetch.svg" alt="openapi-fetch" width="216" height="40" />

openapi-fetch is a type-safe fetch client that pulls in your OpenAPI schema. Weighs **5 kb** and has virtually zero runtime. Works with React, Vue, Svelte, or vanilla JS.
openapi-fetch is a type-safe fetch client that pulls in your OpenAPI schema. Weighs **6 kb** and has virtually zero runtime. Works with React, Vue, Svelte, or vanilla JS.

| Library | Size (min) | “GET” request\* |
| :------------------------- | ---------: | :------------------------- |
Expand All @@ -17,7 +17,7 @@ openapi-fetch is a type-safe fetch client that pulls in your OpenAPI schema. Wei

_\* [Benchmarks are approximate](https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-fetch/test/index.bench.js) to just show rough baseline and will differ among machines and browsers. The relative performance between libraries is more reliable._

The syntax is inspired by popular libraries like react-query or Apollo client, but without all the bells and whistles and in a 5 kb package.
The syntax is inspired by popular libraries like react-query or Apollo client, but without all the bells and whistles and in a 6 kb package.

::: code-group

Expand Down Expand Up @@ -56,7 +56,7 @@ Notice there are no generics, and no manual typing. Your endpoint’s request an
- ✅ No manual typing of your API
- ✅ Eliminates `any` types that hide bugs
- ✅ Also eliminates `as` type overrides that can also hide bugs
- ✅ All of this in a **5 kb** client package 🎉
- ✅ All of this in a **6 kb** client package 🎉

## Setup

Expand Down
15 changes: 8 additions & 7 deletions docs/zh/openapi-fetch/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ title: openapi-fetch

<img src="/assets/openapi-fetch.svg" alt="openapi-fetch" width="216" height="40" />

`openapi-fetch`是一个类型安全的`fetch`客户端,用于拉取您的OpenAPI模式。大小为**5 kb**,几乎没有运行时。适用于React、Vue、Svelte或纯JS。
`openapi-fetch`是一个类型安全的`fetch`客户端,用于拉取您的OpenAPI模式。大小为**6 kb**,几乎没有运行时。适用于React、Vue、Svelte或纯JS。

| 库 | 大小(最小) | “GET” 请求 |
| :------------------------- | -----------: | :-------------------------- |
| openapi-fetch | `5 kB` | `278k` 操作/秒(最快) |
| openapi-typescript-fetch | `4 kB` | `130k` 操作/秒(2.1× 较慢) |
| axios | `32 kB` | `217k` 操作/秒(1.3× 较慢) |
| superagent | `55 kB` | `63k` 操作/秒(4.4× 较慢) |
| openapi-typescript-codegen | `367 kB` | `106k` 操作/秒(2.6× 较慢) |
| openapi-fetch | `6 kB` | `300k` 操作/秒(最快) |
| openapi-typescript-fetch | `3 kB` | `300k` 操作/秒(最快) |
| feature-fetch | `15 kB` | `300k` ops/s (fastest) |
| axios | `32 kB` | `225k` 操作/秒(1.3× 较慢) |
| superagent | `55 kB` | `50k` 操作/秒(6× 较慢) |
| openapi-typescript-codegen | `367 kB` | `100k` 操作/秒(3× 较慢) |

语法灵感来自流行的库,如`react-query`或`Apollo client`,但没有所有这些功能,并且包大小仅为5 kb。

Expand Down Expand Up @@ -53,7 +54,7 @@ await client.PUT("/blogposts", {
- ✅ 无需手动输入API
- ✅ 消除隐藏错误的 `any` 类型
- ✅ 还消除了可能隐藏错误的 `as` 类型覆盖
- ✅ 所有这些都在一个 **5 kb** 的客户端包中 🎉
- ✅ 所有这些都在一个 **6 kb** 的客户端包中 🎉

## 安装

Expand Down
6 changes: 3 additions & 3 deletions packages/openapi-fetch/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<img src="../../docs/public/assets/openapi-fetch.svg" alt="openapi-fetch" width="216" height="40" />

openapi-fetch is a type-safe fetch client that pulls in your OpenAPI schema. Weighs **5 kb** and has virtually zero runtime. Works with React, Vue, Svelte, or vanilla JS.
openapi-fetch is a type-safe fetch client that pulls in your OpenAPI schema. Weighs **6 kb** and has virtually zero runtime. Works with React, Vue, Svelte, or vanilla JS.

| Library | Size (min) | “GET” request\* |
| :------------------------- | ---------: | :------------------------- |
Expand All @@ -13,7 +13,7 @@ openapi-fetch is a type-safe fetch client that pulls in your OpenAPI schema. Wei

_\* [Benchmarks are approximate](https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-fetch/test/index.bench.js) to just show rough baseline and will differ among machines and browsers. The relative performance between libraries is more reliable._

The syntax is inspired by popular libraries like react-query or Apollo client, but without all the bells and whistles and in a 5 kb package.
The syntax is inspired by popular libraries like react-query or Apollo client, but without all the bells and whistles and in a 6 kb package.

```ts
import createClient from "openapi-fetch";
Expand Down Expand Up @@ -48,7 +48,7 @@ Notice there are no generics, and no manual typing. Your endpoint’s request an
- ✅ No manual typing of your API
- ✅ Eliminates `any` types that hide bugs
- ✅ Also eliminates `as` type overrides that can also hide bugs
- ✅ All of this in a **5 kb** client package 🎉
- ✅ All of this in a **6 kb** client package 🎉

## Setup

Expand Down
2 changes: 1 addition & 1 deletion packages/openapi-fetch/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openapi-fetch",
"description": "Fast, type-safe fetch client for your OpenAPI schema. Only 5 kb (min). Works with React, Vue, Svelte, or vanilla JS.",
"description": "Fast, type-safe fetch client for your OpenAPI schema. Only 6 kb (min). Works with React, Vue, Svelte, or vanilla JS.",
"version": "0.11.1",
"author": {
"name": "Drew Powers",
Expand Down