You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/pages/reference/integration.mdx
+182-5Lines changed: 182 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,14 +3,191 @@ id: integration
3
3
title: Integration
4
4
---
5
5
6
-
## Import script
6
+
## Programmatic Usage
7
7
8
-
Orval gives you the possibility to import Orval.
8
+
Orval provides a powerful programmatic API that allows you to integrate code generation into your build processes, scripts, or tools.
9
9
10
-
It expose a function which takes a path to the Orval config as the argument.
10
+
### Basic Usage
11
11
12
-
```js
12
+
#### Using the Default Export
13
+
14
+
```typescript
13
15
importorvalfrom'orval';
14
16
15
-
orval('./orval.config.js');
17
+
// Generate using a config file path
18
+
awaitorval('./orval.config.js');
19
+
20
+
// Generate using current directory's orval config
21
+
awaitorval();
22
+
```
23
+
24
+
#### Using the Named Export
25
+
26
+
```typescript
27
+
import { generate } from'orval';
28
+
29
+
// Same functionality as default export
30
+
awaitgenerate('./orval.config.js');
31
+
```
32
+
33
+
### Advanced Usage
34
+
35
+
#### Direct Configuration Object
36
+
37
+
You can pass a configuration object directly instead of using a config file:
38
+
39
+
```typescript
40
+
import { generate, typeOptions } from'orval';
41
+
42
+
const config:Options= {
43
+
input: {
44
+
target: './api-spec.yaml',
45
+
},
46
+
output: {
47
+
target: './src/api.ts',
48
+
client: 'axios',
49
+
},
50
+
};
51
+
52
+
awaitgenerate(config);
53
+
```
54
+
55
+
#### Global Options Override
56
+
57
+
Pass global options to override config file settings. See the complete [GlobalOptions interface](https://github.com/orval-labs/orval/blob/master/packages/core/src/types.ts#L718) for all available options.
0 commit comments