Skip to content

Commit b7c1dab

Browse files
committed
fix: improve validation error reporting, add zod validation provider tests
1 parent 370ffad commit b7c1dab

20 files changed

+843
-62
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/lib
22
/docs
3+
tmp

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/node_modules
22
/lib
33
/test/pet-store/petstore-api-client
4+
tmp
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
[api-typescript-generator](../../README.md) / [Modules](../modules.md) / [openapi-client](../modules/openapi_client.md) / CommonHttpClientError
2+
3+
# Class: CommonHttpClientError
4+
5+
[openapi-client](../modules/openapi_client.md).CommonHttpClientError
6+
7+
## Hierarchy
8+
9+
- `Error`
10+
11+
**`CommonHttpClientError`**
12+
13+
## Table of contents
14+
15+
### Constructors
16+
17+
- [constructor](openapi_client.CommonHttpClientError.md#constructor)
18+
19+
### Properties
20+
21+
- [options](openapi_client.CommonHttpClientError.md#options)
22+
- [request](openapi_client.CommonHttpClientError.md#request)
23+
- [response](openapi_client.CommonHttpClientError.md#response)
24+
- [url](openapi_client.CommonHttpClientError.md#url)
25+
26+
## Constructors
27+
28+
### constructor
29+
30+
**new CommonHttpClientError**(`url`, `request`, `response`, `options`, `message`)
31+
32+
#### Parameters
33+
34+
| Name | Type |
35+
| :------ | :------ |
36+
| `url` | `URL` |
37+
| `request` | `undefined` \| [`CommonHttpClientFetchRequest`](../interfaces/openapi_client.CommonHttpClientFetchRequest.md) |
38+
| `response` | `undefined` \| [`CommonHttpClientFetchResponse`](../interfaces/openapi_client.CommonHttpClientFetchResponse.md) |
39+
| `options` | `undefined` \| [`CommonHttpClientOptions`](../interfaces/openapi_client.CommonHttpClientOptions.md) |
40+
| `message` | `string` |
41+
42+
#### Overrides
43+
44+
Error.constructor
45+
46+
## Properties
47+
48+
### options
49+
50+
`Readonly` **options**: `undefined` \| [`CommonHttpClientOptions`](../interfaces/openapi_client.CommonHttpClientOptions.md)
51+
52+
___
53+
54+
### request
55+
56+
`Readonly` **request**: `undefined` \| [`CommonHttpClientFetchRequest`](../interfaces/openapi_client.CommonHttpClientFetchRequest.md)
57+
58+
___
59+
60+
### response
61+
62+
`Readonly` **response**: `undefined` \| [`CommonHttpClientFetchResponse`](../interfaces/openapi_client.CommonHttpClientFetchResponse.md)
63+
64+
___
65+
66+
### url
67+
68+
`Readonly` **url**: `URL`
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
[api-typescript-generator](../../README.md) / [Modules](../modules.md) / [openapi-client](../modules/openapi_client.md) / CommonHttpClientFetchRequest
2+
3+
# Interface: CommonHttpClientFetchRequest
4+
5+
[openapi-client](../modules/openapi_client.md).CommonHttpClientFetchRequest
6+
7+
Request prepared for the fetch function.
8+
9+
## Table of contents
10+
11+
### Properties
12+
13+
- [body](openapi_client.CommonHttpClientFetchRequest.md#body)
14+
- [cache](openapi_client.CommonHttpClientFetchRequest.md#cache)
15+
- [credentials](openapi_client.CommonHttpClientFetchRequest.md#credentials)
16+
- [customRequestProps](openapi_client.CommonHttpClientFetchRequest.md#customrequestprops)
17+
- [headers](openapi_client.CommonHttpClientFetchRequest.md#headers)
18+
- [method](openapi_client.CommonHttpClientFetchRequest.md#method)
19+
- [redirect](openapi_client.CommonHttpClientFetchRequest.md#redirect)
20+
21+
## Properties
22+
23+
### body
24+
25+
`Optional` **body**: `BodyInit`
26+
27+
Request body.
28+
29+
___
30+
31+
### cache
32+
33+
**cache**: ``"default"`` \| ``"force-cache"`` \| ``"no-cache"`` \| ``"no-store"`` \| ``"only-if-cached"`` \| ``"reload"``
34+
35+
Cache mode.
36+
37+
___
38+
39+
### credentials
40+
41+
**credentials**: ``"include"`` \| ``"omit"`` \| ``"same-origin"``
42+
43+
Credentials mode.
44+
45+
___
46+
47+
### customRequestProps
48+
49+
`Optional` **customRequestProps**: `Record`\<`string`, `unknown`\>
50+
51+
Custom request properties. Can be used to pass metadata to the fetch function.
52+
53+
___
54+
55+
### headers
56+
57+
**headers**: [`CommonHttpClientFetchRequestHeaders`](openapi_client.CommonHttpClientFetchRequestHeaders.md)
58+
59+
Request headers.
60+
61+
___
62+
63+
### method
64+
65+
**method**: ``"GET"`` \| ``"HEAD"`` \| ``"POST"`` \| ``"PUT"`` \| ``"DELETE"`` \| ``"CONNECT"`` \| ``"OPTIONS"`` \| ``"PATCH"``
66+
67+
HTTP Method.
68+
69+
___
70+
71+
### redirect
72+
73+
**redirect**: ``"error"`` \| ``"follow"`` \| ``"manual"``
74+
75+
Redirect mode.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[api-typescript-generator](../../README.md) / [Modules](../modules.md) / [openapi-client](../modules/openapi_client.md) / CommonHttpClientFetchRequestHeaders
2+
3+
# Interface: CommonHttpClientFetchRequestHeaders
4+
5+
[openapi-client](../modules/openapi_client.md).CommonHttpClientFetchRequestHeaders
6+
7+
## Indexable
8+
9+
[headerName: `string`]: `string`
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
[api-typescript-generator](../../README.md) / [Modules](../modules.md) / [openapi-client](../modules/openapi_client.md) / CommonHttpClientFetchResponse
2+
3+
# Interface: CommonHttpClientFetchResponse
4+
5+
[openapi-client](../modules/openapi_client.md).CommonHttpClientFetchResponse
6+
7+
Response of the fetch function.
8+
9+
## Table of contents
10+
11+
### Properties
12+
13+
- [body](openapi_client.CommonHttpClientFetchResponse.md#body)
14+
- [customRequestProps](openapi_client.CommonHttpClientFetchResponse.md#customrequestprops)
15+
- [headers](openapi_client.CommonHttpClientFetchResponse.md#headers)
16+
- [ok](openapi_client.CommonHttpClientFetchResponse.md#ok)
17+
- [status](openapi_client.CommonHttpClientFetchResponse.md#status)
18+
- [statusText](openapi_client.CommonHttpClientFetchResponse.md#statustext)
19+
- [url](openapi_client.CommonHttpClientFetchResponse.md#url)
20+
21+
## Properties
22+
23+
### body
24+
25+
**body**: [`CommonHttpClientFetchResponseBody`](../modules/openapi_client.md#commonhttpclientfetchresponsebody)
26+
27+
Response body.
28+
29+
___
30+
31+
### customRequestProps
32+
33+
`Optional` **customRequestProps**: `Record`\<`string`, `unknown`\>
34+
35+
Custom request properties. Can be used to pass metadata outside the fetch function.
36+
37+
___
38+
39+
### headers
40+
41+
**headers**: [`CommonHttpClientResponseHeaders`](../modules/openapi_client.md#commonhttpclientresponseheaders)
42+
43+
Response headers.
44+
45+
___
46+
47+
### ok
48+
49+
**ok**: `boolean`
50+
51+
Whether the request was successful. True for 2xx status codes.
52+
53+
___
54+
55+
### status
56+
57+
**status**: `number`
58+
59+
HTTP status code.
60+
61+
___
62+
63+
### statusText
64+
65+
**statusText**: `string`
66+
67+
HTTP status code explanation.
68+
69+
___
70+
71+
### url
72+
73+
**url**: `string`
74+
75+
The final URL of the request (after redirects).
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
[api-typescript-generator](../../README.md) / [Modules](../modules.md) / [openapi-client](../modules/openapi_client.md) / CommonHttpClientOptions
2+
3+
# Interface: CommonHttpClientOptions
4+
5+
[openapi-client](../modules/openapi_client.md).CommonHttpClientOptions
6+
7+
## Table of contents
8+
9+
### Properties
10+
11+
- [baseUrl](openapi_client.CommonHttpClientOptions.md#baseurl)
12+
- [binaryResponseType](openapi_client.CommonHttpClientOptions.md#binaryresponsetype)
13+
- [errorClass](openapi_client.CommonHttpClientOptions.md#errorclass)
14+
- [fetch](openapi_client.CommonHttpClientOptions.md#fetch)
15+
- [formatHttpErrorMessage](openapi_client.CommonHttpClientOptions.md#formathttperrormessage)
16+
- [headers](openapi_client.CommonHttpClientOptions.md#headers)
17+
- [preprocessFetchResponse](openapi_client.CommonHttpClientOptions.md#preprocessfetchresponse)
18+
- [preprocessRequest](openapi_client.CommonHttpClientOptions.md#preprocessrequest)
19+
20+
## Properties
21+
22+
### baseUrl
23+
24+
**baseUrl**: `string`
25+
26+
___
27+
28+
### binaryResponseType
29+
30+
**binaryResponseType**: ``"blob"`` \| ``"readableStream"``
31+
32+
___
33+
34+
### errorClass
35+
36+
**errorClass**: (`url`: `URL`, `request`: `undefined` \| [`CommonHttpClientFetchRequest`](openapi_client.CommonHttpClientFetchRequest.md), `response`: `undefined` \| [`CommonHttpClientFetchResponse`](openapi_client.CommonHttpClientFetchResponse.md), `options`: `undefined` \| [`CommonHttpClientOptions`](openapi_client.CommonHttpClientOptions.md), `message`: `string`) => `Error`
37+
38+
#### Type declaration
39+
40+
**new errorClass**(`url`, `request`, `response`, `options`, `message`)
41+
42+
##### Parameters
43+
44+
| Name | Type |
45+
| :------ | :------ |
46+
| `url` | `URL` |
47+
| `request` | `undefined` \| [`CommonHttpClientFetchRequest`](openapi_client.CommonHttpClientFetchRequest.md) |
48+
| `response` | `undefined` \| [`CommonHttpClientFetchResponse`](openapi_client.CommonHttpClientFetchResponse.md) |
49+
| `options` | `undefined` \| [`CommonHttpClientOptions`](openapi_client.CommonHttpClientOptions.md) |
50+
| `message` | `string` |
51+
52+
___
53+
54+
### fetch
55+
56+
`Optional` **fetch**: (`url`: `URL`, `request`: [`CommonHttpClientFetchRequest`](openapi_client.CommonHttpClientFetchRequest.md)) => `Promise`\<[`CommonHttpClientFetchResponse`](openapi_client.CommonHttpClientFetchResponse.md)\>
57+
58+
#### Type declaration
59+
60+
▸ (`url`, `request`): `Promise`\<[`CommonHttpClientFetchResponse`](openapi_client.CommonHttpClientFetchResponse.md)\>
61+
62+
##### Parameters
63+
64+
| Name | Type |
65+
| :------ | :------ |
66+
| `url` | `URL` |
67+
| `request` | [`CommonHttpClientFetchRequest`](openapi_client.CommonHttpClientFetchRequest.md) |
68+
69+
##### Returns
70+
71+
`Promise`\<[`CommonHttpClientFetchResponse`](openapi_client.CommonHttpClientFetchResponse.md)\>
72+
73+
___
74+
75+
### formatHttpErrorMessage
76+
77+
`Optional` **formatHttpErrorMessage**: (`response`: [`CommonHttpClientFetchResponse`](openapi_client.CommonHttpClientFetchResponse.md), `request`: [`CommonHttpClientFetchRequest`](openapi_client.CommonHttpClientFetchRequest.md)) => `string`
78+
79+
#### Type declaration
80+
81+
▸ (`response`, `request`): `string`
82+
83+
##### Parameters
84+
85+
| Name | Type |
86+
| :------ | :------ |
87+
| `response` | [`CommonHttpClientFetchResponse`](openapi_client.CommonHttpClientFetchResponse.md) |
88+
| `request` | [`CommonHttpClientFetchRequest`](openapi_client.CommonHttpClientFetchRequest.md) |
89+
90+
##### Returns
91+
92+
`string`
93+
94+
___
95+
96+
### headers
97+
98+
`Optional` **headers**: [`CommonHttpClientRequestHeaders`](openapi_client.CommonHttpClientRequestHeaders.md)
99+
100+
___
101+
102+
### preprocessFetchResponse
103+
104+
`Optional` **preprocessFetchResponse**: (`response`: [`CommonHttpClientFetchResponse`](openapi_client.CommonHttpClientFetchResponse.md), `request`: [`CommonHttpClientFetchRequest`](openapi_client.CommonHttpClientFetchRequest.md)) => `Promise`\<[`CommonHttpClientFetchResponse`](openapi_client.CommonHttpClientFetchResponse.md)\>
105+
106+
#### Type declaration
107+
108+
▸ (`response`, `request`): `Promise`\<[`CommonHttpClientFetchResponse`](openapi_client.CommonHttpClientFetchResponse.md)\>
109+
110+
##### Parameters
111+
112+
| Name | Type |
113+
| :------ | :------ |
114+
| `response` | [`CommonHttpClientFetchResponse`](openapi_client.CommonHttpClientFetchResponse.md) |
115+
| `request` | [`CommonHttpClientFetchRequest`](openapi_client.CommonHttpClientFetchRequest.md) |
116+
117+
##### Returns
118+
119+
`Promise`\<[`CommonHttpClientFetchResponse`](openapi_client.CommonHttpClientFetchResponse.md)\>
120+
121+
___
122+
123+
### preprocessRequest
124+
125+
`Optional` **preprocessRequest**: (`request`: [`CommonHttpClientRequest`](../modules/openapi_client.md#commonhttpclientrequest)) => `Promise`\<[`CommonHttpClientRequest`](../modules/openapi_client.md#commonhttpclientrequest)\>
126+
127+
#### Type declaration
128+
129+
▸ (`request`): `Promise`\<[`CommonHttpClientRequest`](../modules/openapi_client.md#commonhttpclientrequest)\>
130+
131+
##### Parameters
132+
133+
| Name | Type |
134+
| :------ | :------ |
135+
| `request` | [`CommonHttpClientRequest`](../modules/openapi_client.md#commonhttpclientrequest) |
136+
137+
##### Returns
138+
139+
`Promise`\<[`CommonHttpClientRequest`](../modules/openapi_client.md#commonhttpclientrequest)\>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[api-typescript-generator](../../README.md) / [Modules](../modules.md) / [openapi-client](../modules/openapi_client.md) / CommonHttpClientRequestHeaders
2+
3+
# Interface: CommonHttpClientRequestHeaders
4+
5+
[openapi-client](../modules/openapi_client.md).CommonHttpClientRequestHeaders
6+
7+
## Indexable
8+
9+
[headerName: `string`]: `string` \| `undefined` \| ``null``

0 commit comments

Comments
 (0)