function generateDocumentation(openAPIPath, docsFolder, options) {
		if (!openAPIPath || !docsFolder) {
			return Promise.reject('OpenAPI or Docs folder not found');
		}

		// Defines paths for directories
		const contentDir = path.resolve(docsFolder, 'content');
		const apiDir = path.resolve(contentDir, 'api');
		const swaggerDir = path.resolve(apiDir, 'swagger');

		// Gets data from a OpenAPI file
		return this.getOpenAPIData({ ...options, file: openAPIPath })
			.then((templateData) => {
				const promises = [];

				// Generates and saves api_reference.md
				const getLanding = this
					.render({
						data: templateData,
						template: '{{>main-landing}}',
						...options
					})
					.then((output) => {
						fs.writeFileSync(path.resolve(contentDir, 'api_reference.md'), output);
					});

				// Generates and saves paths.md
				const getPaths = this.render({ data: templateData, template: '{{>main-only-paths}}', ...options })
					.then((output) => {
						fs.writeFileSync(path.resolve(apiDir, 'paths.md'), output);
					});

				// Generates and saves components.md
				const getComponents = this.render({ data: templateData, template: '{{>main-only-components}}',...options })
					.then((output) => {
						if (output.length > 0) {
							fs.writeFileSync(path.resolve(apiDir, 'components.md'), output);
						}
					});

				promises.push(getLanding, getPaths, getComponents);
				
				return Promise.all(promises).then(() => {
					// Defines sidebars
					const componentsLink = fs.existsSync(path.resolve(apiDir, 'components.md')) ? '\t* [Components](/content/api/components)\n' : '';
					const pathsLink = fs.existsSync(path.resolve(apiDir, 'paths.md')) ? '\t* [Paths](/content/api/paths)\n' : '';
					const tryMeLink = options.tryme ? '\t* [Try Me](/content/api/try)\n' : '';
					const apiSidebar = `<!-- api_open -->\n* [API Reference](/content/api_reference)\n${componentsLink}${pathsLink}${tryMeLink}<!-- api_close -->`;
					
					const sidebar = fs.readFileSync(path.resolve(docsFolder, '_sidebar.md')).toString();
					const sidebarAPIFolder = sidebar.replace(/(<!-- api_open -->(\s|.)*<!-- api_close -->)/gm, apiSidebar);
					const openApiFilename = `${options.filename}.${options.fileExtension}`;

					fs.writeFileSync(path.resolve(apiDir, '_sidebar.md'), sidebarAPIFolder);
					fs.copyFileSync(openAPIPath, path.resolve(docsFolder, 'static', openApiFilename));

					if (options.tryme) {
						const swaggerHtml = templates.compilePartial('{{>swaggerhtml}}', { filename: openApiFilename });
						const tryMD = templates.compilePartial('{{>trymd}}');
						const swaggerCss = fs.readFileSync(path.join(swaggerUIPath, 'swagger-ui.css'));
						const swaggerJS = fs.readFileSync(path.join(swaggerUIPath, 'swagger-ui-bundle.js'));
						fs.writeFileSync(path.join(swaggerDir, 'swagger-ui.css'), swaggerCss);
						fs.writeFileSync(path.join(swaggerDir, 'swagger-ui-bundle.js'), swaggerJS);
						fs.writeFileSync(path.join(swaggerDir, 'swagger.html'), swaggerHtml);
						fs.writeFileSync(path.join(apiDir, 'try.md'), tryMD);
					}
				});
			});
	}
/**
	 * Generates documentation from OpenAPI file
	 *
	 * @param {String} openAPIPath - a path to the OpenAPI file
	 * @param {String} docsFolder - a path to the docs folder
	 * @param {Object} options - options for the OpenAPI generator
	 * @returns {Promise}
	 */
Generates documentation from OpenAPI file
@param {String} openAPIPath - a path to the OpenAPI file
@param {String} docsFolder - a path to the docs folder
@param {Object} options - options for the OpenAPI generator
@returns {Promise}
Generates documentation from OpenAPI file @param { String } openAPIPath - a path to the OpenAPI file @param { String } docsFolder - a path to the docs folder @param { Object } options - options for the OpenAPI generator @returns { Promise }
function generateDocumentation(openAPIPath, docsFolder, options) {
		if (!openAPIPath || !docsFolder) {
			return Promise.reject('OpenAPI or Docs folder not found');
		}
		const contentDir = path.resolve(docsFolder, 'content');
		const apiDir = path.resolve(contentDir, 'api');
		const swaggerDir = path.resolve(apiDir, 'swagger');
		return this.getOpenAPIData({ ...options, file: openAPIPath })
			.then((templateData) => {
				const promises = [];
				const getLanding = this
					.render({
						data: templateData,
						template: '{{>main-landing}}',
						...options
					})
					.then((output) => {
						fs.writeFileSync(path.resolve(contentDir, 'api_reference.md'), output);
					});
				const getPaths = this.render({ data: templateData, template: '{{>main-only-paths}}', ...options })
					.then((output) => {
						fs.writeFileSync(path.resolve(apiDir, 'paths.md'), output);
					});
				const getComponents = this.render({ data: templateData, template: '{{>main-only-components}}',...options })
					.then((output) => {
						if (output.length > 0) {
							fs.writeFileSync(path.resolve(apiDir, 'components.md'), output);
						}
					});
				promises.push(getLanding, getPaths, getComponents);
				return Promise.all(promises).then(() => {
					const componentsLink = fs.existsSync(path.resolve(apiDir, 'components.md')) ? '\t* [Components](/content/api/components)\n' : '';
					const pathsLink = fs.existsSync(path.resolve(apiDir, 'paths.md')) ? '\t* [Paths](/content/api/paths)\n' : '';
					const tryMeLink = options.tryme ? '\t* [Try Me](/content/api/try)\n' : '';
					const apiSidebar = `<!-- api_open -->\n* [API Reference](/content/api_reference)\n${componentsLink}${pathsLink}${tryMeLink}<!-- api_close -->`;
					const sidebar = fs.readFileSync(path.resolve(docsFolder, '_sidebar.md')).toString();
					const sidebarAPIFolder = sidebar.replace(/(<!-- api_open -->(\s|.)*<!-- api_close -->)/gm, apiSidebar);
					const openApiFilename = `${options.filename}.${options.fileExtension}`;
					fs.writeFileSync(path.resolve(apiDir, '_sidebar.md'), sidebarAPIFolder);
					fs.copyFileSync(openAPIPath, path.resolve(docsFolder, 'static', openApiFilename));
					if (options.tryme) {
						const swaggerHtml = templates.compilePartial('{{>swaggerhtml}}', { filename: openApiFilename });
						const tryMD = templates.compilePartial('{{>trymd}}');
						const swaggerCss = fs.readFileSync(path.join(swaggerUIPath, 'swagger-ui.css'));
						const swaggerJS = fs.readFileSync(path.join(swaggerUIPath, 'swagger-ui-bundle.js'));
						fs.writeFileSync(path.join(swaggerDir, 'swagger-ui.css'), swaggerCss);
						fs.writeFileSync(path.join(swaggerDir, 'swagger-ui-bundle.js'), swaggerJS);
						fs.writeFileSync(path.join(swaggerDir, 'swagger.html'), swaggerHtml);
						fs.writeFileSync(path.join(apiDir, 'try.md'), tryMD);
					}
				});
			});
	}
