Skip to content

Commit

Permalink
chore(docs): add information about available clients
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanshatford committed Mar 23, 2024
1 parent f83279c commit 3035e80
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [Quick Start](#quick-start)
- [Installation](#installation)
- [Configuration](#configuration)
- [Clients](#clients)
- [Formatting](#formatting)
- [Linting](#linting)
- [Enums](#enums)
Expand Down Expand Up @@ -96,6 +97,17 @@ export default {

Alternatively, you can use `openapi-ts.config.js` and configure the export statement depending on your project setup.

### Clients

We provide a variety of possible clients to use when generating your `openapi-ts` client. The following are available:

- `angular`: An [Angular](https://angular.io/) client using [RxJS](https://rxjs.dev/).
- `axios`: An [Axios](https://axios-http.com/docs/intro) client.
- `fetch`: A [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) client.
> NOTE: The Fetch API is experimental in Node.js 18+ and was stabilized in [Node.js v21](https://nodejs.org/docs/latest-v21.x/api/globals.html#fetch)
- `node`: A [Node.js](https://nodejs.org/) client using [node-fetch](https://www.npmjs.com/package/node-fetch).
- `xhr`: A [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) client.

### Formatting

By default, `openapi-ts` will automatically format your client according to your project configuration. To disable automatic formatting, set `format` to false
Expand Down
1 change: 1 addition & 0 deletions test/bin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ describe('bin', () => {
expect(result.stdout.toString()).toContain('');
expect(result.stderr.toString()).toBe('');
});

it('generates node client', async () => {
const result = sync('node', [
'./bin/index.js',
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/scripts/generateClient.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { createClient } from '../../../';
import type { Config } from '../../../src/types/config';

export const generateClient = async (
dir: string,
version: string,
client: 'fetch' | 'xhr' | 'node' | 'axios' | 'angular',
client: Config['client'],
useOptions: boolean = false,
name?: string
) => {
Expand Down

0 comments on commit 3035e80

Please sign in to comment.