@kamaalio/hono-standard-openapi 0.0.9 → 0.0.10
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.
- package/README.md +4 -2
- package/dist/standard-schema.js +1 -1
- package/dist/standard-schema.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ validator. Routes validate requests, infer handler types, and generate a matchin
|
|
|
11
11
|
- [Add response examples](#add-response-examples)
|
|
12
12
|
- [Handle validation errors](#handle-validation-errors)
|
|
13
13
|
- [Read the OpenAPI document](#read-the-openapi-document)
|
|
14
|
+
- [Using ArkType](./docs/arktype.md)
|
|
14
15
|
- [Using Zod](./docs/zod.md)
|
|
15
16
|
- [Using Valibot](./docs/valibot.md)
|
|
16
17
|
|
|
@@ -60,7 +61,7 @@ app.openapi(getCard, c => {
|
|
|
60
61
|
|
|
61
62
|
Use `$id` once to make a schema a reusable OpenAPI component. The generated response then refers
|
|
62
63
|
to `#/components/schemas/Card`. See the guides for nested components, multiple responses, errors,
|
|
63
|
-
and the Valibot converter setup.
|
|
64
|
+
ArkType metadata, and the Valibot converter setup.
|
|
64
65
|
|
|
65
66
|
## Add middleware to a route
|
|
66
67
|
|
|
@@ -90,7 +91,7 @@ const getCard = createRoute({
|
|
|
90
91
|
## Add response examples
|
|
91
92
|
|
|
92
93
|
Put an OpenAPI `example` next to a response media type. This is independent of the schema library,
|
|
93
|
-
so it works with Zod, Valibot, and every other supported Standard Schema library:
|
|
94
|
+
so it works with ArkType, Zod, Valibot, and every other supported Standard Schema library:
|
|
94
95
|
|
|
95
96
|
```ts
|
|
96
97
|
responses: {
|
|
@@ -150,5 +151,6 @@ that needs the document directly, call `app.getOpenAPIDocument(config)` with the
|
|
|
150
151
|
|
|
151
152
|
## Guides
|
|
152
153
|
|
|
154
|
+
- [Use ArkType](./docs/arktype.md): native JSON Schema, components, multiple responses, and errors.
|
|
153
155
|
- [Use Zod](./docs/zod.md): components, multiple responses, and validation errors.
|
|
154
156
|
- [Use Valibot](./docs/valibot.md): converter setup, components, multiple responses, and errors.
|
package/dist/standard-schema.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function isStandardSchema(value) {
|
|
2
|
-
if (typeof value !== 'object' || value == null || !('~standard' in value)) {
|
|
2
|
+
if ((typeof value !== 'object' && typeof value !== 'function') || value == null || !('~standard' in value)) {
|
|
3
3
|
return false;
|
|
4
4
|
}
|
|
5
5
|
const props = value['~standard'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standard-schema.js","sourceRoot":"","sources":["../src/standard-schema.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,gBAAgB,CAAI,KAAQ;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC,WAAW,IAAI,KAAK,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"standard-schema.js","sourceRoot":"","sources":["../src/standard-schema.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,gBAAgB,CAAI,KAAQ;IAC1C,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC,WAAW,IAAI,KAAK,CAAC,EAAE,CAAC;QAC3G,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,KAAK,GAAY,KAAK,CAAC,WAAW,CAAC,CAAC;IAE1C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,IAAI,SAAS,IAAI,KAAK,IAAI,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AACjG,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAI,KAAQ;IAC9C,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,KAAK,GAAsD,KAAK,CAAC,WAAW,CAAC,CAAC;IAEpF,OAAO,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,MAAwB,EACxB,KAAQ;IAER,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC7C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kamaalio/hono-standard-openapi",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Generate OpenAPI documents from any Standard Schema library, for Hono.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hono",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"@types/node": "^26.2.0",
|
|
53
53
|
"@valibot/to-json-schema": "^1.7.1",
|
|
54
54
|
"@vitest/coverage-v8": "^4.1.11",
|
|
55
|
+
"arktype": "^2.2.3",
|
|
55
56
|
"eslint-plugin-import": "^2.32.0",
|
|
56
57
|
"hono": "^4.13.1",
|
|
57
58
|
"husky": "^9.1.7",
|