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

Merge pull request #2489 from hey-api/fix/api-registry-shorthand

feat(input): input supports Hey API Registry shorthand

authored by

Lubos and committed by
GitHub
2a0c7989 c74279c2

+658 -570
+5
.changeset/soft-penguins-fetch.md
···
··· 1 + --- 2 + '@hey-api/openapi-ts': patch 3 + --- 4 + 5 + feat(input): input supports Hey API Registry shorthand
+4 -4
docs/openapi-ts/clients/angular.md
··· 49 50 ```js [config] 51 export default { 52 - input: 'https://get.heyapi.dev/hey-api/backend', 53 output: 'src/client', 54 plugins: ['@hey-api/client-angular'], // [!code ++] 55 }; ··· 57 58 ```sh [cli] 59 npx @hey-api/openapi-ts \ 60 - -i https://get.heyapi.dev/hey-api/backend \ 61 -o src/client \ 62 -c @hey-api/client-angular # [!code ++] 63 ``` ··· 105 106 ```js 107 export default { 108 - input: 'https://get.heyapi.dev/hey-api/backend', 109 output: 'src/client', 110 plugins: [ 111 { ··· 178 179 ```js [config] 180 export default { 181 - input: 'https://get.heyapi.dev/hey-api/backend', 182 output: 'src/client', 183 plugins: [ 184 '@hey-api/client-angular',
··· 49 50 ```js [config] 51 export default { 52 + input: 'hey-api/backend', // sign up at app.heyapi.dev 53 output: 'src/client', 54 plugins: ['@hey-api/client-angular'], // [!code ++] 55 }; ··· 57 58 ```sh [cli] 59 npx @hey-api/openapi-ts \ 60 + -i hey-api/backend \ 61 -o src/client \ 62 -c @hey-api/client-angular # [!code ++] 63 ``` ··· 105 106 ```js 107 export default { 108 + input: 'hey-api/backend', // sign up at app.heyapi.dev 109 output: 'src/client', 110 plugins: [ 111 { ··· 178 179 ```js [config] 180 export default { 181 + input: 'hey-api/backend', // sign up at app.heyapi.dev 182 output: 'src/client', 183 plugins: [ 184 '@hey-api/client-angular',
+4 -4
docs/openapi-ts/clients/angular/v19.md
··· 49 50 ```js [config] 51 export default { 52 - input: 'https://get.heyapi.dev/hey-api/backend', 53 output: 'src/client', 54 plugins: ['@hey-api/client-angular'], // [!code ++] 55 }; ··· 57 58 ```sh [cli] 59 npx @hey-api/openapi-ts \ 60 - -i https://get.heyapi.dev/hey-api/backend \ 61 -o src/client \ 62 -c @hey-api/client-angular # [!code ++] 63 ``` ··· 105 106 ```js 107 export default { 108 - input: 'https://get.heyapi.dev/hey-api/backend', 109 output: 'src/client', 110 plugins: [ 111 { ··· 178 179 ```js [config] 180 export default { 181 - input: 'https://get.heyapi.dev/hey-api/backend', 182 output: 'src/client', 183 plugins: [ 184 '@hey-api/client-angular',
··· 49 50 ```js [config] 51 export default { 52 + input: 'hey-api/backend', // sign up at app.heyapi.dev 53 output: 'src/client', 54 plugins: ['@hey-api/client-angular'], // [!code ++] 55 }; ··· 57 58 ```sh [cli] 59 npx @hey-api/openapi-ts \ 60 + -i hey-api/backend \ 61 -o src/client \ 62 -c @hey-api/client-angular # [!code ++] 63 ``` ··· 105 106 ```js 107 export default { 108 + input: 'hey-api/backend', // sign up at app.heyapi.dev 109 output: 'src/client', 110 plugins: [ 111 { ··· 178 179 ```js [config] 180 export default { 181 + input: 'hey-api/backend', // sign up at app.heyapi.dev 182 output: 'src/client', 183 plugins: [ 184 '@hey-api/client-angular',
+3 -3
docs/openapi-ts/clients/axios.md
··· 46 47 ```js [config] 48 export default { 49 - input: 'https://get.heyapi.dev/hey-api/backend', 50 output: 'src/client', 51 plugins: ['@hey-api/client-axios'], // [!code ++] 52 }; ··· 54 55 ```sh [cli] 56 npx @hey-api/openapi-ts \ 57 - -i https://get.heyapi.dev/hey-api/backend \ 58 -o src/client \ 59 -c @hey-api/client-axios # [!code ++] 60 ``` ··· 87 88 ```js 89 export default { 90 - input: 'https://get.heyapi.dev/hey-api/backend', 91 output: 'src/client', 92 plugins: [ 93 {
··· 46 47 ```js [config] 48 export default { 49 + input: 'hey-api/backend', // sign up at app.heyapi.dev 50 output: 'src/client', 51 plugins: ['@hey-api/client-axios'], // [!code ++] 52 }; ··· 54 55 ```sh [cli] 56 npx @hey-api/openapi-ts \ 57 + -i hey-api/backend \ 58 -o src/client \ 59 -c @hey-api/client-axios # [!code ++] 60 ``` ··· 87 88 ```js 89 export default { 90 + input: 'hey-api/backend', // sign up at app.heyapi.dev 91 output: 'src/client', 92 plugins: [ 93 {
+3 -3
docs/openapi-ts/clients/fetch.md
··· 39 40 ```js [config] 41 export default { 42 - input: 'https://get.heyapi.dev/hey-api/backend', 43 output: 'src/client', 44 plugins: ['@hey-api/client-fetch'], // [!code ++] 45 }; ··· 47 48 ```sh [cli] 49 npx @hey-api/openapi-ts \ 50 - -i https://get.heyapi.dev/hey-api/backend \ 51 -o src/client \ 52 -c @hey-api/client-fetch # [!code ++] 53 ``` ··· 86 87 ```js 88 export default { 89 - input: 'https://get.heyapi.dev/hey-api/backend', 90 output: 'src/client', 91 plugins: [ 92 {
··· 39 40 ```js [config] 41 export default { 42 + input: 'hey-api/backend', // sign up at app.heyapi.dev 43 output: 'src/client', 44 plugins: ['@hey-api/client-fetch'], // [!code ++] 45 }; ··· 47 48 ```sh [cli] 49 npx @hey-api/openapi-ts \ 50 + -i hey-api/backend \ 51 -o src/client \ 52 -c @hey-api/client-fetch # [!code ++] 53 ``` ··· 86 87 ```js 88 export default { 89 + input: 'hey-api/backend', // sign up at app.heyapi.dev 90 output: 'src/client', 91 plugins: [ 92 {
+5 -5
docs/openapi-ts/clients/legacy.md
··· 19 20 ```js [fetch] 21 export default { 22 - input: 'https://get.heyapi.dev/hey-api/backend', 23 output: 'src/client', 24 plugins: ['legacy/fetch'], // [!code ++] 25 }; ··· 27 28 ```js [axios] 29 export default { 30 - input: 'https://get.heyapi.dev/hey-api/backend', 31 output: 'src/client', 32 plugins: ['legacy/axios'], // [!code ++] 33 }; ··· 35 36 ```js [angular] 37 export default { 38 - input: 'https://get.heyapi.dev/hey-api/backend', 39 output: 'src/client', 40 plugins: ['legacy/angular'], // [!code ++] 41 }; ··· 43 44 ```js [node] 45 export default { 46 - input: 'https://get.heyapi.dev/hey-api/backend', 47 output: 'src/client', 48 plugins: ['legacy/node'], // [!code ++] 49 }; ··· 51 52 ```js [xhr] 53 export default { 54 - input: 'https://get.heyapi.dev/hey-api/backend', 55 output: 'src/client', 56 plugins: ['legacy/xhr'], // [!code ++] 57 };
··· 19 20 ```js [fetch] 21 export default { 22 + input: 'hey-api/backend', // sign up at app.heyapi.dev 23 output: 'src/client', 24 plugins: ['legacy/fetch'], // [!code ++] 25 }; ··· 27 28 ```js [axios] 29 export default { 30 + input: 'hey-api/backend', // sign up at app.heyapi.dev 31 output: 'src/client', 32 plugins: ['legacy/axios'], // [!code ++] 33 }; ··· 35 36 ```js [angular] 37 export default { 38 + input: 'hey-api/backend', // sign up at app.heyapi.dev 39 output: 'src/client', 40 plugins: ['legacy/angular'], // [!code ++] 41 }; ··· 43 44 ```js [node] 45 export default { 46 + input: 'hey-api/backend', // sign up at app.heyapi.dev 47 output: 'src/client', 48 plugins: ['legacy/node'], // [!code ++] 49 }; ··· 51 52 ```js [xhr] 53 export default { 54 + input: 'hey-api/backend', // sign up at app.heyapi.dev 55 output: 'src/client', 56 plugins: ['legacy/xhr'], // [!code ++] 57 };
+3 -3
docs/openapi-ts/clients/next-js.md
··· 29 30 ```js [config] 31 export default { 32 - input: 'https://get.heyapi.dev/hey-api/backend', 33 output: 'src/client', 34 plugins: ['@hey-api/client-next'], // [!code ++] 35 }; ··· 37 38 ```sh [cli] 39 npx @hey-api/openapi-ts \ 40 - -i https://get.heyapi.dev/hey-api/backend \ 41 -o src/client \ 42 -c @hey-api/client-next # [!code ++] 43 ``` ··· 56 57 ```js 58 export default { 59 - input: 'https://get.heyapi.dev/hey-api/backend', 60 output: 'src/client', 61 plugins: [ 62 {
··· 29 30 ```js [config] 31 export default { 32 + input: 'hey-api/backend', // sign up at app.heyapi.dev 33 output: 'src/client', 34 plugins: ['@hey-api/client-next'], // [!code ++] 35 }; ··· 37 38 ```sh [cli] 39 npx @hey-api/openapi-ts \ 40 + -i hey-api/backend \ 41 -o src/client \ 42 -c @hey-api/client-next # [!code ++] 43 ``` ··· 56 57 ```js 58 export default { 59 + input: 'hey-api/backend', // sign up at app.heyapi.dev 60 output: 'src/client', 61 plugins: [ 62 {
+3 -3
docs/openapi-ts/clients/nuxt.md
··· 64 65 ```js [config] 66 export default { 67 - input: 'https://get.heyapi.dev/hey-api/backend', 68 output: 'src/client', 69 plugins: ['@hey-api/client-nuxt'], // [!code ++] 70 }; ··· 72 73 ```sh [cli] 74 npx @hey-api/openapi-ts \ 75 - -i https://get.heyapi.dev/hey-api/backend \ 76 -o src/client \ 77 -c @hey-api/client-nuxt # [!code ++] 78 ``` ··· 111 112 ```js 113 export default { 114 - input: 'https://get.heyapi.dev/hey-api/backend', 115 output: 'src/client', 116 plugins: [ 117 {
··· 64 65 ```js [config] 66 export default { 67 + input: 'hey-api/backend', // sign up at app.heyapi.dev 68 output: 'src/client', 69 plugins: ['@hey-api/client-nuxt'], // [!code ++] 70 }; ··· 72 73 ```sh [cli] 74 npx @hey-api/openapi-ts \ 75 + -i hey-api/backend \ 76 -o src/client \ 77 -c @hey-api/client-nuxt # [!code ++] 78 ``` ··· 111 112 ```js 113 export default { 114 + input: 'hey-api/backend', // sign up at app.heyapi.dev 115 output: 'src/client', 116 plugins: [ 117 {
+16 -8
docs/openapi-ts/configuration.md
··· 13 import { defineConfig } from '@hey-api/openapi-ts'; 14 15 export default defineConfig({ 16 - input: 'https://get.heyapi.dev/hey-api/backend', 17 output: 'src/client', 18 }); 19 ``` ··· 21 ```js [openapi-ts.config.cjs] 22 /** @type {import('@hey-api/openapi-ts').UserConfig} */ 23 module.exports = { 24 - input: 'https://get.heyapi.dev/hey-api/backend', 25 output: 'src/client', 26 }; 27 ``` ··· 29 ```js [openapi-ts.config.mjs] 30 /** @type {import('@hey-api/openapi-ts').UserConfig} */ 31 export default { 32 - input: 'https://get.heyapi.dev/hey-api/backend', 33 output: 'src/client', 34 }; 35 ``` ··· 65 66 ## Input 67 68 - You must set the input so we can load your OpenAPI specification. It can be a path or URL, object containing a path or URL, or an object representing an OpenAPI specification. Hey API supports all valid OpenAPI versions and file formats. 69 70 You can learn more on the [Input](/openapi-ts/configuration/input) page. 71 ··· 79 80 ```js [url] 81 export default { 82 - input: 'https://get.heyapi.dev/hey-api/backend', // [!code ++] 83 }; 84 ``` 85 ··· 87 ```js [object] 88 export default { 89 input: { // [!code ++] 90 - path: 'https://get.heyapi.dev/hey-api/backend', // [!code ++] 91 // ...other options // [!code ++] 92 }, // [!code ++] 93 }; ··· 120 121 ```js [path] 122 export default { 123 - input: 'https://get.heyapi.dev/hey-api/backend', 124 output: 'src/client', // [!code ++] 125 }; 126 ``` ··· 128 <!-- prettier-ignore-start --> 129 ```js [object] 130 export default { 131 - input: 'https://get.heyapi.dev/hey-api/backend', 132 output: { // [!code ++] 133 path: 'src/client', // [!code ++] 134 // ...other options // [!code ++]
··· 13 import { defineConfig } from '@hey-api/openapi-ts'; 14 15 export default defineConfig({ 16 + input: 'hey-api/backend', // sign up at app.heyapi.dev 17 output: 'src/client', 18 }); 19 ``` ··· 21 ```js [openapi-ts.config.cjs] 22 /** @type {import('@hey-api/openapi-ts').UserConfig} */ 23 module.exports = { 24 + input: 'hey-api/backend', // sign up at app.heyapi.dev 25 output: 'src/client', 26 }; 27 ``` ··· 29 ```js [openapi-ts.config.mjs] 30 /** @type {import('@hey-api/openapi-ts').UserConfig} */ 31 export default { 32 + input: 'hey-api/backend', // sign up at app.heyapi.dev 33 output: 'src/client', 34 }; 35 ``` ··· 65 66 ## Input 67 68 + You must provide an input so we can load your OpenAPI specification. 69 + 70 + The input can be a string path, URL, API registry shorthand, an object containing any of these, or an object representing an OpenAPI specification. Hey API supports all valid OpenAPI versions and file formats. 71 72 You can learn more on the [Input](/openapi-ts/configuration/input) page. 73 ··· 81 82 ```js [url] 83 export default { 84 + input: 'https://get.heyapi.dev/hey-api/backend', // sign up at app.heyapi.dev // [!code ++] 85 + }; 86 + ``` 87 + 88 + ```js [registry] 89 + export default { 90 + input: 'hey-api/backend', // sign up at app.heyapi.dev // [!code ++] 91 }; 92 ``` 93 ··· 95 ```js [object] 96 export default { 97 input: { // [!code ++] 98 + path: 'hey-api/backend', // sign up at app.heyapi.dev // [!code ++] 99 // ...other options // [!code ++] 100 }, // [!code ++] 101 }; ··· 128 129 ```js [path] 130 export default { 131 + input: 'hey-api/backend', // sign up at app.heyapi.dev 132 output: 'src/client', // [!code ++] 133 }; 134 ``` ··· 136 <!-- prettier-ignore-start --> 137 ```js [object] 138 export default { 139 + input: 'hey-api/backend', // sign up at app.heyapi.dev 140 output: { // [!code ++] 141 path: 'src/client', // [!code ++] 142 // ...other options // [!code ++]
+49 -47
docs/openapi-ts/configuration/input.md
··· 5 6 # Input 7 8 - You must set the input so we can load your OpenAPI specification. 9 10 ## Input 11 12 - Input can be a path or URL, object containing a path or URL, or an object representing an OpenAPI specification. Hey API supports all valid OpenAPI versions and file formats. 13 14 ::: code-group 15 ··· 21 22 ```js [url] 23 export default { 24 - input: 'https://get.heyapi.dev/hey-api/backend', // [!code ++] 25 }; 26 ``` 27 ··· 29 ```js [object] 30 export default { 31 input: { // [!code ++] 32 - path: 'https://get.heyapi.dev/hey-api/backend', // [!code ++] 33 // ...other options // [!code ++] 34 }, // [!code ++] 35 }; ··· 52 If you use an HTTPS URL with a self-signed certificate in development, you will need to set [`NODE_TLS_REJECT_UNAUTHORIZED=0`](https://github.com/hey-api/openapi-ts/issues/276#issuecomment-2043143501) in your environment. 53 ::: 54 55 - ### ReadMe API Registry 56 - 57 - You can use ReadMe API Registry UUIDs to fetch OpenAPI specifications directly from ReadMe's platform. This is useful when API providers use ReadMe as their source of truth for API documentation. 58 - 59 - ::: code-group 60 - 61 - ```js [simple format] 62 - export default { 63 - input: 'readme:abc123def456', // [!code ++] 64 - }; 65 - ``` 66 67 - ```js [full format] 68 - export default { 69 - input: 'readme:@organization/project#abc123def456', // [!code ++] 70 - }; 71 - ``` 72 73 - ```js [object format] 74 export default { 75 input: { 76 - path: 'readme:abc123def456', // [!code ++] 77 - // ...other options 78 }, 79 }; 80 ``` 81 82 - ::: 83 84 - The ReadMe input formats are: 85 86 - - `readme:uuid` - Simple format using only the UUID 87 - - `readme:@organization/project#uuid` - Full format including organization and project names 88 89 - Both formats will fetch the OpenAPI specification from `https://dash.readme.com/api/v1/api-registry/{uuid}`. 90 91 - ### Hey API Platform options 92 93 - You might want to use the [Hey API Platform](/openapi-ts/integrations) to store your specifications. If you do so, the `input` object provides options to help with constructing the correct URL. 94 95 ```js 96 export default { 97 input: { 98 - path: 'https://get.heyapi.dev/', 99 branch: 'main', // [!code ++] 100 - project: 'backend', // [!code ++] 101 }, 102 }; 103 ``` 104 105 - ### Request options 106 107 - You can pass any valid Fetch API [options](https://developer.mozilla.org/docs/Web/API/RequestInit) to the request for fetching your specification. This is useful if your file is behind auth for example. 108 109 - <!-- prettier-ignore-start --> 110 - ```js 111 export default { 112 - input: { 113 - path: 'https://secret.com/protected-spec', 114 - fetch: { // [!code ++] 115 - headers: { // [!code ++] 116 - Authorization: 'Bearer xxx', // [!code ++] 117 - }, // [!code ++] 118 - }, // [!code ++] 119 - }, 120 }; 121 ``` 122 - <!-- prettier-ignore-end --> 123 124 ## Watch Mode 125 ··· 134 ```js [config] 135 export default { 136 input: { 137 - path: 'https://get.heyapi.dev/hey-api/backend', 138 watch: true, // [!code ++] 139 }, 140 }; ··· 142 143 ```sh [cli] 144 npx @hey-api/openapi-ts \ 145 - -i https://get.heyapi.dev/hey-api/backend \ 146 -o src/client \ 147 -w # [!code ++] 148 ```
··· 5 6 # Input 7 8 + You must provide an input so we can load your OpenAPI specification. 9 10 ## Input 11 12 + The input can be a string path, URL, API registry shorthand, an object containing any of these, or an object representing an OpenAPI specification. Hey API supports all valid OpenAPI versions and file formats. 13 14 ::: code-group 15 ··· 21 22 ```js [url] 23 export default { 24 + input: 'https://get.heyapi.dev/hey-api/backend', // sign up at app.heyapi.dev // [!code ++] 25 + }; 26 + ``` 27 + 28 + ```js [registry] 29 + export default { 30 + input: 'hey-api/backend', // sign up at app.heyapi.dev // [!code ++] 31 }; 32 ``` 33 ··· 35 ```js [object] 36 export default { 37 input: { // [!code ++] 38 + path: 'hey-api/backend', // sign up at app.heyapi.dev // [!code ++] 39 // ...other options // [!code ++] 40 }, // [!code ++] 41 }; ··· 58 If you use an HTTPS URL with a self-signed certificate in development, you will need to set [`NODE_TLS_REJECT_UNAUTHORIZED=0`](https://github.com/hey-api/openapi-ts/issues/276#issuecomment-2043143501) in your environment. 59 ::: 60 61 + ### Request options 62 63 + You can pass any valid Fetch API [options](https://developer.mozilla.org/docs/Web/API/RequestInit) to the request for fetching your specification. This is useful if your file is behind auth for example. 64 65 + <!-- prettier-ignore-start --> 66 + ```js 67 export default { 68 input: { 69 + path: 'https://secret.com/protected-spec', 70 + fetch: { // [!code ++] 71 + headers: { // [!code ++] 72 + Authorization: 'Bearer xxx', // [!code ++] 73 + }, // [!code ++] 74 + }, // [!code ++] 75 }, 76 }; 77 ``` 78 + <!-- prettier-ignore-end --> 79 80 + ## API Registry 81 82 + You can store your specifications in an API registry to serve as a single source of truth. This helps prevent drift, improves discoverability, enables version tracking, and more. 83 84 + ### Hey API 85 86 + You can learn more about [Hey API Platform](https://app.heyapi.dev) on the [Integrations](/openapi-ts/integrations) page. 87 88 + ```js [uuid] 89 + export default { 90 + input: 'hey-api/backend', // sign up at app.heyapi.dev // [!code ++] 91 + }; 92 + ``` 93 94 + The `input` object lets you provide additional options to construct the correct URL. 95 96 ```js 97 export default { 98 input: { 99 + path: 'hey-api/backend', // sign up at app.heyapi.dev 100 branch: 'main', // [!code ++] 101 }, 102 }; 103 ``` 104 105 + We also provide shorthands for other registries: 106 107 + ::: details ReadMe 108 + Prefix your input with `readme:` to use the ReadMe API Registry. 109 110 + ::: code-group 111 + 112 + ```js [uuid] 113 export default { 114 + input: 'readme:nysezql0wwo236', // [!code ++] 115 }; 116 ``` 117 + 118 + ```js [long] 119 + export default { 120 + input: 'readme:@developers/v2.0#nysezql0wwo236', // [!code ++] 121 + }; 122 + ``` 123 + 124 + ::: 125 126 ## Watch Mode 127 ··· 136 ```js [config] 137 export default { 138 input: { 139 + path: 'hey-api/backend', // sign up at app.heyapi.dev 140 watch: true, // [!code ++] 141 }, 142 }; ··· 144 145 ```sh [cli] 146 npx @hey-api/openapi-ts \ 147 + -i hey-api/backend \ 148 -o src/client \ 149 -w # [!code ++] 150 ```
+12 -12
docs/openapi-ts/configuration/output.md
··· 15 16 ```js [path] 17 export default { 18 - input: 'https://get.heyapi.dev/hey-api/backend', 19 output: 'src/client', // [!code ++] 20 }; 21 ``` ··· 23 <!-- prettier-ignore-start --> 24 ```js [object] 25 export default { 26 - input: 'https://get.heyapi.dev/hey-api/backend', 27 output: { // [!code ++] 28 path: 'src/client', // [!code ++] 29 // ...other options // [!code ++] ··· 42 43 ```js [disabled] 44 export default { 45 - input: 'https://get.heyapi.dev/hey-api/backend', 46 output: { 47 format: false, // [!code ++] 48 path: 'src/client', ··· 52 53 ```js [prettier] 54 export default { 55 - input: 'https://get.heyapi.dev/hey-api/backend', 56 output: { 57 format: 'prettier', // [!code ++] 58 path: 'src/client', ··· 62 63 ```js [biome] 64 export default { 65 - input: 'https://get.heyapi.dev/hey-api/backend', 66 output: { 67 format: 'biome', // [!code ++] 68 path: 'src/client', ··· 82 83 ```js [disabled] 84 export default { 85 - input: 'https://get.heyapi.dev/hey-api/backend', 86 output: { 87 lint: false, // [!code ++] 88 path: 'src/client', ··· 92 93 ```js [eslint] 94 export default { 95 - input: 'https://get.heyapi.dev/hey-api/backend', 96 output: { 97 lint: 'eslint', // [!code ++] 98 path: 'src/client', ··· 102 103 ```js [biome] 104 export default { 105 - input: 'https://get.heyapi.dev/hey-api/backend', 106 output: { 107 lint: 'biome', // [!code ++] 108 path: 'src/client', ··· 112 113 ```js [oxlint] 114 export default { 115 - input: 'https://get.heyapi.dev/hey-api/backend', 116 output: { 117 lint: 'oxlint', // [!code ++] 118 path: 'src/client', ··· 132 133 ```js [custom] 134 export default { 135 - input: 'https://get.heyapi.dev/hey-api/backend', 136 output: { 137 path: 'src/client', 138 tsConfigPath: './config/tsconfig.custom.json', // [!code ++] ··· 142 143 ```js [off] 144 export default { 145 - input: 'https://get.heyapi.dev/hey-api/backend', 146 output: { 147 path: 'src/client', 148 tsConfigPath: 'off', // [!code ++] ··· 158 159 ```js 160 export default { 161 - input: 'https://get.heyapi.dev/hey-api/backend', 162 output: { 163 clean: false, // [!code ++] 164 path: 'src/client',
··· 15 16 ```js [path] 17 export default { 18 + input: 'hey-api/backend', // sign up at app.heyapi.dev 19 output: 'src/client', // [!code ++] 20 }; 21 ``` ··· 23 <!-- prettier-ignore-start --> 24 ```js [object] 25 export default { 26 + input: 'hey-api/backend', // sign up at app.heyapi.dev 27 output: { // [!code ++] 28 path: 'src/client', // [!code ++] 29 // ...other options // [!code ++] ··· 42 43 ```js [disabled] 44 export default { 45 + input: 'hey-api/backend', // sign up at app.heyapi.dev 46 output: { 47 format: false, // [!code ++] 48 path: 'src/client', ··· 52 53 ```js [prettier] 54 export default { 55 + input: 'hey-api/backend', // sign up at app.heyapi.dev 56 output: { 57 format: 'prettier', // [!code ++] 58 path: 'src/client', ··· 62 63 ```js [biome] 64 export default { 65 + input: 'hey-api/backend', // sign up at app.heyapi.dev 66 output: { 67 format: 'biome', // [!code ++] 68 path: 'src/client', ··· 82 83 ```js [disabled] 84 export default { 85 + input: 'hey-api/backend', // sign up at app.heyapi.dev 86 output: { 87 lint: false, // [!code ++] 88 path: 'src/client', ··· 92 93 ```js [eslint] 94 export default { 95 + input: 'hey-api/backend', // sign up at app.heyapi.dev 96 output: { 97 lint: 'eslint', // [!code ++] 98 path: 'src/client', ··· 102 103 ```js [biome] 104 export default { 105 + input: 'hey-api/backend', // sign up at app.heyapi.dev 106 output: { 107 lint: 'biome', // [!code ++] 108 path: 'src/client', ··· 112 113 ```js [oxlint] 114 export default { 115 + input: 'hey-api/backend', // sign up at app.heyapi.dev 116 output: { 117 lint: 'oxlint', // [!code ++] 118 path: 'src/client', ··· 132 133 ```js [custom] 134 export default { 135 + input: 'hey-api/backend', // sign up at app.heyapi.dev 136 output: { 137 path: 'src/client', 138 tsConfigPath: './config/tsconfig.custom.json', // [!code ++] ··· 142 143 ```js [off] 144 export default { 145 + input: 'hey-api/backend', // sign up at app.heyapi.dev 146 output: { 147 path: 'src/client', 148 tsConfigPath: 'off', // [!code ++] ··· 158 159 ```js 160 export default { 161 + input: 'hey-api/backend', // sign up at app.heyapi.dev 162 output: { 163 clean: false, // [!code ++] 164 path: 'src/client',
+23 -23
docs/openapi-ts/configuration/parser.md
··· 16 <!-- prettier-ignore-start --> 17 ```js 18 export default { 19 - input: 'https://get.heyapi.dev/hey-api/backend', 20 output: 'src/client', 21 parser: { // [!code ++] 22 patch: { // [!code ++] ··· 58 <!-- prettier-ignore-start --> 59 ```js 60 export default { 61 - input: 'https://get.heyapi.dev/hey-api/backend', 62 output: 'src/client', 63 parser: { // [!code ++] 64 validate_EXPERIMENTAL: true, // [!code ++] ··· 80 <!-- prettier-ignore-start --> 81 ```js [include] 82 export default { 83 - input: 'https://get.heyapi.dev/hey-api/backend', 84 output: 'src/client', 85 parser: { // [!code ++] 86 filters: { // [!code ++] ··· 95 <!-- prettier-ignore-start --> 96 ```js [exclude] 97 export default { 98 - input: 'https://get.heyapi.dev/hey-api/backend', 99 output: 'src/client', 100 parser: { // [!code ++] 101 filters: { // [!code ++] ··· 119 <!-- prettier-ignore-start --> 120 ```js [include] 121 export default { 122 - input: 'https://get.heyapi.dev/hey-api/backend', 123 output: 'src/client', 124 parser: { // [!code ++] 125 filters: { // [!code ++] ··· 134 <!-- prettier-ignore-start --> 135 ```js [exclude] 136 export default { 137 - input: 'https://get.heyapi.dev/hey-api/backend', 138 output: 'src/client', 139 parser: { // [!code ++] 140 filters: { // [!code ++] ··· 156 <!-- prettier-ignore-start --> 157 ```js 158 export default { 159 - input: 'https://get.heyapi.dev/hey-api/backend', 160 output: 'src/client', 161 parser: { // [!code ++] 162 filters: { // [!code ++] ··· 176 <!-- prettier-ignore-start --> 177 ```js [include] 178 export default { 179 - input: 'https://get.heyapi.dev/hey-api/backend', 180 output: 'src/client', 181 parser: { // [!code ++] 182 filters: { // [!code ++] ··· 191 <!-- prettier-ignore-start --> 192 ```js [exclude] 193 export default { 194 - input: 'https://get.heyapi.dev/hey-api/backend', 195 output: 'src/client', 196 parser: { // [!code ++] 197 filters: { // [!code ++] ··· 215 <!-- prettier-ignore-start --> 216 ```js [include] 217 export default { 218 - input: 'https://get.heyapi.dev/hey-api/backend', 219 output: 'src/client', 220 parser: { // [!code ++] 221 filters: { // [!code ++] ··· 230 <!-- prettier-ignore-start --> 231 ```js [exclude] 232 export default { 233 - input: 'https://get.heyapi.dev/hey-api/backend', 234 output: 'src/client', 235 parser: { // [!code ++] 236 filters: { // [!code ++] ··· 254 <!-- prettier-ignore-start --> 255 ```js [include] 256 export default { 257 - input: 'https://get.heyapi.dev/hey-api/backend', 258 output: 'src/client', 259 parser: { // [!code ++] 260 filters: { // [!code ++] ··· 269 <!-- prettier-ignore-start --> 270 ```js [exclude] 271 export default { 272 - input: 'https://get.heyapi.dev/hey-api/backend', 273 output: 'src/client', 274 parser: { // [!code ++] 275 filters: { // [!code ++] ··· 293 <!-- prettier-ignore-start --> 294 ```js [include] 295 export default { 296 - input: 'https://get.heyapi.dev/hey-api/backend', 297 output: 'src/client', 298 parser: { // [!code ++] 299 filters: { // [!code ++] ··· 308 <!-- prettier-ignore-start --> 309 ```js [exclude] 310 export default { 311 - input: 'https://get.heyapi.dev/hey-api/backend', 312 output: 'src/client', 313 parser: { // [!code ++] 314 filters: { // [!code ++] ··· 330 <!-- prettier-ignore-start --> 331 ```js 332 export default { 333 - input: 'https://get.heyapi.dev/hey-api/backend', 334 output: 'src/client', 335 parser: { // [!code ++] 336 filters: { // [!code ++] ··· 348 <!-- prettier-ignore-start --> 349 ```js 350 export default { 351 - input: 'https://get.heyapi.dev/hey-api/backend', 352 output: 'src/client', 353 parser: { // [!code ++] 354 filters: { // [!code ++] ··· 377 <!-- prettier-ignore-start --> 378 ```js [root] 379 export default { 380 - input: 'https://get.heyapi.dev/hey-api/backend', 381 output: 'src/client', 382 parser: { // [!code ++] 383 transforms: { // [!code ++] ··· 390 <!-- prettier-ignore-start --> 391 ```js [inline] 392 export default { 393 - input: 'https://get.heyapi.dev/hey-api/backend', 394 output: 'src/client', 395 parser: { // [!code ++] 396 transforms: { // [!code ++] ··· 414 <!-- prettier-ignore-start --> 415 ```js [default] 416 export default { 417 - input: 'https://get.heyapi.dev/hey-api/backend', 418 output: 'src/client', 419 parser: { // [!code ++] 420 transforms: { // [!code ++] ··· 430 <!-- prettier-ignore-start --> 431 ```js [disabled] 432 export default { 433 - input: 'https://get.heyapi.dev/hey-api/backend', 434 output: 'src/client', 435 parser: { // [!code ++] 436 transforms: { // [!code ++] ··· 458 import { defaultPaginationKeywords } from '@hey-api/openapi-ts'; 459 460 export default { 461 - input: 'https://get.heyapi.dev/hey-api/backend', 462 output: 'src/client', 463 parser: { // [!code ++] 464 pagination: { // [!code ++] ··· 471 <!-- prettier-ignore-start --> 472 ```js [override] 473 export default { 474 - input: 'https://get.heyapi.dev/hey-api/backend', 475 output: 'src/client', 476 parser: { // [!code ++] 477 pagination: { // [!code ++]
··· 16 <!-- prettier-ignore-start --> 17 ```js 18 export default { 19 + input: 'hey-api/backend', // sign up at app.heyapi.dev 20 output: 'src/client', 21 parser: { // [!code ++] 22 patch: { // [!code ++] ··· 58 <!-- prettier-ignore-start --> 59 ```js 60 export default { 61 + input: 'hey-api/backend', // sign up at app.heyapi.dev 62 output: 'src/client', 63 parser: { // [!code ++] 64 validate_EXPERIMENTAL: true, // [!code ++] ··· 80 <!-- prettier-ignore-start --> 81 ```js [include] 82 export default { 83 + input: 'hey-api/backend', // sign up at app.heyapi.dev 84 output: 'src/client', 85 parser: { // [!code ++] 86 filters: { // [!code ++] ··· 95 <!-- prettier-ignore-start --> 96 ```js [exclude] 97 export default { 98 + input: 'hey-api/backend', // sign up at app.heyapi.dev 99 output: 'src/client', 100 parser: { // [!code ++] 101 filters: { // [!code ++] ··· 119 <!-- prettier-ignore-start --> 120 ```js [include] 121 export default { 122 + input: 'hey-api/backend', // sign up at app.heyapi.dev 123 output: 'src/client', 124 parser: { // [!code ++] 125 filters: { // [!code ++] ··· 134 <!-- prettier-ignore-start --> 135 ```js [exclude] 136 export default { 137 + input: 'hey-api/backend', // sign up at app.heyapi.dev 138 output: 'src/client', 139 parser: { // [!code ++] 140 filters: { // [!code ++] ··· 156 <!-- prettier-ignore-start --> 157 ```js 158 export default { 159 + input: 'hey-api/backend', // sign up at app.heyapi.dev 160 output: 'src/client', 161 parser: { // [!code ++] 162 filters: { // [!code ++] ··· 176 <!-- prettier-ignore-start --> 177 ```js [include] 178 export default { 179 + input: 'hey-api/backend', // sign up at app.heyapi.dev 180 output: 'src/client', 181 parser: { // [!code ++] 182 filters: { // [!code ++] ··· 191 <!-- prettier-ignore-start --> 192 ```js [exclude] 193 export default { 194 + input: 'hey-api/backend', // sign up at app.heyapi.dev 195 output: 'src/client', 196 parser: { // [!code ++] 197 filters: { // [!code ++] ··· 215 <!-- prettier-ignore-start --> 216 ```js [include] 217 export default { 218 + input: 'hey-api/backend', // sign up at app.heyapi.dev 219 output: 'src/client', 220 parser: { // [!code ++] 221 filters: { // [!code ++] ··· 230 <!-- prettier-ignore-start --> 231 ```js [exclude] 232 export default { 233 + input: 'hey-api/backend', // sign up at app.heyapi.dev 234 output: 'src/client', 235 parser: { // [!code ++] 236 filters: { // [!code ++] ··· 254 <!-- prettier-ignore-start --> 255 ```js [include] 256 export default { 257 + input: 'hey-api/backend', // sign up at app.heyapi.dev 258 output: 'src/client', 259 parser: { // [!code ++] 260 filters: { // [!code ++] ··· 269 <!-- prettier-ignore-start --> 270 ```js [exclude] 271 export default { 272 + input: 'hey-api/backend', // sign up at app.heyapi.dev 273 output: 'src/client', 274 parser: { // [!code ++] 275 filters: { // [!code ++] ··· 293 <!-- prettier-ignore-start --> 294 ```js [include] 295 export default { 296 + input: 'hey-api/backend', // sign up at app.heyapi.dev 297 output: 'src/client', 298 parser: { // [!code ++] 299 filters: { // [!code ++] ··· 308 <!-- prettier-ignore-start --> 309 ```js [exclude] 310 export default { 311 + input: 'hey-api/backend', // sign up at app.heyapi.dev 312 output: 'src/client', 313 parser: { // [!code ++] 314 filters: { // [!code ++] ··· 330 <!-- prettier-ignore-start --> 331 ```js 332 export default { 333 + input: 'hey-api/backend', // sign up at app.heyapi.dev 334 output: 'src/client', 335 parser: { // [!code ++] 336 filters: { // [!code ++] ··· 348 <!-- prettier-ignore-start --> 349 ```js 350 export default { 351 + input: 'hey-api/backend', // sign up at app.heyapi.dev 352 output: 'src/client', 353 parser: { // [!code ++] 354 filters: { // [!code ++] ··· 377 <!-- prettier-ignore-start --> 378 ```js [root] 379 export default { 380 + input: 'hey-api/backend', // sign up at app.heyapi.dev 381 output: 'src/client', 382 parser: { // [!code ++] 383 transforms: { // [!code ++] ··· 390 <!-- prettier-ignore-start --> 391 ```js [inline] 392 export default { 393 + input: 'hey-api/backend', // sign up at app.heyapi.dev 394 output: 'src/client', 395 parser: { // [!code ++] 396 transforms: { // [!code ++] ··· 414 <!-- prettier-ignore-start --> 415 ```js [default] 416 export default { 417 + input: 'hey-api/backend', // sign up at app.heyapi.dev 418 output: 'src/client', 419 parser: { // [!code ++] 420 transforms: { // [!code ++] ··· 430 <!-- prettier-ignore-start --> 431 ```js [disabled] 432 export default { 433 + input: 'hey-api/backend', // sign up at app.heyapi.dev 434 output: 'src/client', 435 parser: { // [!code ++] 436 transforms: { // [!code ++] ··· 458 import { defaultPaginationKeywords } from '@hey-api/openapi-ts'; 459 460 export default { 461 + input: 'hey-api/backend', // sign up at app.heyapi.dev 462 output: 'src/client', 463 parser: { // [!code ++] 464 pagination: { // [!code ++] ··· 471 <!-- prettier-ignore-start --> 472 ```js [override] 473 export default { 474 + input: 'hey-api/backend', // sign up at app.heyapi.dev 475 output: 'src/client', 476 parser: { // [!code ++] 477 pagination: { // [!code ++]
+2 -4
docs/openapi-ts/get-started.md
··· 32 The fastest way to use `@hey-api/openapi-ts` is via npx 33 34 ```sh 35 - npx @hey-api/openapi-ts \ 36 - -i https://get.heyapi.dev/hey-api/backend \ 37 - -o src/client 38 ``` 39 40 Congratulations on creating your first client! 🎉 You can learn more about the generated files on the [Output](/openapi-ts/output) page. ··· 99 import { createClient } from '@hey-api/openapi-ts'; 100 101 createClient({ 102 - input: 'https://get.heyapi.dev/hey-api/backend', 103 output: 'src/client', 104 }); 105 ```
··· 32 The fastest way to use `@hey-api/openapi-ts` is via npx 33 34 ```sh 35 + npx @hey-api/openapi-ts -i hey-api/backend -o src/client 36 ``` 37 38 Congratulations on creating your first client! 🎉 You can learn more about the generated files on the [Output](/openapi-ts/output) page. ··· 97 import { createClient } from '@hey-api/openapi-ts'; 98 99 createClient({ 100 + input: 'hey-api/backend', // sign up at app.heyapi.dev 101 output: 'src/client', 102 }); 103 ```
+1 -3
docs/openapi-ts/integrations.md
··· 96 ::: code-group 97 98 ```sh [Hey API] 99 - npx @hey-api/openapi-ts \ 100 - -i https://get.heyapi.dev/hey-api/backend \ 101 - -o src/client 102 ``` 103 104 ```sh [OpenAPI TypeScript]
··· 96 ::: code-group 97 98 ```sh [Hey API] 99 + npx @hey-api/openapi-ts -i hey-api/backend -o src/client 100 ``` 101 102 ```sh [OpenAPI TypeScript]
+48 -48
docs/openapi-ts/migrating.md
··· 17 18 ```js [Zod 3] 19 export default { 20 - input: 'https://get.heyapi.dev/hey-api/backend', 21 output: 'src/client', 22 plugins: [ 23 // ...other plugins ··· 31 32 ```js [Zod Mini] 33 export default { 34 - input: 'https://get.heyapi.dev/hey-api/backend', 35 output: 'src/client', 36 plugins: [ 37 // ...other plugins ··· 99 <!-- prettier-ignore-start --> 100 ```js 101 export default { 102 - input: 'https://get.heyapi.dev/hey-api/backend', 103 output: 'src/client', 104 plugins: [ 105 // ...other plugins ··· 212 213 ```js 214 export default { 215 - input: 'https://get.heyapi.dev/hey-api/backend', 216 output: 'src/client', 217 plugins: [ 218 // ...other plugins ··· 232 233 ```js 234 export default { 235 - input: 'https://get.heyapi.dev/hey-api/backend', 236 output: 'src/client', 237 plugins: [ 238 // ...other plugins ··· 266 }, 267 }, 268 include: '^(#/components/schemas/foo|#/paths/api/v1/foo/get)$', // [!code --] 269 - path: 'https://get.heyapi.dev/hey-api/backend', 270 }, 271 output: 'src/client', 272 plugins: ['@hey-api/client-fetch'], ··· 286 exclude: ['foo'], // [!code ++] 287 }, 288 }, 289 - path: 'https://get.heyapi.dev/hey-api/backend', 290 }, 291 output: 'src/client', 292 plugins: ['@hey-api/client-fetch'], ··· 303 304 ```js 305 export default { 306 - input: 'https://get.heyapi.dev/hey-api/backend', 307 output: { 308 path: 'src/client', 309 tsConfigPath: 'off', // [!code ++] ··· 319 320 ```js 321 export default { 322 - input: 'https://get.heyapi.dev/hey-api/backend', 323 output: 'src/client', 324 plugins: [ 325 // ...other plugins ··· 348 349 ```js 350 export default { 351 - input: 'https://get.heyapi.dev/hey-api/backend', 352 output: 'src/client', 353 plugins: [ 354 { ··· 368 ```js 369 export default { 370 client: '@hey-api/client-fetch', // [!code --] 371 - input: 'https://get.heyapi.dev/hey-api/backend', 372 output: 'src/client', 373 plugins: ['@hey-api/client-fetch'], // [!code ++] 374 }; ··· 389 390 ```js 391 export default { 392 - input: 'https://get.heyapi.dev/hey-api/backend', 393 output: 'src/client', 394 plugins: [ 395 { ··· 414 export default { 415 client: '@hey-api/client-fetch', 416 experimentalParser: false, // [!code ++] 417 - input: 'https://get.heyapi.dev/hey-api/backend', 418 output: 'src/client', 419 }; 420 ``` ··· 456 ```js 457 export default { 458 client: '@hey-api/client-fetch', 459 - input: 'https://get.heyapi.dev/hey-api/backend', 460 output: 'src/client', 461 plugins: [ 462 // ...other plugins ··· 482 export default { 483 client: '@hey-api/client-fetch', 484 debug: true, // [!code --] 485 - input: 'https://get.heyapi.dev/hey-api/backend', 486 logs: { 487 level: 'debug', // [!code ++] 488 }, ··· 498 export default { 499 client: '@hey-api/client-fetch', 500 experimentalParser: true, 501 - input: 'https://get.heyapi.dev/hey-api/backend', 502 output: 'src/client', 503 plugins: [ 504 // ...other plugins ··· 534 ```js 535 export default { 536 client: '@hey-api/client-fetch', 537 - input: 'https://get.heyapi.dev/hey-api/backend', 538 output: { 539 clean: false, // [!code ++] 540 path: 'src/client', ··· 550 export default { 551 client: '@hey-api/client-fetch', 552 experimentalParser: true, 553 - input: 'https://get.heyapi.dev/hey-api/backend', 554 output: 'src/client', 555 plugins: [ 556 // ...other plugins ··· 591 export default { 592 client: '@hey-api/client-fetch', 593 experimentalParser: true, 594 - input: 'https://get.heyapi.dev/hey-api/backend', 595 output: 'src/client', 596 plugins: [ 597 // ...other plugins ··· 633 experimentalParser: true, 634 input: { 635 include: '^(#/components/schemas/foo|#/paths/api/v1/foo/get)$', // [!code ++] 636 - path: 'https://get.heyapi.dev/hey-api/backend', 637 }, 638 output: 'src/client', 639 }; ··· 658 ```js [shorthand] 659 export default { 660 client: '@hey-api/client-fetch', 661 - input: 'https://get.heyapi.dev/hey-api/backend', 662 output: 'src/client', 663 schemas: false, // [!code --] 664 plugins: ['@hey-api/types', '@hey-api/services'], // [!code ++] ··· 668 ```js [*.export] 669 export default { 670 client: '@hey-api/client-fetch', 671 - input: 'https://get.heyapi.dev/hey-api/backend', 672 output: 'src/client', 673 schemas: { 674 export: false, // [!code --] ··· 686 ```js 687 export default { 688 client: '@hey-api/client-fetch', 689 - input: 'https://get.heyapi.dev/hey-api/backend', 690 output: 'src/client', 691 schemas: { 692 name: (name) => `${name}Schema`, // [!code --] ··· 708 ```js 709 export default { 710 client: '@hey-api/client-fetch', 711 - input: 'https://get.heyapi.dev/hey-api/backend', 712 output: 'src/client', 713 services: '^MySchema', // [!code --] 714 plugins: [ ··· 728 ```js 729 export default { 730 client: '@hey-api/client-fetch', 731 - input: 'https://get.heyapi.dev/hey-api/backend', 732 output: 'src/client', 733 services: { 734 name: '{{name}}Service', // [!code --] ··· 750 ```js 751 export default { 752 client: '@hey-api/client-fetch', 753 - input: 'https://get.heyapi.dev/hey-api/backend', 754 output: 'src/client', 755 types: { 756 dates: 'types+transform', // [!code --] ··· 772 ```js 773 export default { 774 client: '@hey-api/client-fetch', 775 - input: 'https://get.heyapi.dev/hey-api/backend', 776 output: 'src/client', 777 types: '^MySchema', // [!code --] 778 plugins: [ ··· 792 ```js 793 export default { 794 client: '@hey-api/client-fetch', 795 - input: 'https://get.heyapi.dev/hey-api/backend', 796 output: 'src/client', 797 types: { 798 name: 'PascalCase', // [!code --] ··· 815 816 ```js 817 export default { 818 - input: 'https://get.heyapi.dev/hey-api/backend', 819 output: 'src/client', 820 schemas: { 821 name: (name) => `$${name}`, // [!code ++] ··· 833 export default { 834 client: 'fetch', // [!code --] 835 client: 'legacy/fetch', // [!code ++] 836 - input: 'https://get.heyapi.dev/hey-api/backend', 837 output: 'src/client', 838 }; 839 ``` ··· 842 export default { 843 client: 'axios', // [!code --] 844 client: 'legacy/axios', // [!code ++] 845 - input: 'https://get.heyapi.dev/hey-api/backend', 846 output: 'src/client', 847 }; 848 ``` ··· 851 export default { 852 client: 'angular', // [!code --] 853 client: 'legacy/angular', // [!code ++] 854 - input: 'https://get.heyapi.dev/hey-api/backend', 855 output: 'src/client', 856 }; 857 ``` ··· 860 export default { 861 client: 'node', // [!code --] 862 client: 'legacy/node', // [!code ++] 863 - input: 'https://get.heyapi.dev/hey-api/backend', 864 output: 'src/client', 865 }; 866 ``` ··· 869 export default { 870 client: 'xhr', // [!code --] 871 client: 'legacy/xhr', // [!code ++] 872 - input: 'https://get.heyapi.dev/hey-api/backend', 873 output: 'src/client', 874 }; 875 ``` ··· 915 ```js 916 export default { 917 client: 'fetch', // [!code ++] 918 - input: 'https://get.heyapi.dev/hey-api/backend', 919 output: 'src/client', 920 }; 921 ``` ··· 930 import { createClient } from '@hey-api/openapi-ts'; 931 932 createClient({ 933 - input: 'https://get.heyapi.dev/hey-api/backend', 934 output: 'src/client', 935 services: { 936 methodNameBuilder: (service, name) => name, // [!code --] ··· 965 966 ```js 967 export default { 968 - input: 'https://get.heyapi.dev/hey-api/backend', 969 output: 'src/client', 970 services: { 971 asClass: true, // [!code ++] ··· 982 ```js 983 export default { 984 client: 'axios', // [!code ++] 985 - input: 'https://get.heyapi.dev/hey-api/backend', 986 output: 'src/client', 987 }; 988 ``` ··· 996 ```js 997 export default { 998 format: 'prettier', // [!code --] 999 - input: 'https://get.heyapi.dev/hey-api/backend', 1000 output: { 1001 format: 'prettier', // [!code ++] 1002 path: 'src/client', ··· 1010 1011 ```js 1012 export default { 1013 - input: 'https://get.heyapi.dev/hey-api/backend', 1014 lint: 'eslint', // [!code --] 1015 output: { 1016 lint: 'eslint', // [!code ++] ··· 1057 ```js 1058 export default { 1059 enums: 'javascript', // [!code --] 1060 - input: 'https://get.heyapi.dev/hey-api/backend', 1061 output: 'src/client', 1062 types: { 1063 enums: 'javascript', // [!code ++] ··· 1074 ```js{2} 1075 export default { 1076 format: 'prettier', 1077 - input: 'https://get.heyapi.dev/hey-api/backend', 1078 output: 'src/client', 1079 } 1080 ``` ··· 1085 1086 ```js{3} 1087 export default { 1088 - input: 'https://get.heyapi.dev/hey-api/backend', 1089 lint: 'eslint', 1090 output: 'src/client', 1091 } ··· 1097 1098 ```js{5} 1099 export default { 1100 - input: 'https://get.heyapi.dev/hey-api/backend', 1101 output: 'src/client', 1102 services: { 1103 operationId: true, ··· 1113 1114 ```js{5} 1115 export default { 1116 - input: 'https://get.heyapi.dev/hey-api/backend', 1117 output: 'src/client', 1118 services: { 1119 name: 'myAwesome{{name}}Api', ··· 1127 1128 ```js{5} 1129 export default { 1130 - input: 'https://get.heyapi.dev/hey-api/backend', 1131 output: 'src/client', 1132 services: { 1133 response: 'body', ··· 1141 1142 ```js{5} 1143 export default { 1144 - input: 'https://get.heyapi.dev/hey-api/backend', 1145 output: 'src/client', 1146 type: { 1147 dates: true, ··· 1170 1171 ```js{5} 1172 export default { 1173 - input: 'https://get.heyapi.dev/hey-api/backend', 1174 output: 'src/client', 1175 types: { 1176 name: 'PascalCase',
··· 17 18 ```js [Zod 3] 19 export default { 20 + input: 'hey-api/backend', // sign up at app.heyapi.dev 21 output: 'src/client', 22 plugins: [ 23 // ...other plugins ··· 31 32 ```js [Zod Mini] 33 export default { 34 + input: 'hey-api/backend', // sign up at app.heyapi.dev 35 output: 'src/client', 36 plugins: [ 37 // ...other plugins ··· 99 <!-- prettier-ignore-start --> 100 ```js 101 export default { 102 + input: 'hey-api/backend', // sign up at app.heyapi.dev 103 output: 'src/client', 104 plugins: [ 105 // ...other plugins ··· 212 213 ```js 214 export default { 215 + input: 'hey-api/backend', // sign up at app.heyapi.dev 216 output: 'src/client', 217 plugins: [ 218 // ...other plugins ··· 232 233 ```js 234 export default { 235 + input: 'hey-api/backend', // sign up at app.heyapi.dev 236 output: 'src/client', 237 plugins: [ 238 // ...other plugins ··· 266 }, 267 }, 268 include: '^(#/components/schemas/foo|#/paths/api/v1/foo/get)$', // [!code --] 269 + path: 'hey-api/backend', // sign up at app.heyapi.dev 270 }, 271 output: 'src/client', 272 plugins: ['@hey-api/client-fetch'], ··· 286 exclude: ['foo'], // [!code ++] 287 }, 288 }, 289 + path: 'hey-api/backend', // sign up at app.heyapi.dev 290 }, 291 output: 'src/client', 292 plugins: ['@hey-api/client-fetch'], ··· 303 304 ```js 305 export default { 306 + input: 'hey-api/backend', // sign up at app.heyapi.dev 307 output: { 308 path: 'src/client', 309 tsConfigPath: 'off', // [!code ++] ··· 319 320 ```js 321 export default { 322 + input: 'hey-api/backend', // sign up at app.heyapi.dev 323 output: 'src/client', 324 plugins: [ 325 // ...other plugins ··· 348 349 ```js 350 export default { 351 + input: 'hey-api/backend', // sign up at app.heyapi.dev 352 output: 'src/client', 353 plugins: [ 354 { ··· 368 ```js 369 export default { 370 client: '@hey-api/client-fetch', // [!code --] 371 + input: 'hey-api/backend', // sign up at app.heyapi.dev 372 output: 'src/client', 373 plugins: ['@hey-api/client-fetch'], // [!code ++] 374 }; ··· 389 390 ```js 391 export default { 392 + input: 'hey-api/backend', // sign up at app.heyapi.dev 393 output: 'src/client', 394 plugins: [ 395 { ··· 414 export default { 415 client: '@hey-api/client-fetch', 416 experimentalParser: false, // [!code ++] 417 + input: 'hey-api/backend', // sign up at app.heyapi.dev 418 output: 'src/client', 419 }; 420 ``` ··· 456 ```js 457 export default { 458 client: '@hey-api/client-fetch', 459 + input: 'hey-api/backend', // sign up at app.heyapi.dev 460 output: 'src/client', 461 plugins: [ 462 // ...other plugins ··· 482 export default { 483 client: '@hey-api/client-fetch', 484 debug: true, // [!code --] 485 + input: 'hey-api/backend', // sign up at app.heyapi.dev 486 logs: { 487 level: 'debug', // [!code ++] 488 }, ··· 498 export default { 499 client: '@hey-api/client-fetch', 500 experimentalParser: true, 501 + input: 'hey-api/backend', // sign up at app.heyapi.dev 502 output: 'src/client', 503 plugins: [ 504 // ...other plugins ··· 534 ```js 535 export default { 536 client: '@hey-api/client-fetch', 537 + input: 'hey-api/backend', // sign up at app.heyapi.dev 538 output: { 539 clean: false, // [!code ++] 540 path: 'src/client', ··· 550 export default { 551 client: '@hey-api/client-fetch', 552 experimentalParser: true, 553 + input: 'hey-api/backend', // sign up at app.heyapi.dev 554 output: 'src/client', 555 plugins: [ 556 // ...other plugins ··· 591 export default { 592 client: '@hey-api/client-fetch', 593 experimentalParser: true, 594 + input: 'hey-api/backend', // sign up at app.heyapi.dev 595 output: 'src/client', 596 plugins: [ 597 // ...other plugins ··· 633 experimentalParser: true, 634 input: { 635 include: '^(#/components/schemas/foo|#/paths/api/v1/foo/get)$', // [!code ++] 636 + path: 'hey-api/backend', // sign up at app.heyapi.dev 637 }, 638 output: 'src/client', 639 }; ··· 658 ```js [shorthand] 659 export default { 660 client: '@hey-api/client-fetch', 661 + input: 'hey-api/backend', // sign up at app.heyapi.dev 662 output: 'src/client', 663 schemas: false, // [!code --] 664 plugins: ['@hey-api/types', '@hey-api/services'], // [!code ++] ··· 668 ```js [*.export] 669 export default { 670 client: '@hey-api/client-fetch', 671 + input: 'hey-api/backend', // sign up at app.heyapi.dev 672 output: 'src/client', 673 schemas: { 674 export: false, // [!code --] ··· 686 ```js 687 export default { 688 client: '@hey-api/client-fetch', 689 + input: 'hey-api/backend', // sign up at app.heyapi.dev 690 output: 'src/client', 691 schemas: { 692 name: (name) => `${name}Schema`, // [!code --] ··· 708 ```js 709 export default { 710 client: '@hey-api/client-fetch', 711 + input: 'hey-api/backend', // sign up at app.heyapi.dev 712 output: 'src/client', 713 services: '^MySchema', // [!code --] 714 plugins: [ ··· 728 ```js 729 export default { 730 client: '@hey-api/client-fetch', 731 + input: 'hey-api/backend', // sign up at app.heyapi.dev 732 output: 'src/client', 733 services: { 734 name: '{{name}}Service', // [!code --] ··· 750 ```js 751 export default { 752 client: '@hey-api/client-fetch', 753 + input: 'hey-api/backend', // sign up at app.heyapi.dev 754 output: 'src/client', 755 types: { 756 dates: 'types+transform', // [!code --] ··· 772 ```js 773 export default { 774 client: '@hey-api/client-fetch', 775 + input: 'hey-api/backend', // sign up at app.heyapi.dev 776 output: 'src/client', 777 types: '^MySchema', // [!code --] 778 plugins: [ ··· 792 ```js 793 export default { 794 client: '@hey-api/client-fetch', 795 + input: 'hey-api/backend', // sign up at app.heyapi.dev 796 output: 'src/client', 797 types: { 798 name: 'PascalCase', // [!code --] ··· 815 816 ```js 817 export default { 818 + input: 'hey-api/backend', // sign up at app.heyapi.dev 819 output: 'src/client', 820 schemas: { 821 name: (name) => `$${name}`, // [!code ++] ··· 833 export default { 834 client: 'fetch', // [!code --] 835 client: 'legacy/fetch', // [!code ++] 836 + input: 'hey-api/backend', // sign up at app.heyapi.dev 837 output: 'src/client', 838 }; 839 ``` ··· 842 export default { 843 client: 'axios', // [!code --] 844 client: 'legacy/axios', // [!code ++] 845 + input: 'hey-api/backend', // sign up at app.heyapi.dev 846 output: 'src/client', 847 }; 848 ``` ··· 851 export default { 852 client: 'angular', // [!code --] 853 client: 'legacy/angular', // [!code ++] 854 + input: 'hey-api/backend', // sign up at app.heyapi.dev 855 output: 'src/client', 856 }; 857 ``` ··· 860 export default { 861 client: 'node', // [!code --] 862 client: 'legacy/node', // [!code ++] 863 + input: 'hey-api/backend', // sign up at app.heyapi.dev 864 output: 'src/client', 865 }; 866 ``` ··· 869 export default { 870 client: 'xhr', // [!code --] 871 client: 'legacy/xhr', // [!code ++] 872 + input: 'hey-api/backend', // sign up at app.heyapi.dev 873 output: 'src/client', 874 }; 875 ``` ··· 915 ```js 916 export default { 917 client: 'fetch', // [!code ++] 918 + input: 'hey-api/backend', // sign up at app.heyapi.dev 919 output: 'src/client', 920 }; 921 ``` ··· 930 import { createClient } from '@hey-api/openapi-ts'; 931 932 createClient({ 933 + input: 'hey-api/backend', // sign up at app.heyapi.dev 934 output: 'src/client', 935 services: { 936 methodNameBuilder: (service, name) => name, // [!code --] ··· 965 966 ```js 967 export default { 968 + input: 'hey-api/backend', // sign up at app.heyapi.dev 969 output: 'src/client', 970 services: { 971 asClass: true, // [!code ++] ··· 982 ```js 983 export default { 984 client: 'axios', // [!code ++] 985 + input: 'hey-api/backend', // sign up at app.heyapi.dev 986 output: 'src/client', 987 }; 988 ``` ··· 996 ```js 997 export default { 998 format: 'prettier', // [!code --] 999 + input: 'hey-api/backend', // sign up at app.heyapi.dev 1000 output: { 1001 format: 'prettier', // [!code ++] 1002 path: 'src/client', ··· 1010 1011 ```js 1012 export default { 1013 + input: 'hey-api/backend', // sign up at app.heyapi.dev 1014 lint: 'eslint', // [!code --] 1015 output: { 1016 lint: 'eslint', // [!code ++] ··· 1057 ```js 1058 export default { 1059 enums: 'javascript', // [!code --] 1060 + input: 'hey-api/backend', // sign up at app.heyapi.dev 1061 output: 'src/client', 1062 types: { 1063 enums: 'javascript', // [!code ++] ··· 1074 ```js{2} 1075 export default { 1076 format: 'prettier', 1077 + input: 'hey-api/backend', // sign up at app.heyapi.dev 1078 output: 'src/client', 1079 } 1080 ``` ··· 1085 1086 ```js{3} 1087 export default { 1088 + input: 'hey-api/backend', // sign up at app.heyapi.dev 1089 lint: 'eslint', 1090 output: 'src/client', 1091 } ··· 1097 1098 ```js{5} 1099 export default { 1100 + input: 'hey-api/backend', // sign up at app.heyapi.dev 1101 output: 'src/client', 1102 services: { 1103 operationId: true, ··· 1113 1114 ```js{5} 1115 export default { 1116 + input: 'hey-api/backend', // sign up at app.heyapi.dev 1117 output: 'src/client', 1118 services: { 1119 name: 'myAwesome{{name}}Api', ··· 1127 1128 ```js{5} 1129 export default { 1130 + input: 'hey-api/backend', // sign up at app.heyapi.dev 1131 output: 'src/client', 1132 services: { 1133 response: 'body', ··· 1141 1142 ```js{5} 1143 export default { 1144 + input: 'hey-api/backend', // sign up at app.heyapi.dev 1145 output: 'src/client', 1146 type: { 1147 dates: true, ··· 1170 1171 ```js{5} 1172 export default { 1173 + input: 'hey-api/backend', // sign up at app.heyapi.dev 1174 output: 'src/client', 1175 types: { 1176 name: 'PascalCase',
+2 -2
docs/openapi-ts/output.md
··· 61 62 ```js 63 export default { 64 - input: 'https://get.heyapi.dev/hey-api/backend', 65 output: { 66 indexFile: false, // [!code ++] 67 path: 'src/client', ··· 75 76 ```js 77 export default { 78 - input: 'https://get.heyapi.dev/hey-api/backend', 79 output: 'src/client', 80 plugins: [ 81 // ...other plugins
··· 61 62 ```js 63 export default { 64 + input: 'hey-api/backend', // sign up at app.heyapi.dev 65 output: { 66 indexFile: false, // [!code ++] 67 path: 'src/client', ··· 75 76 ```js 77 export default { 78 + input: 'hey-api/backend', // sign up at app.heyapi.dev 79 output: 'src/client', 80 plugins: [ 81 // ...other plugins
+3 -3
docs/openapi-ts/output/json-schema.md
··· 15 16 ```js [json] 17 export default { 18 - input: 'https://get.heyapi.dev/hey-api/backend', 19 output: 'src/client', 20 plugins: [ 21 // ...other plugins ··· 29 30 ```js [form] 31 export default { 32 - input: 'https://get.heyapi.dev/hey-api/backend', 33 output: 'src/client', 34 plugins: [ 35 // ...other plugins ··· 43 44 ```js [disabled] 45 export default { 46 - input: 'https://get.heyapi.dev/hey-api/backend', 47 output: 'src/client', 48 plugins: [ 49 // ...other plugins
··· 15 16 ```js [json] 17 export default { 18 + input: 'hey-api/backend', // sign up at app.heyapi.dev 19 output: 'src/client', 20 plugins: [ 21 // ...other plugins ··· 29 30 ```js [form] 31 export default { 32 + input: 'hey-api/backend', // sign up at app.heyapi.dev 33 output: 'src/client', 34 plugins: [ 35 // ...other plugins ··· 43 44 ```js [disabled] 45 export default { 46 + input: 'hey-api/backend', // sign up at app.heyapi.dev 47 output: 'src/client', 48 plugins: [ 49 // ...other plugins
+7 -7
docs/openapi-ts/output/sdk.md
··· 27 28 ```js [flat] 29 export default { 30 - input: 'https://get.heyapi.dev/hey-api/backend', 31 output: 'src/client', 32 plugins: [ 33 // ...other plugins ··· 41 42 ```js [class] 43 export default { 44 - input: 'https://get.heyapi.dev/hey-api/backend', 45 output: 'src/client', 46 plugins: [ 47 // ...other plugins ··· 55 56 ```js [none] 57 export default { 58 - input: 'https://get.heyapi.dev/hey-api/backend', 59 output: 'src/client', 60 plugins: [ 61 '@hey-api/typescript', ··· 152 153 ```js [sdk] 154 export default { 155 - input: 'https://get.heyapi.dev/hey-api/backend', 156 output: 'src/client', 157 plugins: [ 158 { ··· 165 166 ```js [validator] 167 export default { 168 - input: 'https://get.heyapi.dev/hey-api/backend', 169 output: 'src/client', 170 plugins: [ 171 { ··· 188 189 ```js [requests] 190 export default { 191 - input: 'https://get.heyapi.dev/hey-api/backend', 192 output: 'src/client', 193 plugins: [ 194 { ··· 203 204 ```js [responses] 205 export default { 206 - input: 'https://get.heyapi.dev/hey-api/backend', 207 output: 'src/client', 208 plugins: [ 209 {
··· 27 28 ```js [flat] 29 export default { 30 + input: 'hey-api/backend', // sign up at app.heyapi.dev 31 output: 'src/client', 32 plugins: [ 33 // ...other plugins ··· 41 42 ```js [class] 43 export default { 44 + input: 'hey-api/backend', // sign up at app.heyapi.dev 45 output: 'src/client', 46 plugins: [ 47 // ...other plugins ··· 55 56 ```js [none] 57 export default { 58 + input: 'hey-api/backend', // sign up at app.heyapi.dev 59 output: 'src/client', 60 plugins: [ 61 '@hey-api/typescript', ··· 152 153 ```js [sdk] 154 export default { 155 + input: 'hey-api/backend', // sign up at app.heyapi.dev 156 output: 'src/client', 157 plugins: [ 158 { ··· 165 166 ```js [validator] 167 export default { 168 + input: 'hey-api/backend', // sign up at app.heyapi.dev 169 output: 'src/client', 170 plugins: [ 171 { ··· 188 189 ```js [requests] 190 export default { 191 + input: 'hey-api/backend', // sign up at app.heyapi.dev 192 output: 'src/client', 193 plugins: [ 194 { ··· 203 204 ```js [responses] 205 export default { 206 + input: 'hey-api/backend', // sign up at app.heyapi.dev 207 output: 'src/client', 208 plugins: [ 209 {
+4 -4
docs/openapi-ts/output/typescript.md
··· 13 14 ```js 15 export default { 16 - input: 'https://get.heyapi.dev/hey-api/backend', 17 output: 'src/client', 18 plugins: [ 19 // ...other plugins ··· 86 87 ```js [disabled] 88 export default { 89 - input: 'https://get.heyapi.dev/hey-api/backend', 90 output: 'src/client', 91 plugins: [ 92 // ...other plugins ··· 100 101 ```js [javascript] 102 export default { 103 - input: 'https://get.heyapi.dev/hey-api/backend', 104 output: 'src/client', 105 plugins: [ 106 // ...other plugins ··· 114 115 ```js [typescript] 116 export default { 117 - input: 'https://get.heyapi.dev/hey-api/backend', 118 output: 'src/client', 119 plugins: [ 120 // ...other plugins
··· 13 14 ```js 15 export default { 16 + input: 'hey-api/backend', // sign up at app.heyapi.dev 17 output: 'src/client', 18 plugins: [ 19 // ...other plugins ··· 86 87 ```js [disabled] 88 export default { 89 + input: 'hey-api/backend', // sign up at app.heyapi.dev 90 output: 'src/client', 91 plugins: [ 92 // ...other plugins ··· 100 101 ```js [javascript] 102 export default { 103 + input: 'hey-api/backend', // sign up at app.heyapi.dev 104 output: 'src/client', 105 plugins: [ 106 // ...other plugins ··· 114 115 ```js [typescript] 116 export default { 117 + input: 'hey-api/backend', // sign up at app.heyapi.dev 118 output: 'src/client', 119 plugins: [ 120 // ...other plugins
+3 -3
docs/openapi-ts/plugins/angular.md
··· 43 44 ```js 45 export default { 46 - input: 'https://get.heyapi.dev/hey-api/backend', 47 output: 'src/client', 48 plugins: [ 49 // ...other plugins ··· 74 75 ```js [config] 76 export default { 77 - input: 'https://get.heyapi.dev/hey-api/backend', 78 output: 'src/client', 79 plugins: [ 80 // ...other plugins ··· 101 102 ```js [config] 103 export default { 104 - input: 'https://get.heyapi.dev/hey-api/backend', 105 output: 'src/client', 106 plugins: [ 107 // ...other plugins
··· 43 44 ```js 45 export default { 46 + input: 'hey-api/backend', // sign up at app.heyapi.dev 47 output: 'src/client', 48 plugins: [ 49 // ...other plugins ··· 74 75 ```js [config] 76 export default { 77 + input: 'hey-api/backend', // sign up at app.heyapi.dev 78 output: 'src/client', 79 plugins: [ 80 // ...other plugins ··· 101 102 ```js [config] 103 export default { 104 + input: 'hey-api/backend', // sign up at app.heyapi.dev 105 output: 'src/client', 106 plugins: [ 107 // ...other plugins
+3 -3
docs/openapi-ts/plugins/angular/v19.md
··· 43 44 ```js 45 export default { 46 - input: 'https://get.heyapi.dev/hey-api/backend', 47 output: 'src/client', 48 plugins: [ 49 // ...other plugins ··· 74 75 ```js [config] 76 export default { 77 - input: 'https://get.heyapi.dev/hey-api/backend', 78 output: 'src/client', 79 plugins: [ 80 // ...other plugins ··· 101 102 ```js [config] 103 export default { 104 - input: 'https://get.heyapi.dev/hey-api/backend', 105 output: 'src/client', 106 plugins: [ 107 // ...other plugins
··· 43 44 ```js 45 export default { 46 + input: 'hey-api/backend', // sign up at app.heyapi.dev 47 output: 'src/client', 48 plugins: [ 49 // ...other plugins ··· 74 75 ```js [config] 76 export default { 77 + input: 'hey-api/backend', // sign up at app.heyapi.dev 78 output: 'src/client', 79 plugins: [ 80 // ...other plugins ··· 101 102 ```js [config] 103 export default { 104 + input: 'hey-api/backend', // sign up at app.heyapi.dev 105 output: 'src/client', 106 plugins: [ 107 // ...other plugins
+1 -1
docs/openapi-ts/plugins/custom.md
··· 155 import { defineConfig } from 'path/to/my-plugin'; 156 157 export default { 158 - input: 'https://get.heyapi.dev/hey-api/backend', 159 output: 'src/client', 160 plugins: [ 161 defineConfig({
··· 155 import { defineConfig } from 'path/to/my-plugin'; 156 157 export default { 158 + input: 'hey-api/backend', // sign up at app.heyapi.dev 159 output: 'src/client', 160 plugins: [ 161 defineConfig({
+2 -2
docs/openapi-ts/plugins/fastify.md
··· 42 43 ```js 44 export default { 45 - input: 'https://get.heyapi.dev/hey-api/backend', 46 output: 'src/client', 47 plugins: [ 48 // ...other plugins ··· 82 83 ```js [config] 84 export default { 85 - input: 'https://get.heyapi.dev/hey-api/backend', 86 output: 'src/client', 87 plugins: [ 88 // ...other plugins
··· 42 43 ```js 44 export default { 45 + input: 'hey-api/backend', // sign up at app.heyapi.dev 46 output: 'src/client', 47 plugins: [ 48 // ...other plugins ··· 82 83 ```js [config] 84 export default { 85 + input: 'hey-api/backend', // sign up at app.heyapi.dev 86 output: 'src/client', 87 plugins: [ 88 // ...other plugins
+23 -23
docs/openapi-ts/plugins/tanstack-query.md
··· 43 44 ```js [react] 45 export default { 46 - input: 'https://get.heyapi.dev/hey-api/backend', 47 output: 'src/client', 48 plugins: [ 49 // ...other plugins ··· 54 55 ```js [vue] 56 export default { 57 - input: 'https://get.heyapi.dev/hey-api/backend', 58 output: 'src/client', 59 plugins: [ 60 // ...other plugins ··· 65 66 ```js [angular] 67 export default { 68 - input: 'https://get.heyapi.dev/hey-api/backend', 69 output: 'src/client', 70 plugins: [ 71 // ...other plugins ··· 76 77 ```js [svelte] 78 export default { 79 - input: 'https://get.heyapi.dev/hey-api/backend', 80 output: 'src/client', 81 plugins: [ 82 // ...other plugins ··· 87 88 ```js [solid] 89 export default { 90 - input: 'https://get.heyapi.dev/hey-api/backend', 91 output: 'src/client', 92 plugins: [ 93 // ...other plugins ··· 120 121 ```js [config] 122 export default { 123 - input: 'https://get.heyapi.dev/hey-api/backend', 124 output: 'src/client', 125 plugins: [ 126 // ...other plugins ··· 153 154 ```js [config] 155 export default { 156 - input: 'https://get.heyapi.dev/hey-api/backend', 157 output: 'src/client', 158 plugins: [ 159 // ...other plugins ··· 179 const queryKey = [ 180 { 181 _id: 'getPetById', 182 - baseUrl: 'https://get.heyapi.dev', 183 path: { 184 petId: 1, 185 }, ··· 189 190 ```js [config] 191 export default { 192 - input: 'https://get.heyapi.dev/hey-api/backend', 193 output: 'src/client', 194 plugins: [ 195 // ...other plugins ··· 213 const queryKey = [ 214 { 215 _id: 'getPetById', 216 - baseUrl: 'https://get.heyapi.dev', 217 path: { 218 petId: 1, 219 }, ··· 224 225 ```js [config] 226 export default { 227 - input: 'https://get.heyapi.dev/hey-api/backend', 228 output: 'src/client', 229 plugins: [ 230 // ...other plugins ··· 256 257 ```js [config] 258 export default { 259 - input: 'https://get.heyapi.dev/hey-api/backend', 260 output: 'src/client', 261 plugins: [ 262 // ...other plugins ··· 284 285 ```js [config] 286 export default { 287 - input: 'https://get.heyapi.dev/hey-api/backend', 288 output: 'src/client', 289 plugins: [ 290 // ...other plugins ··· 320 321 ```js [config] 322 export default { 323 - input: 'https://get.heyapi.dev/hey-api/backend', 324 output: 'src/client', 325 plugins: [ 326 // ...other plugins ··· 353 354 ```js [config] 355 export default { 356 - input: 'https://get.heyapi.dev/hey-api/backend', 357 output: 'src/client', 358 plugins: [ 359 // ...other plugins ··· 380 { 381 _id: 'getPetById', 382 _infinite: true, 383 - baseUrl: 'https://get.heyapi.dev', 384 path: { 385 petId: 1, 386 }, ··· 390 391 ```js [config] 392 export default { 393 - input: 'https://get.heyapi.dev/hey-api/backend', 394 output: 'src/client', 395 plugins: [ 396 // ...other plugins ··· 415 { 416 _id: 'getPetById', 417 _infinite: true, 418 - baseUrl: 'https://get.heyapi.dev', 419 path: { 420 petId: 1, 421 }, ··· 426 427 ```js [config] 428 export default { 429 - input: 'https://get.heyapi.dev/hey-api/backend', 430 output: 'src/client', 431 plugins: [ 432 // ...other plugins ··· 458 459 ```js [config] 460 export default { 461 - input: 'https://get.heyapi.dev/hey-api/backend', 462 output: 'src/client', 463 plugins: [ 464 // ...other plugins ··· 486 487 ```js [config] 488 export default { 489 - input: 'https://get.heyapi.dev/hey-api/backend', 490 output: 'src/client', 491 plugins: [ 492 // ...other plugins ··· 525 526 ```js [config] 527 export default { 528 - input: 'https://get.heyapi.dev/hey-api/backend', 529 output: 'src/client', 530 plugins: [ 531 // ...other plugins ··· 558 559 ```js [config] 560 export default { 561 - input: 'https://get.heyapi.dev/hey-api/backend', 562 output: 'src/client', 563 plugins: [ 564 // ...other plugins
··· 43 44 ```js [react] 45 export default { 46 + input: 'hey-api/backend', // sign up at app.heyapi.dev 47 output: 'src/client', 48 plugins: [ 49 // ...other plugins ··· 54 55 ```js [vue] 56 export default { 57 + input: 'hey-api/backend', // sign up at app.heyapi.dev 58 output: 'src/client', 59 plugins: [ 60 // ...other plugins ··· 65 66 ```js [angular] 67 export default { 68 + input: 'hey-api/backend', // sign up at app.heyapi.dev 69 output: 'src/client', 70 plugins: [ 71 // ...other plugins ··· 76 77 ```js [svelte] 78 export default { 79 + input: 'hey-api/backend', // sign up at app.heyapi.dev 80 output: 'src/client', 81 plugins: [ 82 // ...other plugins ··· 87 88 ```js [solid] 89 export default { 90 + input: 'hey-api/backend', // sign up at app.heyapi.dev 91 output: 'src/client', 92 plugins: [ 93 // ...other plugins ··· 120 121 ```js [config] 122 export default { 123 + input: 'hey-api/backend', // sign up at app.heyapi.dev 124 output: 'src/client', 125 plugins: [ 126 // ...other plugins ··· 153 154 ```js [config] 155 export default { 156 + input: 'hey-api/backend', // sign up at app.heyapi.dev 157 output: 'src/client', 158 plugins: [ 159 // ...other plugins ··· 179 const queryKey = [ 180 { 181 _id: 'getPetById', 182 + baseUrl: 'https://app.heyapi.dev', 183 path: { 184 petId: 1, 185 }, ··· 189 190 ```js [config] 191 export default { 192 + input: 'hey-api/backend', // sign up at app.heyapi.dev 193 output: 'src/client', 194 plugins: [ 195 // ...other plugins ··· 213 const queryKey = [ 214 { 215 _id: 'getPetById', 216 + baseUrl: 'https://app.heyapi.dev', 217 path: { 218 petId: 1, 219 }, ··· 224 225 ```js [config] 226 export default { 227 + input: 'hey-api/backend', // sign up at app.heyapi.dev 228 output: 'src/client', 229 plugins: [ 230 // ...other plugins ··· 256 257 ```js [config] 258 export default { 259 + input: 'hey-api/backend', // sign up at app.heyapi.dev 260 output: 'src/client', 261 plugins: [ 262 // ...other plugins ··· 284 285 ```js [config] 286 export default { 287 + input: 'hey-api/backend', // sign up at app.heyapi.dev 288 output: 'src/client', 289 plugins: [ 290 // ...other plugins ··· 320 321 ```js [config] 322 export default { 323 + input: 'hey-api/backend', // sign up at app.heyapi.dev 324 output: 'src/client', 325 plugins: [ 326 // ...other plugins ··· 353 354 ```js [config] 355 export default { 356 + input: 'hey-api/backend', // sign up at app.heyapi.dev 357 output: 'src/client', 358 plugins: [ 359 // ...other plugins ··· 380 { 381 _id: 'getPetById', 382 _infinite: true, 383 + baseUrl: 'https://app.heyapi.dev', 384 path: { 385 petId: 1, 386 }, ··· 390 391 ```js [config] 392 export default { 393 + input: 'hey-api/backend', // sign up at app.heyapi.dev 394 output: 'src/client', 395 plugins: [ 396 // ...other plugins ··· 415 { 416 _id: 'getPetById', 417 _infinite: true, 418 + baseUrl: 'https://app.heyapi.dev', 419 path: { 420 petId: 1, 421 }, ··· 426 427 ```js [config] 428 export default { 429 + input: 'hey-api/backend', // sign up at app.heyapi.dev 430 output: 'src/client', 431 plugins: [ 432 // ...other plugins ··· 458 459 ```js [config] 460 export default { 461 + input: 'hey-api/backend', // sign up at app.heyapi.dev 462 output: 'src/client', 463 plugins: [ 464 // ...other plugins ··· 486 487 ```js [config] 488 export default { 489 + input: 'hey-api/backend', // sign up at app.heyapi.dev 490 output: 'src/client', 491 plugins: [ 492 // ...other plugins ··· 525 526 ```js [config] 527 export default { 528 + input: 'hey-api/backend', // sign up at app.heyapi.dev 529 output: 'src/client', 530 plugins: [ 531 // ...other plugins ··· 558 559 ```js [config] 560 export default { 561 + input: 'hey-api/backend', // sign up at app.heyapi.dev 562 output: 'src/client', 563 plugins: [ 564 // ...other plugins
+6 -6
docs/openapi-ts/plugins/valibot.md
··· 31 32 ```js 33 export default { 34 - input: 'https://get.heyapi.dev/hey-api/backend', 35 output: 'src/client', 36 plugins: [ 37 // ...other plugins ··· 46 47 ```js 48 export default { 49 - input: 'https://get.heyapi.dev/hey-api/backend', 50 output: 'src/client', 51 plugins: [ 52 // ...other plugins ··· 88 89 ```js [config] 90 export default { 91 - input: 'https://get.heyapi.dev/hey-api/backend', 92 output: 'src/client', 93 plugins: [ 94 // ...other plugins ··· 127 128 ```js [config] 129 export default { 130 - input: 'https://get.heyapi.dev/hey-api/backend', 131 output: 'src/client', 132 plugins: [ 133 // ...other plugins ··· 159 160 ```js [config] 161 export default { 162 - input: 'https://get.heyapi.dev/hey-api/backend', 163 output: 'src/client', 164 plugins: [ 165 // ...other plugins ··· 192 193 ```js [config] 194 export default { 195 - input: 'https://get.heyapi.dev/hey-api/backend', 196 output: 'src/client', 197 plugins: [ 198 // ...other plugins
··· 31 32 ```js 33 export default { 34 + input: 'hey-api/backend', // sign up at app.heyapi.dev 35 output: 'src/client', 36 plugins: [ 37 // ...other plugins ··· 46 47 ```js 48 export default { 49 + input: 'hey-api/backend', // sign up at app.heyapi.dev 50 output: 'src/client', 51 plugins: [ 52 // ...other plugins ··· 88 89 ```js [config] 90 export default { 91 + input: 'hey-api/backend', // sign up at app.heyapi.dev 92 output: 'src/client', 93 plugins: [ 94 // ...other plugins ··· 127 128 ```js [config] 129 export default { 130 + input: 'hey-api/backend', // sign up at app.heyapi.dev 131 output: 'src/client', 132 plugins: [ 133 // ...other plugins ··· 159 160 ```js [config] 161 export default { 162 + input: 'hey-api/backend', // sign up at app.heyapi.dev 163 output: 'src/client', 164 plugins: [ 165 // ...other plugins ··· 192 193 ```js [config] 194 export default { 195 + input: 'hey-api/backend', // sign up at app.heyapi.dev 196 output: 'src/client', 197 plugins: [ 198 // ...other plugins
+7 -7
docs/openapi-ts/plugins/zod.md
··· 31 32 ```js 33 export default { 34 - input: 'https://get.heyapi.dev/hey-api/backend', 35 output: 'src/client', 36 plugins: [ 37 // ...other plugins ··· 46 47 ```js 48 export default { 49 - input: 'https://get.heyapi.dev/hey-api/backend', 50 output: 'src/client', 51 plugins: [ 52 // ...other plugins ··· 88 89 ```js [config] 90 export default { 91 - input: 'https://get.heyapi.dev/hey-api/backend', 92 output: 'src/client', 93 plugins: [ 94 // ...other plugins ··· 127 128 ```js [config] 129 export default { 130 - input: 'https://get.heyapi.dev/hey-api/backend', 131 output: 'src/client', 132 plugins: [ 133 // ...other plugins ··· 159 160 ```js [config] 161 export default { 162 - input: 'https://get.heyapi.dev/hey-api/backend', 163 output: 'src/client', 164 plugins: [ 165 // ...other plugins ··· 189 190 ```js [config] 191 export default { 192 - input: 'https://get.heyapi.dev/hey-api/backend', 193 output: 'src/client', 194 plugins: [ 195 // ...other plugins ··· 215 216 ```js [config] 217 export default { 218 - input: 'https://get.heyapi.dev/hey-api/backend', 219 output: 'src/client', 220 plugins: [ 221 // ...other plugins
··· 31 32 ```js 33 export default { 34 + input: 'hey-api/backend', // sign up at app.heyapi.dev 35 output: 'src/client', 36 plugins: [ 37 // ...other plugins ··· 46 47 ```js 48 export default { 49 + input: 'hey-api/backend', // sign up at app.heyapi.dev 50 output: 'src/client', 51 plugins: [ 52 // ...other plugins ··· 88 89 ```js [config] 90 export default { 91 + input: 'hey-api/backend', // sign up at app.heyapi.dev 92 output: 'src/client', 93 plugins: [ 94 // ...other plugins ··· 127 128 ```js [config] 129 export default { 130 + input: 'hey-api/backend', // sign up at app.heyapi.dev 131 output: 'src/client', 132 plugins: [ 133 // ...other plugins ··· 159 160 ```js [config] 161 export default { 162 + input: 'hey-api/backend', // sign up at app.heyapi.dev 163 output: 'src/client', 164 plugins: [ 165 // ...other plugins ··· 189 190 ```js [config] 191 export default { 192 + input: 'hey-api/backend', // sign up at app.heyapi.dev 193 output: 'src/client', 194 plugins: [ 195 // ...other plugins ··· 215 216 ```js [config] 217 export default { 218 + input: 'hey-api/backend', // sign up at app.heyapi.dev 219 output: 'src/client', 220 plugins: [ 221 // ...other plugins
+7 -7
docs/openapi-ts/plugins/zod/mini.md
··· 31 32 ```js 33 export default { 34 - input: 'https://get.heyapi.dev/hey-api/backend', 35 output: 'src/client', 36 plugins: [ 37 // ...other plugins ··· 49 50 ```js 51 export default { 52 - input: 'https://get.heyapi.dev/hey-api/backend', 53 output: 'src/client', 54 plugins: [ 55 // ...other plugins ··· 91 92 ```js [config] 93 export default { 94 - input: 'https://get.heyapi.dev/hey-api/backend', 95 output: 'src/client', 96 plugins: [ 97 // ...other plugins ··· 130 131 ```js [config] 132 export default { 133 - input: 'https://get.heyapi.dev/hey-api/backend', 134 output: 'src/client', 135 plugins: [ 136 // ...other plugins ··· 162 163 ```js [config] 164 export default { 165 - input: 'https://get.heyapi.dev/hey-api/backend', 166 output: 'src/client', 167 plugins: [ 168 // ...other plugins ··· 192 193 ```js [config] 194 export default { 195 - input: 'https://get.heyapi.dev/hey-api/backend', 196 output: 'src/client', 197 plugins: [ 198 // ...other plugins ··· 218 219 ```js [config] 220 export default { 221 - input: 'https://get.heyapi.dev/hey-api/backend', 222 output: 'src/client', 223 plugins: [ 224 // ...other plugins
··· 31 32 ```js 33 export default { 34 + input: 'hey-api/backend', // sign up at app.heyapi.dev 35 output: 'src/client', 36 plugins: [ 37 // ...other plugins ··· 49 50 ```js 51 export default { 52 + input: 'hey-api/backend', // sign up at app.heyapi.dev 53 output: 'src/client', 54 plugins: [ 55 // ...other plugins ··· 91 92 ```js [config] 93 export default { 94 + input: 'hey-api/backend', // sign up at app.heyapi.dev 95 output: 'src/client', 96 plugins: [ 97 // ...other plugins ··· 130 131 ```js [config] 132 export default { 133 + input: 'hey-api/backend', // sign up at app.heyapi.dev 134 output: 'src/client', 135 plugins: [ 136 // ...other plugins ··· 162 163 ```js [config] 164 export default { 165 + input: 'hey-api/backend', // sign up at app.heyapi.dev 166 output: 'src/client', 167 plugins: [ 168 // ...other plugins ··· 192 193 ```js [config] 194 export default { 195 + input: 'hey-api/backend', // sign up at app.heyapi.dev 196 output: 'src/client', 197 plugins: [ 198 // ...other plugins ··· 218 219 ```js [config] 220 export default { 221 + input: 'hey-api/backend', // sign up at app.heyapi.dev 222 output: 'src/client', 223 plugins: [ 224 // ...other plugins
+7 -7
docs/openapi-ts/plugins/zod/v3.md
··· 31 32 ```js 33 export default { 34 - input: 'https://get.heyapi.dev/hey-api/backend', 35 output: 'src/client', 36 plugins: [ 37 // ...other plugins ··· 49 50 ```js 51 export default { 52 - input: 'https://get.heyapi.dev/hey-api/backend', 53 output: 'src/client', 54 plugins: [ 55 // ...other plugins ··· 91 92 ```js [config] 93 export default { 94 - input: 'https://get.heyapi.dev/hey-api/backend', 95 output: 'src/client', 96 plugins: [ 97 // ...other plugins ··· 130 131 ```js [config] 132 export default { 133 - input: 'https://get.heyapi.dev/hey-api/backend', 134 output: 'src/client', 135 plugins: [ 136 // ...other plugins ··· 162 163 ```js [config] 164 export default { 165 - input: 'https://get.heyapi.dev/hey-api/backend', 166 output: 'src/client', 167 plugins: [ 168 // ...other plugins ··· 190 191 ```js [config] 192 export default { 193 - input: 'https://get.heyapi.dev/hey-api/backend', 194 output: 'src/client', 195 plugins: [ 196 // ...other plugins ··· 216 217 ```js [config] 218 export default { 219 - input: 'https://get.heyapi.dev/hey-api/backend', 220 output: 'src/client', 221 plugins: [ 222 // ...other plugins
··· 31 32 ```js 33 export default { 34 + input: 'hey-api/backend', // sign up at app.heyapi.dev 35 output: 'src/client', 36 plugins: [ 37 // ...other plugins ··· 49 50 ```js 51 export default { 52 + input: 'hey-api/backend', // sign up at app.heyapi.dev 53 output: 'src/client', 54 plugins: [ 55 // ...other plugins ··· 91 92 ```js [config] 93 export default { 94 + input: 'hey-api/backend', // sign up at app.heyapi.dev 95 output: 'src/client', 96 plugins: [ 97 // ...other plugins ··· 130 131 ```js [config] 132 export default { 133 + input: 'hey-api/backend', // sign up at app.heyapi.dev 134 output: 'src/client', 135 plugins: [ 136 // ...other plugins ··· 162 163 ```js [config] 164 export default { 165 + input: 'hey-api/backend', // sign up at app.heyapi.dev 166 output: 'src/client', 167 plugins: [ 168 // ...other plugins ··· 190 191 ```js [config] 192 export default { 193 + input: 'hey-api/backend', // sign up at app.heyapi.dev 194 output: 'src/client', 195 plugins: [ 196 // ...other plugins ··· 216 217 ```js [config] 218 export default { 219 + input: 'hey-api/backend', // sign up at app.heyapi.dev 220 output: 'src/client', 221 plugins: [ 222 // ...other plugins
+3 -3
docs/openapi-ts/transformers.md
··· 33 34 ```js 35 export default { 36 - input: 'https://get.heyapi.dev/hey-api/backend', 37 output: 'src/client', 38 plugins: [ 39 // ...other plugins ··· 48 49 ```js 50 export default { 51 - input: 'https://get.heyapi.dev/hey-api/backend', 52 output: 'src/client', 53 plugins: [ 54 // ...other plugins ··· 67 68 ```js 69 export default { 70 - input: 'https://get.heyapi.dev/hey-api/backend', 71 output: 'src/client', 72 plugins: [ 73 // ...other plugins
··· 33 34 ```js 35 export default { 36 + input: 'hey-api/backend', // sign up at app.heyapi.dev 37 output: 'src/client', 38 plugins: [ 39 // ...other plugins ··· 48 49 ```js 50 export default { 51 + input: 'hey-api/backend', // sign up at app.heyapi.dev 52 output: 'src/client', 53 plugins: [ 54 // ...other plugins ··· 67 68 ```js 69 export default { 70 + input: 'hey-api/backend', // sign up at app.heyapi.dev 71 output: 'src/client', 72 plugins: [ 73 // ...other plugins
+7 -2
examples/openapi-ts-openai/src/App.tsx
··· 36 const [isRequiredNameError] = useState(false); 37 38 const onCreateResponse = async (values: FormData) => { 39 - const response = await sdk.responses.create({ 40 input: values.get('input') as string, 41 model: 'gpt-5-nano', 42 }); 43 44 - console.log(response.output_text); 45 const { data, error } = await client.createResponse({ 46 body: { 47 input: values.get('input') as string, 48 model: 'gpt-5-nano', 49 }, 50 }); 51 if (error) {
··· 36 const [isRequiredNameError] = useState(false); 37 38 const onCreateResponse = async (values: FormData) => { 39 + const stream = await sdk.responses.create({ 40 input: values.get('input') as string, 41 model: 'gpt-5-nano', 42 + stream: true, 43 }); 44 45 + for await (const event of stream) { 46 + console.log(event); 47 + } 48 + 49 const { data, error } = await client.createResponse({ 50 body: { 51 input: values.get('input') as string, 52 model: 'gpt-5-nano', 53 + stream: true, 54 }, 55 }); 56 if (error) {
+3 -2
packages/openapi-ts-tests/main/test/openapi-ts.config.ts
··· 39 // 'full.yaml', 40 // 'validators-circular-ref.json', 41 ), 42 // path: 'http://localhost:4000/', 43 - // path: 'https://get.heyapi.dev/', 44 - // path: 'https://get.heyapi.dev/hey-api/backend?branch=main&version=1.0.0', 45 // path: 'http://localhost:8000/openapi.json', 46 // path: 'https://mongodb-mms-prod-build-server.s3.amazonaws.com/openapi/2caffd88277a4e27c95dcefc7e3b6a63a3b03297-v2-2023-11-15.json', 47 // path: 'https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml',
··· 39 // 'full.yaml', 40 // 'validators-circular-ref.json', 41 ), 42 + // path: 'hey-api/backend', 43 + // path: 'hey-api/backend?branch=main&version=1.0.0', 44 + // path: 'https://get.heyapi.dev/hey-api/backend?branch=main&version=1.0.0', 45 // path: 'http://localhost:4000/', 46 // path: 'http://localhost:8000/openapi.json', 47 // path: 'https://mongodb-mms-prod-build-server.s3.amazonaws.com/openapi/2caffd88277a4e27c95dcefc7e3b6a63a3b03297-v2-2023-11-15.json', 48 // path: 'https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml',
+9 -9
packages/openapi-ts/CHANGELOG.md
··· 116 117 ```js 118 export default { 119 - input: 'https://get.heyapi.dev/hey-api/backend', 120 output: 'src/client', 121 plugins: [ 122 // ...other plugins ··· 130 131 ```js 132 export default { 133 - input: 'https://get.heyapi.dev/hey-api/backend', 134 output: 'src/client', 135 plugins: [ 136 // ...other plugins ··· 261 262 ```js 263 export default { 264 - input: 'https://get.heyapi.dev/hey-api/backend', 265 output: 'src/client', 266 plugins: [ 267 // ...other plugins ··· 438 439 ```js 440 export default { 441 - input: 'https://get.heyapi.dev/hey-api/backend', 442 output: 'src/client', 443 plugins: [ 444 // ...other plugins ··· 625 626 ```js 627 export default { 628 - input: 'https://get.heyapi.dev/hey-api/backend', 629 output: { 630 path: 'src/client', 631 tsConfigPath: 'off', ··· 717 718 ```js 719 export default { 720 - input: 'https://get.heyapi.dev/hey-api/backend', 721 output: 'src/client', 722 plugins: [ 723 // ...other plugins ··· 2854 - Better handling of services without tags 2855 - Updated dependencies 2856 , // [!code --] 2857 - path: 'https://get.heyapi.dev/hey-api/backend', 2858 }, 2859 output: 'src/client', 2860 plugins: ['@hey-api/client-fetch'], ··· 2926 2927 ```js 2928 export default { 2929 - input: 'https://get.heyapi.dev/hey-api/backend', 2930 output: { 2931 path: 'src/client', 2932 tsConfigPath: 'off', ··· 3018 3019 ```js 3020 export default { 3021 - input: 'https://get.heyapi.dev/hey-api/backend', 3022 output: 'src/client', 3023 plugins: [ 3024 // ...other plugins
··· 116 117 ```js 118 export default { 119 + input: 'hey-api/backend', // sign up at app.heyapi.dev 120 output: 'src/client', 121 plugins: [ 122 // ...other plugins ··· 130 131 ```js 132 export default { 133 + input: 'hey-api/backend', // sign up at app.heyapi.dev 134 output: 'src/client', 135 plugins: [ 136 // ...other plugins ··· 261 262 ```js 263 export default { 264 + input: 'hey-api/backend', // sign up at app.heyapi.dev 265 output: 'src/client', 266 plugins: [ 267 // ...other plugins ··· 438 439 ```js 440 export default { 441 + input: 'hey-api/backend', // sign up at app.heyapi.dev 442 output: 'src/client', 443 plugins: [ 444 // ...other plugins ··· 625 626 ```js 627 export default { 628 + input: 'hey-api/backend', // sign up at app.heyapi.dev 629 output: { 630 path: 'src/client', 631 tsConfigPath: 'off', ··· 717 718 ```js 719 export default { 720 + input: 'hey-api/backend', // sign up at app.heyapi.dev 721 output: 'src/client', 722 plugins: [ 723 // ...other plugins ··· 2854 - Better handling of services without tags 2855 - Updated dependencies 2856 , // [!code --] 2857 + path: 'hey-api/backend', // sign up at app.heyapi.dev 2858 }, 2859 output: 'src/client', 2860 plugins: ['@hey-api/client-fetch'], ··· 2926 2927 ```js 2928 export default { 2929 + input: 'hey-api/backend', // sign up at app.heyapi.dev 2930 output: { 2931 path: 'src/client', 2932 tsConfigPath: 'off', ··· 3018 3019 ```js 3020 export default { 3021 + input: 'hey-api/backend', // sign up at app.heyapi.dev 3022 output: 'src/client', 3023 plugins: [ 3024 // ...other plugins
+5 -7
packages/openapi-ts/README.md
··· 144 The fastest way to use `@hey-api/openapi-ts` is via npx 145 146 ```sh 147 - npx @hey-api/openapi-ts \ 148 - -i https://get.heyapi.dev/hey-api/backend \ 149 - -o src/client 150 ``` 151 152 Congratulations on creating your first client! 🎉 You can learn more about the generated files on the [Output](https://heyapi.dev/openapi-ts/output) page. ··· 213 import { createClient } from '@hey-api/openapi-ts'; 214 215 createClient({ 216 - input: 'https://get.heyapi.dev/hey-api/backend', 217 output: 'src/client', 218 }); 219 ``` ··· 228 import { defineConfig } from '@hey-api/openapi-ts'; 229 230 export default defineConfig({ 231 - input: 'https://get.heyapi.dev/hey-api/backend', 232 output: 'src/client', 233 }); 234 ``` ··· 238 ```js 239 /** @type {import('@hey-api/openapi-ts').UserConfig} */ 240 module.exports = { 241 - input: 'https://get.heyapi.dev/hey-api/backend', 242 output: 'src/client', 243 }; 244 ``` ··· 248 ```js 249 /** @type {import('@hey-api/openapi-ts').UserConfig} */ 250 export default { 251 - input: 'https://get.heyapi.dev/hey-api/backend', 252 output: 'src/client', 253 }; 254 ```
··· 144 The fastest way to use `@hey-api/openapi-ts` is via npx 145 146 ```sh 147 + npx @hey-api/openapi-ts -i hey-api/backend -o src/client 148 ``` 149 150 Congratulations on creating your first client! 🎉 You can learn more about the generated files on the [Output](https://heyapi.dev/openapi-ts/output) page. ··· 211 import { createClient } from '@hey-api/openapi-ts'; 212 213 createClient({ 214 + input: 'hey-api/backend', // sign up at app.heyapi.dev 215 output: 'src/client', 216 }); 217 ``` ··· 226 import { defineConfig } from '@hey-api/openapi-ts'; 227 228 export default defineConfig({ 229 + input: 'hey-api/backend', // sign up at app.heyapi.dev 230 output: 'src/client', 231 }); 232 ``` ··· 236 ```js 237 /** @type {import('@hey-api/openapi-ts').UserConfig} */ 238 module.exports = { 239 + input: 'hey-api/backend', // sign up at app.heyapi.dev 240 output: 'src/client', 241 }; 242 ``` ··· 246 ```js 247 /** @type {import('@hey-api/openapi-ts').UserConfig} */ 248 export default { 249 + input: 'hey-api/backend', // sign up at app.heyapi.dev 250 output: 'src/client', 251 }; 252 ```
+10 -4
packages/openapi-ts/src/config/__tests__/input.test.ts
··· 96 }; 97 98 const result = getInput(userConfig); 99 - expect(result.path).toBe('https://get.heyapi.dev'); 100 }); 101 102 it('should handle object input (existing functionality)', () => { ··· 178 output: 'src/client', 179 }; 180 181 - expect(() => getInput(userConfig)).toThrow('Invalid ReadMe input format'); 182 }); 183 184 it('should throw error for invalid ReadMe UUID', () => { ··· 187 output: 'src/client', 188 }; 189 190 - expect(() => getInput(userConfig)).toThrow('Invalid ReadMe input format'); 191 }); 192 193 it('should throw error for invalid ReadMe format in object input', () => { ··· 198 output: 'src/client', 199 }; 200 201 - expect(() => getInput(userConfig)).toThrow('Invalid ReadMe input format'); 202 }); 203 }); 204 });
··· 96 }; 97 98 const result = getInput(userConfig); 99 + expect(result.path).toBe('https://get.heyapi.dev/myorg/myproject'); 100 }); 101 102 it('should handle object input (existing functionality)', () => { ··· 178 output: 'src/client', 179 }; 180 181 + expect(() => getInput(userConfig)).toThrow( 182 + 'Invalid ReadMe shorthand format', 183 + ); 184 }); 185 186 it('should throw error for invalid ReadMe UUID', () => { ··· 189 output: 'src/client', 190 }; 191 192 + expect(() => getInput(userConfig)).toThrow( 193 + 'Invalid ReadMe shorthand format', 194 + ); 195 }); 196 197 it('should throw error for invalid ReadMe format in object input', () => { ··· 202 output: 'src/client', 203 }; 204 205 + expect(() => getInput(userConfig)).toThrow( 206 + 'Invalid ReadMe shorthand format', 207 + ); 208 }); 209 }); 210 });
+25 -13
packages/openapi-ts/src/config/input.ts
··· 1 import type { Config, UserConfig } from '../types/config'; 2 - import { isReadmeInput, transformReadmeInput } from '../utils/readme'; 3 4 const defaultWatch: Config['input']['watch'] = { 5 enabled: false, ··· 39 }; 40 41 if (typeof userConfig.input === 'string') { 42 - // Handle ReadMe input format transformation 43 - if (isReadmeInput(userConfig.input)) { 44 - input.path = transformReadmeInput(userConfig.input); 45 - } else { 46 - input.path = userConfig.input; 47 - } 48 } else if ( 49 userConfig.input && 50 (userConfig.input.path !== undefined || ··· 53 // @ts-expect-error 54 input = { 55 ...input, 56 - path: 'https://get.heyapi.dev', 57 ...userConfig.input, 58 }; 59 60 - // Handle ReadMe input format transformation when path is specified 61 - if (typeof input.path === 'string' && isReadmeInput(input.path)) { 62 - input.path = transformReadmeInput(input.path); 63 - } 64 - 65 // watch only remote files 66 if (input.watch !== undefined) { 67 input.watch = getWatch(input); ··· 71 ...input, 72 path: userConfig.input as Record<string, unknown>, 73 }; 74 } 75 76 if (
··· 1 import type { Config, UserConfig } from '../types/config'; 2 + import type { Input } from '../types/input'; 3 + import { 4 + heyApiRegistryBaseUrl, 5 + inputToHeyApiPath, 6 + } from '../utils/input/heyApi'; 7 + import { inputToReadmePath } from '../utils/input/readme'; 8 9 const defaultWatch: Config['input']['watch'] = { 10 enabled: false, ··· 44 }; 45 46 if (typeof userConfig.input === 'string') { 47 + input.path = userConfig.input; 48 } else if ( 49 userConfig.input && 50 (userConfig.input.path !== undefined || ··· 53 // @ts-expect-error 54 input = { 55 ...input, 56 + path: heyApiRegistryBaseUrl, 57 ...userConfig.input, 58 }; 59 60 // watch only remote files 61 if (input.watch !== undefined) { 62 input.watch = getWatch(input); ··· 66 ...input, 67 path: userConfig.input as Record<string, unknown>, 68 }; 69 + } 70 + 71 + if (typeof input.path === 'string') { 72 + if (input.path.startsWith('readme:')) { 73 + input.path = inputToReadmePath(input.path); 74 + } else if (!input.path.startsWith('.')) { 75 + if (input.path.startsWith(heyApiRegistryBaseUrl)) { 76 + input.path = input.path.slice(heyApiRegistryBaseUrl.length + 1); 77 + input.path = inputToHeyApiPath(input as Input & { path: string }); 78 + } else { 79 + const parts = input.path.split('/'); 80 + const cleanParts = parts.filter(Boolean); 81 + if (parts.length === 2 && cleanParts.length === 2) { 82 + input.path = inputToHeyApiPath(input as Input & { path: string }); 83 + } 84 + } 85 + } 86 } 87 88 if (
+6 -5
packages/openapi-ts/src/createClient.ts
··· 14 import type { WatchValues } from './types/types'; 15 import { isLegacyClient, legacyNameFromConfig } from './utils/config'; 16 import type { Templates } from './utils/handlebars'; 17 import type { Logger } from './utils/logger'; 18 import { postProcessClient } from './utils/postprocess'; 19 20 - const isPlatformPath = (path: string) => 21 - path.startsWith('https://get.heyapi.dev'); 22 // || path.startsWith('http://localhost:4000') 23 24 export const compileInputPath = (input: Omit<Config['input'], 'watch'>) => { ··· 38 39 if ( 40 input.path && 41 - (typeof input.path !== 'string' || !isPlatformPath(input.path)) 42 ) { 43 result.path = input.path; 44 return result; ··· 134 const baseString = colors.cyan('Generating from'); 135 136 if (typeof inputPath.path === 'string') { 137 - const baseInput = isPlatformPath(inputPath.path) 138 ? `${inputPath.organization ?? ''}/${inputPath.project ?? ''}` 139 : inputPath.path; 140 console.log(`⏳ ${baseString} ${baseInput}`); 141 - if (isPlatformPath(inputPath.path)) { 142 if (inputPath.branch) { 143 console.log( 144 `${colors.gray('branch:')} ${colors.green(inputPath.branch)}`,
··· 14 import type { WatchValues } from './types/types'; 15 import { isLegacyClient, legacyNameFromConfig } from './utils/config'; 16 import type { Templates } from './utils/handlebars'; 17 + import { heyApiRegistryBaseUrl } from './utils/input/heyApi'; 18 import type { Logger } from './utils/logger'; 19 import { postProcessClient } from './utils/postprocess'; 20 21 + const isHeyApiRegistryPath = (path: string) => 22 + path.startsWith(heyApiRegistryBaseUrl); 23 // || path.startsWith('http://localhost:4000') 24 25 export const compileInputPath = (input: Omit<Config['input'], 'watch'>) => { ··· 39 40 if ( 41 input.path && 42 + (typeof input.path !== 'string' || !isHeyApiRegistryPath(input.path)) 43 ) { 44 result.path = input.path; 45 return result; ··· 135 const baseString = colors.cyan('Generating from'); 136 137 if (typeof inputPath.path === 'string') { 138 + const baseInput = isHeyApiRegistryPath(inputPath.path) 139 ? `${inputPath.organization ?? ''}/${inputPath.project ?? ''}` 140 : inputPath.path; 141 console.log(`⏳ ${baseString} ${baseInput}`); 142 + if (isHeyApiRegistryPath(inputPath.path)) { 143 if (inputPath.branch) { 144 console.log( 145 `${colors.gray('branch:')} ${colors.green(inputPath.branch)}`,
+5 -4
packages/openapi-ts/src/types/config.d.ts
··· 18 */ 19 dryRun?: boolean; 20 /** 21 - * Path to the OpenAPI specification. This can be either: 22 - * - local file 23 - * - remote path 24 - * - ReadMe API Registry UUID (full and simplified formats) 25 * 26 * Both JSON and YAML file formats are supported. You can also pass the parsed 27 * object directly if you're fetching the file yourself. ··· 30 */ 31 input: 32 | `https://get.heyapi.dev/${string}/${string}` 33 | `readme:@${string}/${string}#${string}` 34 | `readme:${string}` 35 | (string & {})
··· 18 */ 19 dryRun?: boolean; 20 /** 21 + * Path to the OpenAPI specification. This can be: 22 + * - path 23 + * - URL 24 + * - API registry shorthand 25 * 26 * Both JSON and YAML file formats are supported. You can also pass the parsed 27 * object directly if you're fetching the file yourself. ··· 30 */ 31 input: 32 | `https://get.heyapi.dev/${string}/${string}` 33 + | `${string}/${string}` 34 | `readme:@${string}/${string}#${string}` 35 | `readme:${string}` 36 | (string & {})
+5 -4
packages/openapi-ts/src/types/input.d.ts
··· 36 */ 37 organization?: string; 38 /** 39 - * Path to the OpenAPI specification. This can be either: 40 - * - local file 41 - * - remote path 42 - * - ReadMe API Registry UUID (full and simplified formats) 43 * 44 * Both JSON and YAML file formats are supported. You can also pass the parsed 45 * object directly if you're fetching the file yourself. 46 */ 47 path?: 48 | `https://get.heyapi.dev/${string}/${string}` 49 | `readme:@${string}/${string}#${string}` 50 | `readme:${string}` 51 | (string & {})
··· 36 */ 37 organization?: string; 38 /** 39 + * Path to the OpenAPI specification. This can be: 40 + * - path 41 + * - URL 42 + * - API registry shorthand 43 * 44 * Both JSON and YAML file formats are supported. You can also pass the parsed 45 * object directly if you're fetching the file yourself. 46 */ 47 path?: 48 | `https://get.heyapi.dev/${string}/${string}` 49 + | `${string}/${string}` 50 | `readme:@${string}/${string}#${string}` 51 | `readme:${string}` 52 | (string & {})
-199
packages/openapi-ts/src/utils/__tests__/readme.test.ts
··· 1 - import { describe, expect, it } from 'vitest'; 2 - 3 - import { 4 - getReadmeApiUrl, 5 - isReadmeInput, 6 - parseReadmeInput, 7 - type ReadmeInput, 8 - transformReadmeInput, 9 - } from '../readme'; 10 - 11 - describe('readme utils', () => { 12 - describe('isReadmeInput', () => { 13 - it('should return true for valid ReadMe formats', () => { 14 - expect(isReadmeInput('readme:abc123')).toBe(true); 15 - expect(isReadmeInput('readme:@org/project#uuid123')).toBe(true); 16 - expect(isReadmeInput('readme:test-uuid-with-hyphens')).toBe(true); 17 - }); 18 - 19 - it('should return false for non-ReadMe inputs', () => { 20 - expect(isReadmeInput('https://example.com')).toBe(false); 21 - expect(isReadmeInput('./local-file.yaml')).toBe(false); 22 - expect(isReadmeInput('random-string')).toBe(false); 23 - expect(isReadmeInput('')).toBe(false); 24 - expect(isReadmeInput('readme')).toBe(false); 25 - expect(isReadmeInput('readmeabc123')).toBe(false); 26 - }); 27 - 28 - it('should handle non-string inputs', () => { 29 - expect(isReadmeInput(123 as any)).toBe(false); 30 - expect(isReadmeInput(null as any)).toBe(false); 31 - expect(isReadmeInput(undefined as any)).toBe(false); 32 - expect(isReadmeInput({} as any)).toBe(false); 33 - }); 34 - }); 35 - 36 - describe('parseReadmeInput', () => { 37 - it('should parse simple UUID format', () => { 38 - const result = parseReadmeInput('readme:abc123'); 39 - expect(result).toEqual({ uuid: 'abc123' }); 40 - }); 41 - 42 - it('should parse UUID with hyphens', () => { 43 - const result = parseReadmeInput('readme:test-uuid-123'); 44 - expect(result).toEqual({ uuid: 'test-uuid-123' }); 45 - }); 46 - 47 - it('should parse full format with organization and project', () => { 48 - const result = parseReadmeInput('readme:@myorg/myproject#uuid123'); 49 - expect(result).toEqual({ 50 - organization: 'myorg', 51 - project: 'myproject', 52 - uuid: 'uuid123', 53 - }); 54 - }); 55 - 56 - it('should parse organization and project with hyphens', () => { 57 - const result = parseReadmeInput('readme:@my-org/my-project#test-uuid'); 58 - expect(result).toEqual({ 59 - organization: 'my-org', 60 - project: 'my-project', 61 - uuid: 'test-uuid', 62 - }); 63 - }); 64 - 65 - it('should throw error for invalid formats', () => { 66 - expect(() => parseReadmeInput('readme:')).toThrow( 67 - 'Invalid ReadMe input format', 68 - ); 69 - expect(() => parseReadmeInput('readme:@org')).toThrow( 70 - 'Invalid ReadMe input format', 71 - ); 72 - expect(() => parseReadmeInput('readme:@org/project')).toThrow( 73 - 'Invalid ReadMe input format', 74 - ); 75 - expect(() => parseReadmeInput('readme:@org/project#')).toThrow( 76 - 'Invalid ReadMe input format', 77 - ); 78 - expect(() => parseReadmeInput('https://example.com')).toThrow( 79 - 'Invalid ReadMe input format', 80 - ); 81 - }); 82 - 83 - it('should throw error for invalid UUID characters', () => { 84 - expect(() => parseReadmeInput('readme:abc@123')).toThrow( 85 - 'Invalid ReadMe input format', 86 - ); 87 - expect(() => parseReadmeInput('readme:abc/123')).toThrow( 88 - 'Invalid ReadMe input format', 89 - ); 90 - expect(() => parseReadmeInput('readme:abc#123')).toThrow( 91 - 'Invalid ReadMe input format', 92 - ); 93 - expect(() => parseReadmeInput('readme:abc 123')).toThrow( 94 - 'Invalid ReadMe input format', 95 - ); 96 - }); 97 - 98 - it('should handle empty UUID', () => { 99 - expect(() => parseReadmeInput('readme:@org/project#')).toThrow( 100 - 'Invalid ReadMe input format', 101 - ); 102 - }); 103 - }); 104 - 105 - describe('getReadmeApiUrl', () => { 106 - it('should generate correct API URL', () => { 107 - expect(getReadmeApiUrl('abc123')).toBe( 108 - 'https://dash.readme.com/api/v1/api-registry/abc123', 109 - ); 110 - expect(getReadmeApiUrl('test-uuid-with-hyphens')).toBe( 111 - 'https://dash.readme.com/api/v1/api-registry/test-uuid-with-hyphens', 112 - ); 113 - }); 114 - }); 115 - 116 - describe('transformReadmeInput', () => { 117 - it('should transform simple UUID format to API URL', () => { 118 - const result = transformReadmeInput('readme:abc123'); 119 - expect(result).toBe('https://dash.readme.com/api/v1/api-registry/abc123'); 120 - }); 121 - 122 - it('should transform full format to API URL', () => { 123 - const result = transformReadmeInput('readme:@myorg/myproject#uuid123'); 124 - expect(result).toBe( 125 - 'https://dash.readme.com/api/v1/api-registry/uuid123', 126 - ); 127 - }); 128 - 129 - it('should throw error for invalid inputs', () => { 130 - expect(() => transformReadmeInput('invalid')).toThrow( 131 - 'Invalid ReadMe input format', 132 - ); 133 - expect(() => transformReadmeInput('readme:')).toThrow( 134 - 'Invalid ReadMe input format', 135 - ); 136 - }); 137 - }); 138 - 139 - describe('integration scenarios', () => { 140 - const validInputs: Array<{ expected: ReadmeInput; input: string }> = [ 141 - { expected: { uuid: 'simple123' }, input: 'readme:simple123' }, 142 - { 143 - expected: { uuid: 'uuid-with-hyphens' }, 144 - input: 'readme:uuid-with-hyphens', 145 - }, 146 - { expected: { uuid: 'UUID123' }, input: 'readme:UUID123' }, 147 - { 148 - expected: { organization: 'org', project: 'proj', uuid: 'uuid' }, 149 - input: 'readme:@org/proj#uuid', 150 - }, 151 - { 152 - expected: { 153 - organization: 'my-org', 154 - project: 'my-project', 155 - uuid: 'my-uuid', 156 - }, 157 - input: 'readme:@my-org/my-project#my-uuid', 158 - }, 159 - ]; 160 - 161 - it.each(validInputs)( 162 - 'should handle $input correctly', 163 - ({ expected, input }) => { 164 - expect(isReadmeInput(input)).toBe(true); 165 - expect(parseReadmeInput(input)).toEqual(expected); 166 - expect(transformReadmeInput(input)).toBe( 167 - `https://dash.readme.com/api/v1/api-registry/${expected.uuid}`, 168 - ); 169 - }, 170 - ); 171 - 172 - const invalidInputs = [ 173 - 'readme:', 174 - 'readme:@', 175 - 'readme:@org', 176 - 'readme:@org/', 177 - 'readme:@org/proj', 178 - 'readme:@org/proj#', 179 - 'readme:uuid with spaces', 180 - 'readme:uuid@invalid', 181 - 'readme:uuid/invalid', 182 - 'readme:uuid#invalid', 183 - 'https://example.com', 184 - './local-file.yaml', 185 - 'random-string', 186 - '', 187 - ]; 188 - 189 - it.each(invalidInputs)('should reject invalid input: %s', (input) => { 190 - if (isReadmeInput(input)) { 191 - expect(() => parseReadmeInput(input)).toThrow(); 192 - } else { 193 - expect(() => parseReadmeInput(input)).toThrow( 194 - 'Invalid ReadMe input format', 195 - ); 196 - } 197 - }); 198 - }); 199 - });
···
+165
packages/openapi-ts/src/utils/input/__tests__/readme.test.ts
···
··· 1 + import { describe, expect, it } from 'vitest'; 2 + 3 + import { 4 + getRegistryUrl, 5 + inputToReadmePath, 6 + type Parsed, 7 + parseShorthand, 8 + } from '../readme'; 9 + 10 + describe('readme utils', () => { 11 + describe('parseShorthand', () => { 12 + it('should parse simple UUID format', () => { 13 + const result = parseShorthand('abc123'); 14 + expect(result).toEqual({ uuid: 'abc123' }); 15 + }); 16 + 17 + it('should parse UUID with hyphens', () => { 18 + const result = parseShorthand('test-uuid-123'); 19 + expect(result).toEqual({ uuid: 'test-uuid-123' }); 20 + }); 21 + 22 + it('should parse full format with organization and project', () => { 23 + const result = parseShorthand('@myorg/myproject#uuid123'); 24 + expect(result).toEqual({ 25 + organization: 'myorg', 26 + project: 'myproject', 27 + uuid: 'uuid123', 28 + }); 29 + }); 30 + 31 + it('should parse organization and project with hyphens', () => { 32 + const result = parseShorthand('@my-org/my-project#test-uuid'); 33 + expect(result).toEqual({ 34 + organization: 'my-org', 35 + project: 'my-project', 36 + uuid: 'test-uuid', 37 + }); 38 + }); 39 + 40 + it('should throw error for invalid formats', () => { 41 + expect(() => parseShorthand('')).toThrow( 42 + 'Invalid ReadMe shorthand format', 43 + ); 44 + expect(() => parseShorthand('@org')).toThrow( 45 + 'Invalid ReadMe shorthand format', 46 + ); 47 + expect(() => parseShorthand('@org/project')).toThrow( 48 + 'Invalid ReadMe shorthand format', 49 + ); 50 + expect(() => parseShorthand('@org/project#')).toThrow( 51 + 'Invalid ReadMe shorthand format', 52 + ); 53 + expect(() => parseShorthand('https://example.com')).toThrow( 54 + 'Invalid ReadMe shorthand format', 55 + ); 56 + }); 57 + 58 + it('should throw error for invalid UUID characters', () => { 59 + expect(() => parseShorthand('abc@123')).toThrow( 60 + 'Invalid ReadMe shorthand format', 61 + ); 62 + expect(() => parseShorthand('abc/123')).toThrow( 63 + 'Invalid ReadMe shorthand format', 64 + ); 65 + expect(() => parseShorthand('abc#123')).toThrow( 66 + 'Invalid ReadMe shorthand format', 67 + ); 68 + expect(() => parseShorthand('abc 123')).toThrow( 69 + 'Invalid ReadMe shorthand format', 70 + ); 71 + }); 72 + 73 + it('should handle empty UUID', () => { 74 + expect(() => parseShorthand('@org/project#')).toThrow( 75 + 'Invalid ReadMe shorthand format', 76 + ); 77 + }); 78 + }); 79 + 80 + describe('getRegistryUrl', () => { 81 + it('should generate correct URL', () => { 82 + expect(getRegistryUrl('abc123')).toBe( 83 + 'https://dash.readme.com/api/v1/api-registry/abc123', 84 + ); 85 + expect(getRegistryUrl('test-uuid-with-hyphens')).toBe( 86 + 'https://dash.readme.com/api/v1/api-registry/test-uuid-with-hyphens', 87 + ); 88 + }); 89 + }); 90 + 91 + describe('inputToReadmePath', () => { 92 + it('should transform simple UUID format to API URL', () => { 93 + const result = inputToReadmePath('readme:abc123'); 94 + expect(result).toBe('https://dash.readme.com/api/v1/api-registry/abc123'); 95 + }); 96 + 97 + it('should transform full format to API URL', () => { 98 + const result = inputToReadmePath('readme:@myorg/myproject#uuid123'); 99 + expect(result).toBe( 100 + 'https://dash.readme.com/api/v1/api-registry/uuid123', 101 + ); 102 + }); 103 + 104 + it('should throw error for invalid inputs', () => { 105 + expect(() => inputToReadmePath('invalid')).toThrow( 106 + 'Invalid ReadMe shorthand format', 107 + ); 108 + expect(() => inputToReadmePath('')).toThrow( 109 + 'Invalid ReadMe shorthand format', 110 + ); 111 + }); 112 + }); 113 + 114 + describe('integration scenarios', () => { 115 + const validInputs: ReadonlyArray<{ expected: Parsed; input: string }> = [ 116 + { expected: { uuid: 'simple123' }, input: 'simple123' }, 117 + { 118 + expected: { uuid: 'uuid-with-hyphens' }, 119 + input: 'uuid-with-hyphens', 120 + }, 121 + { expected: { uuid: 'UUID123' }, input: 'UUID123' }, 122 + { 123 + expected: { organization: 'org', project: 'proj', uuid: 'uuid' }, 124 + input: '@org/proj#uuid', 125 + }, 126 + { 127 + expected: { 128 + organization: 'my-org', 129 + project: 'my-project', 130 + uuid: 'my-uuid', 131 + }, 132 + input: '@my-org/my-project#my-uuid', 133 + }, 134 + ]; 135 + 136 + it.each(validInputs)( 137 + 'should handle $input correctly', 138 + ({ expected, input }) => { 139 + expect(parseShorthand(input)).toEqual(expected); 140 + expect(inputToReadmePath(`readme:${input}`)).toBe( 141 + `https://dash.readme.com/api/v1/api-registry/${expected.uuid}`, 142 + ); 143 + }, 144 + ); 145 + 146 + const invalidInputs = [ 147 + '', 148 + '@', 149 + '@org', 150 + '@org/', 151 + '@org/proj', 152 + '@org/proj#', 153 + 'uuid with spaces', 154 + 'uuid@invalid', 155 + 'uuid/invalid', 156 + 'uuid#invalid', 157 + 'https://example.com', 158 + './local-file.yaml', 159 + ]; 160 + 161 + it.each(invalidInputs)('should reject invalid input: %s', (input) => { 162 + expect(() => parseShorthand(input)).toThrow(); 163 + }); 164 + }); 165 + });
+95
packages/openapi-ts/src/utils/input/heyApi.ts
···
··· 1 + // Regular expression to match Hey API Registry input formats: 2 + 3 + import type { Input } from '../../types/input'; 4 + 5 + // - {organization}/{project}?{queryParams} 6 + const registryRegExp = /^([\w-]+)\/([\w-]+)(?:\?([\w=&.-]*))?$/; 7 + 8 + export const heyApiRegistryBaseUrl = 'https://get.heyapi.dev'; 9 + 10 + /** 11 + * Generates the Hey API Registry URL for a given UUID. 12 + * 13 + * @param organization - Organization slug 14 + * @param project - Project slug 15 + * @param queryParams - Optional query parameters 16 + * @returns The full API registry URL 17 + */ 18 + export const getRegistryUrl = ( 19 + organization: string, 20 + project: string, 21 + queryParams?: string, 22 + ): string => 23 + `${heyApiRegistryBaseUrl}/${organization}/${project}${queryParams ? `?${queryParams}` : ''}`; 24 + 25 + export interface Parsed { 26 + organization: string; 27 + project: string; 28 + queryParams?: string; 29 + } 30 + 31 + /** 32 + * Parses a Hey API input string and extracts components. 33 + * 34 + * @param input - Hey API configuration input 35 + * @returns Parsed Hey API input components 36 + * @throws Error if the input format is invalid 37 + */ 38 + export const parseShorthand = ( 39 + input: Omit<Input, 'path'> & { 40 + path: string; 41 + }, 42 + ): Parsed => { 43 + let organization = input.organization; 44 + let project = input.project; 45 + let queryParams: string | undefined; 46 + 47 + if (input.path) { 48 + const match = input.path.match(registryRegExp); 49 + 50 + if (!match) { 51 + throw new Error( 52 + `Invalid Hey API shorthand format. Expected "organization/project?queryParams" or "organization/project", received: ${input.path}`, 53 + ); 54 + } 55 + 56 + organization = match[1]; 57 + project = match[2]; 58 + queryParams = match[3]; 59 + } 60 + 61 + if (!organization) { 62 + throw new Error('The Hey API organization cannot be empty.'); 63 + } 64 + 65 + if (!project) { 66 + throw new Error('The Hey API organization cannot be empty.'); 67 + } 68 + 69 + const result: Parsed = { 70 + organization, 71 + project, 72 + queryParams, 73 + }; 74 + 75 + return result; 76 + }; 77 + 78 + /** 79 + * Transforms a Hey API shorthand string to the corresponding API URL. 80 + * 81 + * @param input - Hey API configuration input 82 + * @returns The Hey API Registry URL 83 + */ 84 + export const inputToHeyApiPath = ( 85 + input: Omit<Input, 'path'> & { 86 + path: string; 87 + }, 88 + ): string => { 89 + const parsed = parseShorthand(input); 90 + return getRegistryUrl( 91 + parsed.organization, 92 + parsed.project, 93 + parsed.queryParams, 94 + ); 95 + };
+64
packages/openapi-ts/src/utils/input/readme.ts
···
··· 1 + // Regular expression to match ReadMe API Registry input formats: 2 + // - @{organization}/{project}#{uuid} 3 + // - {uuid} 4 + const registryRegExp = /^(@([\w-]+)\/([\w\-.]+)#)?([\w-]+)$/; 5 + 6 + /** 7 + * Generates the Hey API Registry URL for a given UUID. 8 + * 9 + * @param uuid - The Hey API Registry UUID 10 + * @returns The full API registry URL 11 + */ 12 + export const getRegistryUrl = (uuid: string): string => 13 + `https://dash.readme.com/api/v1/api-registry/${uuid}`; 14 + 15 + export interface Parsed { 16 + organization?: string; 17 + project?: string; 18 + uuid: string; 19 + } 20 + 21 + const namespace = 'readme'; 22 + 23 + /** 24 + * Parses a ReadMe input string and extracts components. 25 + * 26 + * @param shorthand - ReadMe format string (@org/project#uuid or uuid) 27 + * @returns Parsed ReadMe input components 28 + * @throws Error if the input format is invalid 29 + */ 30 + export const parseShorthand = (shorthand: string): Parsed => { 31 + const match = shorthand.match(registryRegExp); 32 + 33 + if (!match) { 34 + throw new Error( 35 + `Invalid ReadMe shorthand format. Expected "${namespace}:@organization/project#uuid" or "${namespace}:uuid", received: ${namespace}:${shorthand}`, 36 + ); 37 + } 38 + 39 + const [, , organization, project, uuid] = match; 40 + 41 + if (!uuid) { 42 + throw new Error('The ReadMe shorthand UUID cannot be empty.'); 43 + } 44 + 45 + const result: Parsed = { 46 + organization, 47 + project, 48 + uuid, 49 + }; 50 + 51 + return result; 52 + }; 53 + 54 + /** 55 + * Transforms a ReadMe shorthand string to the corresponding API URL. 56 + * 57 + * @param input - ReadMe format string 58 + * @returns The ReadMe API Registry URL 59 + */ 60 + export const inputToReadmePath = (input: string): string => { 61 + const shorthand = input.slice(`${namespace}:`.length); 62 + const parsed = parseShorthand(shorthand); 63 + return getRegistryUrl(parsed.uuid); 64 + };
-73
packages/openapi-ts/src/utils/readme.ts
··· 1 - // Regular expression to match ReadMe input formats: 2 - // readme:@organization/project#uuid or readme:uuid 3 - const readmeInputRegExp = /^readme:(?:@([\w-]+)\/([\w-]+)#)?([\w-]+)$/; 4 - 5 - export interface ReadmeInput { 6 - organization?: string; 7 - project?: string; 8 - uuid: string; 9 - } 10 - 11 - /** 12 - * Checks if the input string is a ReadMe format 13 - * @param input - The input string to check 14 - * @returns true if the input matches ReadMe format patterns 15 - */ 16 - export const isReadmeInput = (input: string): boolean => 17 - typeof input === 'string' && input.startsWith('readme:'); 18 - 19 - /** 20 - * Parses a ReadMe input string and extracts components 21 - * @param input - ReadMe format string (readme:@org/project#uuid or readme:uuid) 22 - * @returns Parsed ReadMe input components 23 - * @throws Error if the input format is invalid 24 - */ 25 - export const parseReadmeInput = (input: string): ReadmeInput => { 26 - if (!isReadmeInput(input)) { 27 - throw new Error( 28 - `Invalid ReadMe input format. Expected "readme:@organization/project#uuid" or "readme:uuid", received: ${input}`, 29 - ); 30 - } 31 - 32 - const match = input.match(readmeInputRegExp); 33 - 34 - if (!match) { 35 - throw new Error( 36 - `Invalid ReadMe input format. Expected "readme:@organization/project#uuid" or "readme:uuid", received: ${input}`, 37 - ); 38 - } 39 - 40 - const [, organization, project, uuid] = match; 41 - 42 - // Validate UUID format (basic validation for alphanumeric + hyphens) 43 - if (!uuid || !/^[\w-]+$/.test(uuid)) { 44 - throw new Error(`Invalid UUID format: ${uuid}`); 45 - } 46 - 47 - const result: ReadmeInput = { uuid }; 48 - 49 - if (organization && project) { 50 - result.organization = organization; 51 - result.project = project; 52 - } 53 - 54 - return result; 55 - }; 56 - 57 - /** 58 - * Generates the ReadMe API Registry URL for a given UUID 59 - * @param uuid - The ReadMe API Registry UUID 60 - * @returns The full API URL 61 - */ 62 - export const getReadmeApiUrl = (uuid: string): string => 63 - `https://dash.readme.com/api/v1/api-registry/${uuid}`; 64 - 65 - /** 66 - * Transforms a ReadMe input string to the corresponding API URL 67 - * @param input - ReadMe format string 68 - * @returns The ReadMe API Registry URL 69 - */ 70 - export const transformReadmeInput = (input: string): string => { 71 - const parsed = parseReadmeInput(input); 72 - return getReadmeApiUrl(parsed.uuid); 73 - };
···