11/**
2- * This module generates a code skeleton for an API using OpenAPI/Swagger .
2+ * This module generates a code skeleton for an API using OpenAPI.
33 * @module codegen
44 */
55
@@ -74,7 +74,7 @@ const generateOperationFile = (config, operation, operation_name) => new Promise
7474 closebrace : '}' ,
7575 operation_name : operation_name . replace ( / [ } { ] / g, '' ) ,
7676 operation,
77- swagger : config . data . swagger
77+ openapi : config . data . openapi
7878 } ) ;
7979
8080 fs . writeFile ( target_file , content , 'utf8' , ( err ) => {
@@ -92,7 +92,7 @@ const generateOperationFile = (config, operation, operation_name) => new Promise
9292 */
9393const generateOperationFiles = config => new Promise ( ( resolve , reject ) => {
9494 const files = { } ;
95- _ . each ( config . data . swagger . paths , ( path , path_name ) => {
95+ _ . each ( config . data . openapi . paths , ( path , path_name ) => {
9696 const operation_name = path . endpointName ;
9797 if ( files [ operation_name ] === undefined ) {
9898 files [ operation_name ] = [ ] ;
@@ -118,7 +118,7 @@ const generateOperationFiles = config => new Promise((resolve, reject) => {
118118 *
119119 * @private
120120 * @param {Object } config Configuration options
121- * @param {Object|String } config.swagger Swagger JSON or a string pointing to a Swagger file.
121+ * @param {Object|String } config.openapi OpenAPI JSON or a string pointing to a OpenAPI file.
122122 * @param {String } config.target_dir Absolute path to the directory where the files will be generated.
123123 * @param {String } config.templates Absolute path to the templates that should be used.
124124 * @return {Promise }
@@ -136,7 +136,7 @@ const generateDirectoryStructure = config => new Promise((resolve, reject) => {
136136 walker . on ( 'file' , async ( root , stats , next ) => {
137137 try {
138138 if ( stats . name . includes ( '$$path$$' ) ) {
139- // this file should be handled for each in swagger .paths
139+ // this file should be handled for each in openapi .paths
140140 await generateOperationFiles ( {
141141 root,
142142 templates_dir,
@@ -269,11 +269,11 @@ const bundle = async (openapi, baseDir) => {
269269} ;
270270
271271/**
272- * Generates a code skeleton for an API given an OpenAPI/Swagger file.
272+ * Generates a code skeleton for an API given an OpenAPI file.
273273 *
274274 * @module codegen.generate
275275 * @param {Object } config Configuration options
276- * @param {Object|String } config.openapi OpenAPI/Swagger JSON or a string pointing to an OpenAPI/Swagger file.
276+ * @param {Object|String } config.openapi OpenAPI JSON or a string pointing to an OpenAPI file.
277277 * @param {String } config.target_dir Path to the directory where the files will be generated.
278278 * @return {Promise }
279279 */
@@ -299,7 +299,6 @@ codegen.generate = config => new Promise((resolve, reject) => {
299299 templates : path . resolve ( __dirname , '../templates' )
300300 } ) ;
301301
302- config . swagger = config . openapi ;
303302 config . templates = `${ config . templates } /${ config . template } ` ;
304303
305304 async function start ( ) {
0 commit comments