function generateDocumentation ( openAPIPath , docsFolder , options ) { if ( ! openAPIPath || ! docsFolder ) { return Promise . reject ( 'OpenAPI or Docs folder not found' ) ; } const contentDir = path . resolve ( docsFolder , 'content' ) ; const apiDir = path . resolve ( contentDir , 'api' ) ; const swaggerDir = path . resolve ( apiDir , 'swagger' ) ; return this . getOpenAPIData ( { ... options , file : openAPIPath } ) . then ( ( templateData ) => { const promises = [ ] ; const getLanding = this . render ( { data : templateData , template : '{{>main-landing}}' , ... options } ) . then ( ( output ) => { fs . writeFileSync ( path . resolve ( contentDir , 'api_reference.md' ) , output ) ; } ) ; const getPaths = this . render ( { data : templateData , template : '{{>main-only-paths}}' , ... options } ) . then ( ( output ) => { fs . writeFileSync ( path . resolve ( apiDir , 'paths.md' ) , output ) ; } ) ; const getComponents = this . render ( { data : templateData , template : '{{>main-only-components}}' , ... options } ) . then ( ( output ) => { if ( output . length > 0 ) { fs . writeFileSync ( path . resolve ( apiDir , 'components.md' ) , output ) ; } } ) ; promises . push ( getLanding , getPaths , getComponents ) ; return Promise . all ( promises ) . then ( ( ) => { const componentsLink = fs . existsSync ( path . resolve ( apiDir , 'components.md' ) ) ? '\t* [Components](/content/api/components)\n' : '' ; const pathsLink = fs . existsSync ( path . resolve ( apiDir , 'paths.md' ) ) ? '\t* [Paths](/content/api/paths)\n' : '' ; const tryMeLink = options . tryme ? '\t* [Try Me](/content/api/try)\n' : '' ; const apiSidebar = ` \n \n ${ componentsLink } ${ pathsLink } ${ tryMeLink } ` ; const sidebar = fs . readFileSync ( path . resolve ( docsFolder , '_sidebar.md' ) ) . toString ( ) ; const sidebarAPIFolder = sidebar . replace ( / (<!-- api_open -->(\s|.)*<!-- api_close -->) / gm , apiSidebar ) ; const openApiFilename = ` ${ options . filename } ${ options . fileExtension } ` ; fs . writeFileSync ( path . resolve ( apiDir , '_sidebar.md' ) , sidebarAPIFolder ) ; fs . copyFileSync ( openAPIPath , path . resolve ( docsFolder , 'static' , openApiFilename ) ) ; if ( options . tryme ) { const swaggerHtml = templates . compilePartial ( '{{>swaggerhtml}}' , { filename : openApiFilename } ) ; const tryMD = templates . compilePartial ( '{{>trymd}}' ) ; const swaggerCss = fs . readFileSync ( path . join ( swaggerUIPath , 'swagger-ui.css' ) ) ; const swaggerJS = fs . readFileSync ( path . join ( swaggerUIPath , 'swagger-ui-bundle.js' ) ) ; fs . writeFileSync ( path . join ( swaggerDir , 'swagger-ui.css' ) , swaggerCss ) ; fs . writeFileSync ( path . join ( swaggerDir , 'swagger-ui-bundle.js' ) , swaggerJS ) ; fs . writeFileSync ( path . join ( swaggerDir , 'swagger.html' ) , swaggerHtml ) ; fs . writeFileSync ( path . join ( apiDir , 'try.md' ) , tryMD ) ; } } ) ; } ) ; }
Generates documentation from OpenAPI file
 @param {String} openAPIPath - a path to the OpenAPI file
 @param {String} docsFolder - a path to the docs folder
 @param {Object} options - options for the OpenAPI generator
 @returns {Promise}
Generates documentation from OpenAPI file @param { String } openAPIPath - a path to the OpenAPI file @param { String } docsFolder - a path to the docs folder @param { Object } options - options for the OpenAPI generator @returns { Promise }
// Defines paths for directories // Gets data from a OpenAPI file // Generates and saves api_reference.md // Generates and saves paths.md // Generates and saves components.md // Defines sidebars