Skip to content

Commit 9dbd44a

Browse files
authored
refactor: consolidate export of getConfigsWithDefaultFallback (#476)
1 parent f86b6d0 commit 9dbd44a

File tree

4 files changed

+4
-19
lines changed

4 files changed

+4
-19
lines changed

src/plugins/topbar/actions/convert-oas2-to-oas3/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { postPerformOasConversion } from '../../utils.js';
22
import { getSpecVersion } from '../../../../utils/spec-get-spec-version.js';
3-
import { getConfigsWithDefaultFallback } from './utils.js';
3+
import { getConfigsWithDefaultFallback } from '../utils.js';
44

55
export const convertDefinitionToOas3 = () => async (system) => {
66
const { specSelectors, specActions } = system;

src/plugins/topbar/actions/generator/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import { getGenerator2Definition } from '../../utils.js';
33
import { getFileDownload } from '../../../../utils/common-file-download.js';
44
import { getSpecVersion } from '../../../../utils/spec-get-spec-version.js';
5+
import { getConfigsWithDefaultFallback } from '../utils.js';
56
import {
6-
getConfigsWithDefaultFallback,
77
getSpecVersionString,
88
validateHttpGeneratorsExists,
99
fetchOasGeneratorLists,

src/plugins/topbar/actions/generator/utils.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,8 @@
11
/* eslint-disable camelcase */
22
import { getGeneratorsList, postGenerator3WithSpec } from '../../utils.js';
3+
import { getConfigsWithDefaultFallback } from '../utils.js';
34
import { defaultFixtures } from '../topbar-actions-fixtures.js';
45

5-
// currently re-used
6-
export const getConfigsWithDefaultFallback = (system) => {
7-
let { swagger2GeneratorUrl, oas3GeneratorUrl, swagger2ConverterUrl } = system.getConfigs();
8-
if (!swagger2GeneratorUrl) {
9-
swagger2GeneratorUrl = defaultFixtures.swagger2GeneratorUrl;
10-
}
11-
if (!oas3GeneratorUrl) {
12-
oas3GeneratorUrl = defaultFixtures.oas3GeneratorUrl;
13-
}
14-
if (!swagger2ConverterUrl) {
15-
swagger2ConverterUrl = defaultFixtures.swagger2ConverterUrl;
16-
}
17-
return { swagger2GeneratorUrl, oas3GeneratorUrl, swagger2ConverterUrl };
18-
};
19-
206
export const getSpecVersionString = ({ isOAS3, isSwagger2, isOAS3_1, isAsyncApi2 }) => {
217
// extendable to use additional string constants
228
const specStringConstants = {

src/plugins/topbar/actions/convert-oas2-to-oas3/utils.js renamed to src/plugins/topbar/actions/utils.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { defaultFixtures } from '../topbar-actions-fixtures.js';
1+
import { defaultFixtures } from './topbar-actions-fixtures.js';
22

3-
// currently re-used
43
export const getConfigsWithDefaultFallback = (system) => {
54
let { swagger2GeneratorUrl, oas3GeneratorUrl, swagger2ConverterUrl } = system.getConfigs();
65
if (!swagger2GeneratorUrl) {

0 commit comments

Comments
 (0)