Input

target

Type: String.

Valid values: path or link to the specification.

import { defineConfig } from 'orval';
export default defineConfig({
petstore: {
input: {
target: './petstore.yaml',
},
},
});

override

Type: Object.

Allows overriding the specification

transformer

Type: String | Function.

Valid values: path or implementation of a transformer function.

This function is executed when Orval generates clients. The function should accept an argument of the type OpenAPIObject, and should return a transformed OpenAPIObject.

import { defineConfig } from 'orval';
export default defineConfig({
input: {
override: {
transformer: 'src/api/transformer/add-version.js',
},
},
});

An example of a transformer function can be found here

filters

Type: Object.

Default value: {}.

If specified, Orval only generates the endpoints after applying the filter.

mode

Type: String.

Valid values: include, exclude.

Default value: include.

This settings determines whether the provided tags or schemas are excluded or included from the specification. For instance, the example below generates endpoints that do not contain the tag pets.

import { defineConfig } from 'orval';
export default defineConfig({
petstore: {
input: {
filters: {
mode: 'exclude',
tags: ['pets'],
},
},
},
});

tags

Type: (String | RegExp)[].

Default Value: [].

This option allows filtering on tags. For instance ,the example below only generates the endpoints that contain the tag pets or matches the regular expression /health/.

import { defineConfig } from 'orval';
export default defineConfig({
petstore: {
input: {
filters: {
tags: ['pets', /health/],
},
},
},
});

schemas

Type: (String | RegExp)[].

Only schema names that match the specified String or RegExp will be automatically generated. For instance, the example below only generates the schema object that matches string Error or regular expression /Cat/.

import { defineConfig } from 'orval';
export default defineConfig({
petstore: {
input: {
filters: {
schemas: ['Error', /Cat/],
},
},
},
});
Was this page helpful?