fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #2101 from hey-api/docs/validators

docs: update validators pages

authored by

Lubos and committed by
GitHub
5c0e525d 0f4c2301

+151 -11
+10
docs/openapi-ts/clients/axios.md
··· 23 23 Launch demo 24 24 </button> 25 25 26 + ## Features 27 + 28 + - seamless integration with `@hey-api/openapi-ts` ecosystem 29 + - type-safe response data and errors 30 + - response data validation and transformation 31 + - access to the original request and response 32 + - granular request and response customization options 33 + - minimal learning curve thanks to extending the underlying technology 34 + - support bundling inside the generated output 35 + 26 36 ## Installation 27 37 28 38 Start by adding `@hey-api/client-axios` to your dependencies.
+10
docs/openapi-ts/clients/fetch.md
··· 23 23 Launch demo 24 24 </button> 25 25 26 + ## Features 27 + 28 + - seamless integration with `@hey-api/openapi-ts` ecosystem 29 + - type-safe response data and errors 30 + - response data validation and transformation 31 + - access to the original request and response 32 + - granular request and response customization options 33 + - minimal learning curve thanks to extending the underlying technology 34 + - support bundling inside the generated output 35 + 26 36 ## Installation 27 37 28 38 Start by adding `@hey-api/client-fetch` to your dependencies.
+10
docs/openapi-ts/clients/next-js.md
··· 17 17 Launch demo 18 18 </button> --> 19 19 20 + ## Features 21 + 22 + - seamless integration with `@hey-api/openapi-ts` ecosystem 23 + - type-safe response data and errors 24 + - response data validation and transformation 25 + - access to the original request and response 26 + - granular request and response customization options 27 + - minimal learning curve thanks to extending the underlying technology 28 + - support bundling inside the generated output 29 + 20 30 ## Installation 21 31 22 32 Start by adding `@hey-api/client-next` to your dependencies.
+10
docs/openapi-ts/clients/nuxt.md
··· 21 21 Launch demo 22 22 </button> --> 23 23 24 + ## Features 25 + 26 + - seamless integration with `@hey-api/openapi-ts` ecosystem 27 + - type-safe response data and errors 28 + - response data validation and transformation 29 + - access to the original request and response 30 + - granular request and response customization options 31 + - minimal learning curve thanks to extending the underlying technology 32 + - support bundling inside the generated output 33 + 24 34 ## Installation 25 35 26 36 Start by adding `@hey-api/client-nuxt` to your dependencies.
+1 -1
docs/openapi-ts/plugins/tanstack-query.md
··· 110 110 111 111 ## Output 112 112 113 - The TanStack Query plugin will optionally generate the following artifacts, depending on the input specification. 113 + The TanStack Query plugin will generate the following artifacts, depending on the input specification. 114 114 115 115 ## Queries 116 116
+52 -4
docs/openapi-ts/plugins/valibot.md
··· 3 3 description: Valibot plugin for Hey API. Compatible with all our features. 4 4 --- 5 5 6 + <!-- <script setup> 7 + import { embedProject } from '../../embed' 8 + </script> --> 9 + 6 10 # Valibot 7 11 8 12 ::: warning 9 - This feature is in development! :tada: Try it out and provide feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues/1474). 13 + Valibot plugin is currently in beta. The interface might change before it becomes stable. We encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues/1474). 10 14 ::: 11 15 12 16 ### About ··· 22 26 ## Features 23 27 24 28 - seamless integration with `@hey-api/openapi-ts` ecosystem 25 - - Valibot schemas for requests, responses, and reusable components 29 + - Valibot schemas for request payloads, parameters, and responses 26 30 27 31 ## Installation 28 32 ··· 42 46 }; 43 47 ``` 44 48 45 - ## SDKs 49 + ### SDKs 46 50 47 51 To automatically validate response data in your SDKs, set `sdk.validator` to `true`. 48 52 ··· 68 72 69 73 The Valibot plugin will generate the following artifacts, depending on the input specification. 70 74 75 + ## Responses 76 + 77 + A single Valibot schema is generated for all endpoint's responses. If the endpoint describes multiple responses, the generated schema is a union of all possible response shapes. 78 + 79 + ```ts 80 + const vResponse = v.union([ 81 + v.object({ 82 + foo: v.optional(v.string()), 83 + }), 84 + v.object({ 85 + bar: v.optional(v.number()), 86 + }), 87 + ]); 88 + ``` 89 + 90 + ## Request Bodies 91 + 92 + If an endpoint describes a request body, we will generate a Valibot schema representing its shape. 93 + 94 + ```ts 95 + const vData = v.object({ 96 + foo: v.optional(v.string()), 97 + bar: v.optional(v.union([v.number(), v.null()])), 98 + }); 99 + ``` 100 + 101 + ## Parameters 102 + 103 + A separate Valibot schema is generated for every request parameter. 104 + 105 + ```ts 106 + const vParameterFoo = v.pipe(v.number(), v.integer()); 107 + 108 + const vParameterBar = v.string(); 109 + ``` 110 + 71 111 ## Schemas 72 112 73 - More information will be provided as we finalize the plugin. 113 + A separate Valibot schema is generated for every reusable schema. 114 + 115 + ```ts 116 + const vFoo = v.pipe(v.number(), v.integer()); 117 + 118 + const vBar = v.object({ 119 + bar: v.optional(v.union([v.array(v.unknown()), v.null()])), 120 + }); 121 + ``` 74 122 75 123 <!--@include: ../../examples.md--> 76 124 <!--@include: ../../sponsors.md-->
+52 -4
docs/openapi-ts/plugins/zod.md
··· 3 3 description: Zod plugin for Hey API. Compatible with all our features. 4 4 --- 5 5 6 + <!-- <script setup> 7 + import { embedProject } from '../../embed' 8 + </script> --> 9 + 6 10 # Zod 7 11 8 12 ::: warning 9 - This feature is in development! :tada: Try it out and provide feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues/876). 13 + Zod plugin is currently in beta. The interface might change before it becomes stable. We encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues/876). 10 14 ::: 11 15 12 16 ### About ··· 22 26 ## Features 23 27 24 28 - seamless integration with `@hey-api/openapi-ts` ecosystem 25 - - Zod schemas for requests, responses, and reusable components 29 + - Zod schemas for request payloads, parameters, and responses 26 30 27 31 ## Installation 28 32 ··· 42 46 }; 43 47 ``` 44 48 45 - ## SDKs 49 + ### SDKs 46 50 47 51 To automatically validate response data in your SDKs, set `sdk.validator` to `true`. 48 52 ··· 68 72 69 73 The Zod plugin will generate the following artifacts, depending on the input specification. 70 74 75 + ## Responses 76 + 77 + A single Zod schema is generated for all endpoint's responses. If the endpoint describes multiple responses, the generated schema is a union of all possible response shapes. 78 + 79 + ```ts 80 + const zResponse = z.union([ 81 + z.object({ 82 + foo: z.string().optional(), 83 + }), 84 + z.object({ 85 + bar: z.number().optional(), 86 + }), 87 + ]); 88 + ``` 89 + 90 + ## Request Bodies 91 + 92 + If an endpoint describes a request body, we will generate a Zod schema representing its shape. 93 + 94 + ```ts 95 + const zData = z.object({ 96 + foo: z.string().optional(), 97 + bar: z.union([z.number(), z.null()]).optional(), 98 + }); 99 + ``` 100 + 101 + ## Parameters 102 + 103 + A separate Zod schema is generated for every request parameter. 104 + 105 + ```ts 106 + const zParameterFoo = z.number().int(); 107 + 108 + const zParameterBar = z.string(); 109 + ``` 110 + 71 111 ## Schemas 72 112 73 - More information will be provided as we finalize the plugin. 113 + A separate Zod schema is generated for every reusable schema. 114 + 115 + ```ts 116 + const zFoo = z.number().int(); 117 + 118 + const zBar = z.object({ 119 + bar: z.array(z.number().int()).optional(), 120 + }); 121 + ``` 74 122 75 123 <!--@include: ../../examples.md--> 76 124 <!--@include: ../../sponsors.md-->
+1 -1
packages/openapi-ts-tests/test/openapi-ts.config.ts
··· 44 44 // openapi: '3.1.0', 45 45 // paths: {}, 46 46 // }, 47 - path: path.resolve(__dirname, 'spec', '2.0.x', 'full.json'), 47 + path: path.resolve(__dirname, 'spec', '3.1.x', 'full.json'), 48 48 // path: 'http://localhost:4000/', 49 49 // path: 'https://get.heyapi.dev/', 50 50 // path: 'https://get.heyapi.dev/hey-api/backend?branch=main&version=1.0.0',
+5 -1
scripts/publish-preview-packages.sh
··· 2 2 3 3 result=$(pnpx turbo run build --affected --dry-run=json) 4 4 5 - packages=$(echo "$result" | jq -r '.tasks[].directory' | grep '^packages/' | sed 's|^|./|') 5 + packages=$(echo "$result" | jq -r '.tasks[].directory' | grep '^packages/' | while read -r dir; do 6 + if [ "$(jq -r '.private' "$dir/package.json")" != "true" ]; then 7 + echo "./$dir" 8 + fi 9 + done) 6 10 7 11 if [ -n "$packages" ]; then 8 12 pnpx pkg-pr-new publish --pnpm $packages