Skip to main content

Input

target

Type: String.

Valid values: path or link to the specification.

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

validation

Type: Boolean | Object

Default value: false.

To enforce the quality of your OpenAPI specification, Orval supports validating specifications with the OpenAPI linter from IBM.

Specifying true will by default use the IBM Cloud Validation Ruleset. Specifying an Object will use the provided ruleset instead. Learn more about creating rulesets here.

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

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.

module.exports = {
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.

module.exports = {
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/.

module.exports = {
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/.

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

converterOptions

Type: Object.

Default Value: {}.

Orval converts Swagger 2.0 definitions into OpenAPI 3.0.x using swagger2openapi. Use the converterOptions property to provide custom config for that. See the available options here.

Example:

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

parserOptions

Type: Object.

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

Orval utilizes a parser to process multiple file specifications. This behavior can be customized using the parserOptions property. See the available options for configuration. By default, Orval includes a GitHub parser, but you can add your own for private specifications or other specific needs.

The specification is automatically validated by default.

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