Skip to content

Commit

Permalink
feat(openapi/convert): add title flag
Browse files Browse the repository at this point in the history
  • Loading branch information
kanadgupta committed Nov 19, 2024
1 parent 4280498 commit 7cdd8e6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/commands/openapi/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import chalk from 'chalk';
import prompts from 'prompts';

import BaseCommand from '../../lib/baseCommand.js';
import { workingDirectoryFlag } from '../../lib/flags.js';
import { titleFlag, workingDirectoryFlag } from '../../lib/flags.js';
import { warn } from '../../lib/logger.js';
import prepareOas from '../../lib/prepareOas.js';
import promptTerminal from '../../lib/promptWrapper.js';
Expand All @@ -23,20 +23,24 @@ export default class OpenAPIConvertCommand extends BaseCommand<typeof OpenAPICon

static flags = {
out: Flags.string({ description: 'Output file path to write converted file to' }),
title: titleFlag,
workingDirectory: workingDirectoryFlag,
};

async run() {
const { spec } = this.args;
const { out, workingDirectory } = this.flags;
const { out, title, workingDirectory } = this.flags;

if (workingDirectory) {
const previousWorkingDirectory = process.cwd();
process.chdir(workingDirectory);
this.debug(`switching working directory from ${previousWorkingDirectory} to ${process.cwd()}`);
}

const { preparedSpec, specPath, specType } = await prepareOas(spec, 'openapi:convert', { convertToLatest: true });
const { preparedSpec, specPath, specType } = await prepareOas(spec, 'openapi:convert', {
convertToLatest: true,
title,
});
const parsedPreparedSpec: OASDocument = JSON.parse(preparedSpec);

if (specType === 'OpenAPI') {
Expand Down

0 comments on commit 7cdd8e6

Please sign in to comment.