Skip to content

Commit 1ecab94

Browse files
committed
chore: revert changes
1 parent 09e577e commit 1ecab94

3 files changed

Lines changed: 3 additions & 40 deletions

File tree

packages/cli/src/commands/join/index.ts

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
} from '../../utils/miscellaneous.js';
2828
import type { CommandArgs } from '../../wrapper.js';
2929
import { COMPONENTS } from '../split/constants.js';
30-
import type { JoinArgv, AnyOas3Definition, RootSecurity } from './types.js';
30+
import type { JoinArgv, AnyOas3Definition } from './types.js';
3131
import {
3232
replace$Refs,
3333
getInfoPrefix,
@@ -170,22 +170,6 @@ export async function handleJoin({
170170

171171
addInfoSectionAndSpecVersion(joinedDef, documents, prefixComponentsWithInfoProp);
172172

173-
const rootSecurities: RootSecurity[] = documents.flatMap((document) => {
174-
const openapi = isPlainObject<AnyOas3Definition>(document.parsed)
175-
? document.parsed
176-
: ({} as AnyOas3Definition);
177-
const { paths, security, info } = openapi;
178-
if (!security || (paths && !isEmptyObject(paths))) {
179-
return [];
180-
}
181-
return [
182-
{
183-
security,
184-
componentsPrefix: getInfoPrefix(info, prefixComponentsWithInfoProp, COMPONENTS),
185-
},
186-
];
187-
});
188-
189173
if (serversAreTheSame && first.parsed.servers) {
190174
joinedDef.servers = first.parsed.servers;
191175
}
@@ -200,7 +184,6 @@ export async function handleJoin({
200184
const tagsPrefix = prefixTagsWithFilename
201185
? apiFilename
202186
: getInfoPrefix(info, prefixTagsWithInfoProp, 'tags');
203-
204187
const componentsPrefix = getInfoPrefix(info, prefixComponentsWithInfoProp, COMPONENTS);
205188

206189
if (openapi.hasOwnProperty('x-tagGroups')) {
@@ -220,16 +203,8 @@ export async function handleJoin({
220203
if (tags) {
221204
populateTags({ joinedDef, withoutXTagGroups, context });
222205
}
223-
224206
collectExternalDocs({ joinedDef, openapi, context });
225-
collectPaths({
226-
joinedDef,
227-
withoutXTagGroups,
228-
openapi,
229-
context,
230-
serversAreTheSame,
231-
rootSecurities,
232-
});
207+
collectPaths({ joinedDef, withoutXTagGroups, openapi, context, serversAreTheSame });
233208
collectComponents({ joinedDef, openapi, context });
234209
collectWebhooks({ joinedDef, withoutXTagGroups, openapi, context });
235210
if (componentsPrefix) {

packages/cli/src/commands/join/types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ import type { VerifyConfigOptions } from '../../types.js';
1111

1212
export type AnyOas3Definition = Oas3Definition | Oas3_1Definition | Oas3_2Definition;
1313

14-
export type RootSecurity = {
15-
security: NonNullable<AnyOas3Definition['security']>;
16-
componentsPrefix: string | undefined;
17-
};
18-
1914
export type JoinDocumentContext = {
2015
api: string;
2116
apiFilename: string;

packages/cli/src/commands/join/utils/collect-paths.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import { exitWithError } from '../../../utils/error.js';
1313
import { OPENAPI3_METHOD_NAMES } from '../../split/oas/constants.js';
1414
import { type Oas3Method } from '../../split/types.js';
15-
import type { AnyOas3Definition, JoinDocumentContext, RootSecurity } from '../types.js';
15+
import type { AnyOas3Definition, JoinDocumentContext } from '../types.js';
1616
import { addPrefix } from './add-prefix.js';
1717
import { addSecurityPrefix } from './add-security-prefix.js';
1818
import { formatTags } from './format-tags.js';
@@ -24,14 +24,12 @@ export function collectPaths({
2424
openapi,
2525
context,
2626
serversAreTheSame,
27-
rootSecurities,
2827
}: {
2928
joinedDef: any;
3029
withoutXTagGroups: boolean | undefined;
3130
openapi: AnyOas3Definition;
3231
context: JoinDocumentContext;
3332
serversAreTheSame: boolean;
34-
rootSecurities: RootSecurity[];
3533
}) {
3634
const {
3735
apiFilename,
@@ -228,11 +226,6 @@ export function collectPaths({
228226
pathOperation.security,
229227
componentsPrefix!
230228
);
231-
} else if (rootSecurities.length) {
232-
joinedDef.paths[path][operation].security = rootSecurities.flatMap(
233-
({ security: rootSecurity, componentsPrefix: rootSecurityPrefix }) =>
234-
addSecurityPrefix(rootSecurity, rootSecurityPrefix!) ?? []
235-
);
236229
}
237230
}
238231
}

0 commit comments

Comments
 (0)