Skip to content

Commit 6e1c10e

Browse files
authored
refactor(specmap): move specmap implementation to resolve module (#3486)
Refs #3386
1 parent 2a5007e commit 6e1c10e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+20
-20
lines changed

config/jest/jest.unit.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
'<rootDir>/node_modules/',
1010
'<rootDir>/test/data/',
1111
'<rootDir>/test/jest.setup.js',
12-
'<rootDir>/test/specmap/data/',
12+
'<rootDir>/test/resolver/specmap/data/',
1313
'<rootDir>/test/build-artifacts/',
1414
'/__fixtures__/',
1515
'/__utils__/',

src/execute/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { url } from '@swagger-api/apidom-reference/configuration/empty';
55
import { DEFAULT_BASE_URL, DEFAULT_OPENAPI_3_SERVER } from '../constants.js';
66
import stockHttp from '../http/index.js';
77
import { serializeRequest } from '../http/serializers/request/index.js';
8-
import createError from '../specmap/lib/create-error.js';
8+
import createError from '../resolver/specmap/lib/create-error.js';
99
import SWAGGER2_PARAMETER_BUILDERS from './swagger2/parameter-builders.js';
1010
import * as OAS3_PARAMETER_BUILDERS from './oas3/parameter-builders.js';
1111
import oas3BuildRequest from './oas3/build-request.js';

src/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/errors/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import createError from '../../../../../../../specmap/lib/create-error.js';
1+
import createError from '../../../../../../specmap/lib/create-error.js';
22

33
// eslint-disable-next-line import/prefer-default-export
44
export const SchemaRefError = createError('SchemaRefError', function cb(message, extra, oriError) {

src/resolver/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/dereference.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import {
4848

4949
import toPath from '../utils/to-path.js';
5050
import getRootCause from '../utils/get-root-cause.js';
51-
import specMapMod from '../../../../../../../specmap/lib/refs.js';
51+
import specMapMod from '../../../../../../specmap/lib/refs.js';
5252
import { SchemaRefError } from '../errors/index.js';
5353

5454
const { wrapError } = specMapMod;

src/specmap/helpers.js src/resolver/specmap/helpers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import traverse from 'traverse';
22
import { url } from '@swagger-api/apidom-reference/configuration/empty';
33

4-
import { DEFAULT_BASE_URL } from '../constants.js';
4+
import { DEFAULT_BASE_URL } from '../../constants.js';
55

66
// This will match if the direct parent's key exactly matches an item.
77
const freelyNamedKeyParents = ['properties'];
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/specmap/lib/refs.js src/resolver/specmap/lib/refs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import jsYaml from 'js-yaml';
22
import { url } from '@swagger-api/apidom-reference/configuration/empty';
33

4-
import '../../helpers/fetch-polyfill.node.js';
4+
import '../../../helpers/fetch-polyfill.node.js';
55
import lib from './index.js';
66
import createError from './create-error.js';
77
import { isFreelyNamed, absolutifyPointer } from '../helpers.js';
8-
import { ACCEPT_HEADER_VALUE_FOR_DOCUMENTS } from '../../constants.js';
8+
import { ACCEPT_HEADER_VALUE_FOR_DOCUMENTS } from '../../../constants.js';
99

1010
const ABSOLUTE_URL_REGEXP = /^([a-z]+:\/\/|\/\/)/i;
1111

src/resolver/strategies/generic/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import resolveGenericStrategy from './resolve.js';
22
import normalize from './normalize.js';
3-
import { plugins } from '../../../specmap/index.js';
3+
import { plugins } from '../../specmap/index.js';
44

55
export function clearCache() {
66
plugins.refs.clearCache();

src/resolver/strategies/generic/resolve.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import mapSpec, { plugins } from '../../../specmap/index.js';
1+
import mapSpec, { plugins } from '../../specmap/index.js';
22
import normalize from './normalize.js';
33
import { makeFetchJSON } from '../../utils/index.js';
44
import * as optionsUtil from '../../utils/options.js';

test/specmap/all-of.js test/resolver/specmap/all-of.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as undici from 'undici';
22

3-
import mapSpec, { plugins } from '../../src/specmap/index.js';
3+
import mapSpec, { plugins } from '../../../src/resolver/specmap/index.js';
44

55
describe('allOf', () => {
66
let mockAgent;

test/specmap/complex.js test/resolver/specmap/complex.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import path from 'node:path';
22
import { globSync } from 'glob';
33

4-
import mapSpec, { plugins } from '../../src/specmap/index.js';
5-
import Swagger from '../../src/index.js';
4+
import mapSpec, { plugins } from '../../../src/resolver/specmap/index.js';
5+
import Swagger from '../../../src/index.js';
66

77
const { refs } = plugins;
88
const { allOf } = plugins;

test/specmap/context-tree.js test/resolver/specmap/context-tree.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ContextTree from '../../src/specmap/lib/context-tree.js';
1+
import ContextTree from '../../../src/resolver/specmap/lib/context-tree.js';
22

33
describe('ContextTree', () => {
44
test('should set and get a deep value', () => {

test/specmap/index.js test/resolver/specmap/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import * as undici from 'undici';
22
import cloneDeep from 'lodash/cloneDeep';
33
import traverse from 'traverse';
44

5-
import mapSpec, { SpecMap, plugins } from '../../src/specmap/index.js';
6-
import lib from '../../src/specmap/lib/index.js';
5+
import mapSpec, { SpecMap, plugins } from '../../../src/resolver/specmap/index.js';
6+
import lib from '../../../src/resolver/specmap/lib/index.js';
77

88
describe('specmap', () => {
99
let testContext;

test/specmap/lib.js test/resolver/specmap/lib.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import lib from '../../src/specmap/lib/index.js';
1+
import lib from '../../../src/resolver/specmap/lib/index.js';
22

33
describe('lib', () => {
44
describe('applyPatch', () => {

test/specmap/live.js test/resolver/specmap/live.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import mapSpec, { plugins } from '../../src/specmap/index.js';
1+
import mapSpec, { plugins } from '../../../src/resolver/specmap/index.js';
22

33
if (process.env.NODE_LIVETESTS === 'true') {
44
describe('Live tests against the internet', () => {

test/specmap/parameters.js test/resolver/specmap/parameters.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import mapSpec, { plugins } from '../../src/specmap/index.js';
1+
import mapSpec, { plugins } from '../../../src/resolver/specmap/index.js';
22

33
describe('parameters', () => {
44
test('should add default value to parameter', () => {

test/specmap/properties.js test/resolver/specmap/properties.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import mapSpec, { plugins } from '../../src/specmap/index.js';
1+
import mapSpec, { plugins } from '../../../src/resolver/specmap/index.js';
22

33
describe('properties', () => {
44
test('should add default value to each property', () => {

test/specmap/refs.js test/resolver/specmap/refs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { globSync } from 'glob';
55
import jsYaml from 'js-yaml';
66
import * as undici from 'undici';
77

8-
import mapSpec, { plugins } from '../../src/specmap/index.js';
8+
import mapSpec, { plugins } from '../../../src/resolver/specmap/index.js';
99

1010
const { refs } = plugins;
1111

0 commit comments

Comments
 (0)