What goes over the wire
The generated code asks the client for what the document describes, and reports (never silently changes) what the client cannot do:
| the document says | the client |
|---|---|
a header parameter |
an argument (headers) of the request function, a hook argument and part of the query key; Accept, Content-Type and Authorization are the transport’s, as OpenAPI says. With @mrzr/api-client it is not an argument: headers are the client’s own (createClient({ headers }), or headers in the config of a call) |
a cookie parameter |
reported — a browser attaches cookies itself |
| a query list | repeated keys, a=1&a=2; explode: false and pipeDelimited / spaceDelimited are reported |
| a query object | a[b]=1 (deepObject), as fetch and axios write it; another style is reported. HttpClient takes no object in params |
| a path parameter | encodeURIComponent of the value in its place in the route (a list is a,b) |
a body on DELETE |
sent (data in axios, body in fetch and HttpClient) — except by api-client, whose delete takes none: the operation is left out and listed |
a body on GET |
cannot be sent: left out with a warning |
multipart/form-data |
a FormData you build (api-client also takes a plain object and writes the form itself); the client sets the Content-Type and boundary |
application/x-www-form-urlencoded |
a URLSearchParams (HttpParams for Angular) you build; the client sets the Content-Type |
text/plain, application/octet-stream, other non-JSON bodies |
sent as they are, with that Content-Type |
| a non-JSON answer | the call says responseType: "text" (for text/*) or "blob" (anything else); the client reads it its own way. fetch returns the Response for you to read |
| a JSON answer | the client’s own parsing; nothing is unwrapped or judged by the generated code |
Query values and the writing of an empty or undefined one are the client’s own. A header value that is not text (a number, a flag) is written with String() for fetch and HttpClient, which take text.
A Swagger 2.0 query list is comma separated unless its collectionFormat says otherwise (csv is the default there), so such a list is reported — the client repeats the key — instead of being sent differently without a word. collectionFormat: multi is the repeated form and needs no report.