Input

target

Type: String.

Valid values: path or link to the specification.

module.exports = {
petstore: {
input: {
target: './petstore.yaml',
},
},
};

validation

Type: Boolean.

Default Value: false.

To enforce the best quality as possible of specification, we have integrated the amazing OpenAPI linter from IBM. We strongly encourage you to setup your custom rules with a .validaterc file, you can find all useful information about this configuration here.

module.exports = {
petstore: {
input: {
validation: true,
},
},
};

override

Type: Object.

Give you the possibility to override the specification

transformer

Type: String or Function.

Valid values: path or implementation of the transformer function.

This function is executed when you generate and take in argument an OpenAPIObject and should return an OpenAPIObject.

module.exports = {
input: {
override: {
transformer: 'src/api/transformer/add-version.js',
},
},
};

Example of transformer 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.

Combined with tags or schemas, this setting determines whether to include or exclude the specified items. For instance, the example below generates endpoints that do not contain the tag pets.

module.exports = {
petstore: {
input: {
filters: {
mode: 'exclude',
tags: ['pets'],
},
},
},
};

tags

Type: Array of string or RegExp.

Default Value: [].

It is possible to filter on tags. For instance the example below only generates the endpoints that contain the tag pets or matches the regular expression /health/.

module.exports = {
petstore: {
input: {
filters: {
tags: ['pets', /health/],
},
},
},
};

schemas

Type: Array of string or RegExp.

Only schemas names 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/.

module.exports = {
petstore: {
input: {
filters: {
schemas: ['Error', /Cat/],
},
},
},
};

converterOptions

Type: Object.

Default Value: {}.

Orval convert Swagger 2.0 definitions into OpenAPI 3.0.x. You can use the converterOptions property to provide custom config for that. Check here available options.

module.exports = {
petstore: {
input: {
converterOptions: true,
},
},
};

parserOptions

Type: Object.

Default Value: { resolve: { github: githubResolver }, validate: true }.

Orval use a parser to handle multiple files specification. You can use the parserOptions property to provide custom config for that parser. Check here available options. Be default Orval add a github parser but you can add own if you have a private specification or other requirement.

Your specification is automatically validated by default.

module.exports = {
petstore: {
input: {
parserOptions: {
resolve: { gitlab: gitlabResolver },
},
},
},
};
Was this page helpful?

Copyright © 2024 Victor Bury. All Rights Reserved.