Cody2333 / koa-swagger-decorator

using decorator to automatically generate swagger doc for koa-router
349 stars 81 forks source link

Allow functions within the parseSimpleConfig #154

Closed eastcoastcoder closed 2 years ago

eastcoastcoder commented 2 years ago

This allows hooks into the onComplete function which could facilitate other methods such as ui.initOAuth() By allowing functions you can add additional properties to the display config and access them like so:

swaggerConfiguration: {
  oauth2ClientId: config.clientId,
  oauth2ClientSecret: config.clientSecret,
  onComplete: function() {
    const { oauth2ClientId, oauth2ClientSecret } = ui.getConfigs();
    ui.initOAuth({
      clientId: oauth2ClientId,
      clientSecret: oauth2ClientSecret,
    });
  }
}