docs-v2/api-docs/plugins/decorators/set-servers-url.js

22 lines
513 B
JavaScript

module.exports = SetServersURL;
/** @type {import('@redocly/openapi-cli').OasDecorator} */
/**
* Returns an object with keys in [node type, any, ref].
* The key instructs openapi when to invoke the key's Visitor object.
* Object key "Server" is an OAS 3.0 node type.
*/
function SetServersURL() {
return {
Operation: {
leave(operation, ctx) {
const operations = ['GetRoutes']
if(operations.includes(operation.operationId)) {
operation.servers = [{url: '/'}];
}
}
}
}
};