Skip to content

Commit

Permalink
feat: integrate [email protected] (#3173)
Browse files Browse the repository at this point in the history
  • Loading branch information
char0n authored Oct 3, 2023
1 parent 12a5a01 commit 84fe9c8
Show file tree
Hide file tree
Showing 11 changed files with 285 additions and 254 deletions.
2 changes: 1 addition & 1 deletion config/jest/jest.unit.coverage.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
collectCoverageFrom: ['src/**/*.js'],
coverageThreshold: {
'./src/': {
branches: 84,
branches: 83,
functions: 91,
lines: 89,
statements: 88,
Expand Down
112 changes: 56 additions & 56 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
"lint": "eslint src/ test/",
"lint:fix": "npm run lint -- --fix",
"link:apidom": "npm link @swagger-api/apidom-core @swagger-api/apidom-reference @swagger-api/apidom-ns-openapi-3-1 @swagger-api/apidom-ns-openapi-3-0 @swagger-api/apidom-ns-json-schema-draft-4 @swagger-api/apidom-json-pointer",
"link:apidom": "npm link @swagger-api/apidom-core @swagger-api/apidom-error @swagger-api/apidom-reference @swagger-api/apidom-ns-openapi-3-1 @swagger-api/apidom-ns-openapi-3-0 @swagger-api/apidom-ns-json-schema-draft-4 @swagger-api/apidom-json-pointer",
"test": "run-s test:unit:coverage test:artifact",
"test:unit": "cross-env BABEL_ENV=commonjs jest --runInBand --config ./config/jest/jest.unit.config.js",
"test:unit:coverage": "cross-env BABEL_ENV=commonjs jest --runInBand --config ./config/jest/jest.unit.coverage.config.js",
Expand Down Expand Up @@ -109,10 +109,10 @@
},
"dependencies": {
"@babel/runtime-corejs3": "^7.22.15",
"@swagger-api/apidom-core": ">=0.76.2 <1.0.0",
"@swagger-api/apidom-json-pointer": ">=0.76.2 <1.0.0",
"@swagger-api/apidom-ns-openapi-3-1": ">=0.76.2 <1.0.0",
"@swagger-api/apidom-reference": ">=0.76.2 <1.0.0",
"@swagger-api/apidom-core": ">=0.77.0 <1.0.0",
"@swagger-api/apidom-json-pointer": ">=0.77.0 <1.0.0",
"@swagger-api/apidom-ns-openapi-3-1": ">=0.77.0 <1.0.0",
"@swagger-api/apidom-reference": ">=0.77.0 <1.0.0",
"cookie": "~0.5.0",
"deepmerge": "~4.3.0",
"fast-json-patch": "^3.0.0-1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isMemberElement, isArrayElement } from '@swagger-api/apidom-core';
import { isMemberElement, isArrayElement, toValue } from '@swagger-api/apidom-core';

const trimParseResult = (elementPath) => elementPath.slice(2);

Expand All @@ -13,7 +13,7 @@ const toPath = (elementPath) => {

return elementPathSanitized.reduce((path, element, index) => {
if (isMemberElement(element)) {
const token = String(element.key.toValue());
const token = String(toValue(element.key));
path.push(token);
} else if (isArrayElement(elementPathSanitized[index - 2])) {
const token = elementPathSanitized[index - 2].content.indexOf(element);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isArrayElement, deepmerge } from '@swagger-api/apidom-core';
import { isArrayElement, deepmerge, cloneDeep, toValue } from '@swagger-api/apidom-core';
import { isSchemaElement, SchemaElement } from '@swagger-api/apidom-ns-openapi-3-1';

import compose from '../utils/compose.js';
Expand Down Expand Up @@ -27,11 +27,9 @@ const AllOfVisitor = compose({
// remove allOf keyword if empty
if (schemaElement.allOf.isEmpty) {
return new SchemaElement(
schemaElement.content.filter(
(memberElement) => memberElement.key.toValue() !== 'allOf'
),
schemaElement.meta.clone(),
schemaElement.attributes.clone()
schemaElement.content.filter((memberElement) => toValue(memberElement.key) !== 'allOf'),
cloneDeep(schemaElement.meta),
cloneDeep(schemaElement.attributes)
);
}

Expand Down
Loading

0 comments on commit 84fe9c8

Please sign in to comment.