Skip to content

Commit

Permalink
Fix openAPI path
Browse files Browse the repository at this point in the history
  • Loading branch information
iyobo committed Sep 26, 2023
1 parent d02bf9a commit 754d3bc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/openapi/OpenApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ export function generateOpenApi(metaData: AmalaMetadata, options: AmalaOptions)

controller.paths.forEach(controllerPath => {

const basePath = convertRegexpToSwagger(controllerPath)
const basePath = options.basePath + convertRegexpToSwagger(controllerPath);

for (const endpointName in controller.endpoints) {
// e.g getUsers
const endpoint = controller.endpoints[endpointName];

endpoint.paths.forEach(endpointPath => {

const fullPath = basePath + convertRegexpToSwagger( (endpointPath === '/' ? '' : endpointPath));
const fullPath = basePath + convertRegexpToSwagger((endpointPath === '/' ? '' : endpointPath));
const verb = endpoint.verb;

paths[fullPath] = paths[fullPath] || {};
Expand All @@ -158,17 +158,17 @@ export function generateOpenApi(metaData: AmalaMetadata, options: AmalaOptions)
// register unregistered schemas
if (argumentMeta.argType) registerSchema(argumentMeta.argType);

const injectSource = argumentMeta.ctxKey;
const injectOptions = argumentMeta.ctxValueOptions;
const ctxKey = argumentMeta.ctxKey;
const ctxValueOptions = argumentMeta.ctxValueOptions;
const injectOptionsType = typeof argumentMeta.ctxValueOptions;
let required = false;
const name = injectOptions;
const name = ctxValueOptions;

const argExistsIn = convertInjectSource(argumentMeta.ctxKey);

if (injectOptions && injectOptionsType !== 'string') {
if (ctxValueOptions && injectOptionsType !== 'string') {
// injection object
required = injectOptions.required || false;
required = ctxValueOptions.required || false;
}

// if the argument exists as part of path, consider to be required
Expand Down

0 comments on commit 754d3bc

Please sign in to comment.