Skip to content

Commit

Permalink
Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
samchungy committed Apr 23, 2024
1 parent 5ca8de7 commit e9cc932
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,26 @@ pnpm install zod zod-openapi
This mutates Zod to add an extra `.openapi()` method. Call this at the top of your entry point(s). You can achieve this in two differernt ways, depending on your preference.

#### Subpath Import

```ts
import 'zod-openapi/extend';
import { z } from 'zod';

z.string().openapi({ description: 'hello world!', example: 'hello world' });
```
```ts
import 'zod-openapi/extend';
import { z } from 'zod';

z.string().openapi({ description: 'hello world!', example: 'hello world' });
```

#### Manual Extension

This is useful if you have a different instance of Zod from another library that you would like to extend.

```typescript
import { z } from 'another-lib';
import { extendZodWithOpenApi } from 'zod-openapi';
This is useful if you have a different instance of Zod from another library that you would like to extend.

```typescript
import { z } from 'another-lib';
import { extendZodWithOpenApi } from 'zod-openapi';

extendZodWithOpenApi(z);
extendZodWithOpenApi(z);

z.string().openapi({ description: 'hello world!', example: 'hello world' });
```
z.string().openapi({ description: 'hello world!', example: 'hello world' });
```

#### `.openapi()`

Expand Down

0 comments on commit e9cc932

Please sign in to comment.