Skip to content

Commit 01b43a2

Browse files
committed
chore: rename function
1 parent 57371fe commit 01b43a2

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

packages/core/src/__tests__/bundle-oas.test.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import outdent from 'outdent';
22
import * as path from 'node:path';
33
import { fileURLToPath } from 'node:url';
4-
import { bundleOas, loadConfig } from '../bundle/bundle-oas.js';
4+
import { bundleOas, createEmptyRedoclyConfig } from '../bundle/bundle-oas.js';
55
import { parseYamlToDocument, yamlSerializer } from '../../__tests__/utils.js';
6-
import { createConfig } from '../config/index.js';
76
import { BaseResolver } from '../resolve.js';
87

98
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -44,7 +43,7 @@ describe('bundle-oas', () => {
4443

4544
it('should bundle external refs', async () => {
4645
const { bundle: res, problems } = await bundleOas({
47-
config: await createConfig({}),
46+
config: await createEmptyRedoclyConfig({}),
4847
ref: path.join(__dirname, 'fixtures/refs/openapi-with-external-refs.yaml'),
4948
});
5049
expect(problems).toHaveLength(0);
@@ -53,7 +52,7 @@ describe('bundle-oas', () => {
5352

5453
it('should bundle external refs and warn for conflicting names', async () => {
5554
const { bundle: res, problems } = await bundleOas({
56-
config: await createConfig({}),
55+
config: await createEmptyRedoclyConfig({}),
5756
ref: path.join(__dirname, 'fixtures/refs/openapi-with-external-refs-conflicting-names.yaml'),
5857
});
5958
expect(problems).toHaveLength(1);
@@ -65,7 +64,7 @@ describe('bundle-oas', () => {
6564

6665
it('should place referenced schema inline when referenced schema name resolves to original schema name', async () => {
6766
const { bundle: res, problems } = await bundleOas({
68-
config: await createConfig({}),
67+
config: await createEmptyRedoclyConfig({}),
6968
ref: path.join(__dirname, 'fixtures/refs/externalref.yaml'),
7069
});
7170

@@ -75,7 +74,7 @@ describe('bundle-oas', () => {
7574

7675
it('should not place referenced schema inline when component in question is not of type "schemas"', async () => {
7776
const { bundle: res, problems } = await bundleOas({
78-
config: await createConfig({}),
77+
config: await createEmptyRedoclyConfig({}),
7978
ref: path.join(__dirname, 'fixtures/refs/external-request-body.yaml'),
8079
});
8180

@@ -85,7 +84,7 @@ describe('bundle-oas', () => {
8584

8685
it('should pull hosted schema', async () => {
8786
const { bundle: res, problems } = await bundleOas({
88-
config: await createConfig({}),
87+
config: await createEmptyRedoclyConfig({}),
8988
externalRefResolver: new BaseResolver({
9089
http: {
9190
customFetch: fetchMock,
@@ -104,7 +103,7 @@ describe('bundle-oas', () => {
104103

105104
it('should not bundle url refs if used with keepUrlRefs', async () => {
106105
const { bundle: res, problems } = await bundleOas({
107-
config: await createConfig({}),
106+
config: await createEmptyRedoclyConfig({}),
108107
externalRefResolver: new BaseResolver({
109108
http: {
110109
customFetch: fetchMock,
@@ -119,7 +118,7 @@ describe('bundle-oas', () => {
119118
});
120119

121120
it('should throw an error when there is no document to bundle', async () => {
122-
const config = await createConfig({});
121+
const config = await createEmptyRedoclyConfig({});
123122
const wrapper = () =>
124123
bundleOas({
125124
config,
@@ -133,7 +132,9 @@ describe('bundle-oas', () => {
133132
bundle: { parsed },
134133
problems,
135134
} = await bundleOas({
136-
config: await loadConfig({ configPath: path.join(__dirname, 'fixtures/redocly.yaml') }),
135+
config: await createEmptyRedoclyConfig({
136+
configPath: path.join(__dirname, 'fixtures/redocly.yaml'),
137+
}),
137138
doc: testDocument,
138139
});
139140

@@ -145,7 +146,7 @@ describe('bundle-oas', () => {
145146

146147
it('should bundle schemas with properties named $ref and externalValues correctly', async () => {
147148
const { bundle: res, problems } = await bundleOas({
148-
config: await createConfig({}),
149+
config: await createEmptyRedoclyConfig({}),
149150
ref: path.join(__dirname, 'fixtures/refs/openapi-with-special-names-in-props.yaml'),
150151
});
151152
expect(problems).toHaveLength(0);
@@ -154,15 +155,15 @@ describe('bundle-oas', () => {
154155

155156
it('should normalize self-file explicit $ref in oas2', async () => {
156157
const { bundle: res, problems } = await bundleOas({
157-
config: await createConfig({}),
158+
config: await createEmptyRedoclyConfig({}),
158159
ref: path.join(__dirname, 'fixtures/self-file-refs/oas2.yaml'),
159160
});
160161
expect(problems).toHaveLength(0);
161162
expect(res.parsed).toMatchSnapshot();
162163
});
163164

164165
it('should normalize self-file explicit $ref in nested referenced file', async () => {
165-
const config = await createConfig({});
166+
const config = await createEmptyRedoclyConfig({});
166167

167168
const { bundle: res, problems } = await bundleOas({
168169
config,

packages/core/src/bundle/bundle-oas.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { Config } from '../config/config.js';
1010

1111
import type { NodeType } from '../types/index.js';
1212
import type { Document } from '../resolve.js';
13-
import type { CollectFn } from '../utils/types.js';
1413

1514
export type CoreBundleOptions = {
1615
externalRefResolver?: BaseResolver;
@@ -25,7 +24,6 @@ export async function bundleOas(
2524
opts: {
2625
ref?: string;
2726
doc?: Document;
28-
collectSpecData?: CollectFn;
2927
} & CoreBundleOptions
3028
) {
3129
const {
@@ -44,7 +42,6 @@ export async function bundleOas(
4442
if (document instanceof Error) {
4543
throw document;
4644
}
47-
opts.collectSpecData?.(document.parsed);
4845

4946
const version = detectSpec(document.parsed);
5047

@@ -74,7 +71,7 @@ export async function bundleOas(
7471
});
7572
}
7673

77-
export function loadConfig(
74+
export function createEmptyRedoclyConfig(
7875
options: {
7976
configPath?: string;
8077
customExtends?: string[];

0 commit comments

Comments
 (0)