zod-openapi-share 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +13 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -6,6 +6,7 @@
6
6
  ![GitHub Release](https://img.shields.io/github/v/release/Myxogastria0808/zod-openapi-share)
7
7
  ![NPM Type Definitions](https://img.shields.io/npm/types/zod-openapi-share)
8
8
  [![Download NPM](https://img.shields.io/npm/dm/zod-openapi-share.svg?style=flat)](https://www.npmjs.com/package/zod-openapi-share)
9
+ [![NPM Downloads All Time](https://badgen.net/npm/dt/zod-openapi-share?label=downloads%20all%20time&color=cyan)](https://www.npmjs.com/package/zod-openapi-share)
9
10
  ![GitHub License](https://img.shields.io/github/license/Myxogastria0808/zod-openapi-share)
10
11
  ![Vitest](https://img.shields.io/badge/-vitest-6e9f18?style=flat&logo=vitest&logoColor=ffffff)
11
12
  ![Typedoc](https://img.shields.io/badge/docs-typedoc-blue?style=flat-square&logo=typescript&logoColor=white)
@@ -20,17 +21,20 @@ Normally, `@hono/zod-openapi` requires you to redefine the same responses (e.g.,
20
21
  ## What is `zod-openapi-share`?
21
22
 
22
23
  In projects using `hono`, you may have opportunities to use a convenient package called `@hono/zod-openapi` as middleware for generating OpenAPI schemas.
23
- This package allows you to define both **OpenAPI schemas** and **Zod-based validation** at the same time.
24
+ This package allows you to define both OpenAPI schemas and Zod-based validation at the same time.
24
25
 
25
26
  However, it has a major drawback: you must repeatedly write out the `responses` definitions for every single status code across all endpoints.
26
27
  In many cases, error responses share the exact same structure across endpoints — yet, even if they are identical, you still have to duplicate those definitions.
27
28
 
28
- To solve this, `zod-openapi-share` provides a way to **centralize and reuse response definitions** by wrapping around `@hono/zod-openapi`.
29
+ To solve this, `zod-openapi-share` provides a way to centralize and reuse response definitions by wrapping around `@hono/zod-openapi`.
29
30
  Think of `zod-openapi-share` as an extension package for `@hono/zod-openapi`.
30
31
  When using it, you’ll need three packages together: `hono`, `@hono/zod-openapi`, and `zod-openapi-share`.
31
32
 
32
33
  By unifying response definitions, you can develop without worrying about unintended inconsistencies between endpoints.
33
- If you’re using hono and @hono/zod-openapi, be sure to try **zod-openapi-share**!
34
+ If you’re using hono and @hono/zod-openapi, be sure to try `zod-openapi-share`!
35
+
36
+ <details>
37
+ <summary>before (`hono` + `@hono/zod-openapi`)</summary>
34
38
 
35
39
  ### before (`hono` + `@hono/zod-openapi`)
36
40
 
@@ -143,6 +147,10 @@ const rootPostRoute = createRoute({
143
147
  });
144
148
 
145
149
  ```
150
+ </details>
151
+
152
+ <details>
153
+ <summary>after (`hono` + `@hono/zod-openapi` + `zod-openapi-share`)</summary>
146
154
 
147
155
  ### after (`hono` + `@hono/zod-openapi` + `zod-openapi-share`)
148
156
 
@@ -252,6 +260,7 @@ const rootPostRoute = route.createSchema(
252
260
  [400, 500]
253
261
  );
254
262
  ```
263
+ </details>
255
264
 
256
265
  ## How to Use
257
266
 
@@ -427,7 +436,7 @@ export const api = () => {
427
436
  info: {
428
437
  title: 'Echo API',
429
438
  version: '1.0.0',
430
- description: '受け取った入力値をそのまま応答するAPI',
439
+ description: 'An example of OpenAPI with hono, @hono/zod-openapi, and zod-openapi-share.',
431
440
  },
432
441
  });
433
442
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod-openapi-share",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "This package is an extension package for @hono/zod-openapi.",
5
5
  "keywords": [
6
6
  "@hono/zod-openapi",