Skip to content

Commit

Permalink
Merge branch 'main' into bug/3270-fix-sanitize-with-special-characters
Browse files Browse the repository at this point in the history
  • Loading branch information
char0n authored Oct 17, 2023
2 parents f0ff8dc + 41eb401 commit f0969e6
Show file tree
Hide file tree
Showing 42 changed files with 17,683 additions and 20,148 deletions.
37,692 changes: 17,600 additions & 20,092 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
],
"devDependencies": {
"@babel/cli": "=7.23.0",
"@babel/core": "=7.23.0",
"@babel/plugin-transform-runtime": "=7.22.15",
"@babel/core": "=7.23.2",
"@babel/plugin-transform-runtime": "=7.23.2",
"@babel/preset-env": "=7.23.2",
"@babel/preset-typescript": "=7.23.2",
"@babel/register": "=7.22.15",
Expand Down Expand Up @@ -94,7 +94,7 @@
"sinon": "=16.1.0",
"terser-webpack-plugin": "=5.3.9",
"ts-node": "=10.9.1",
"typescript": "=4.9.5",
"typescript": "=5.2.2",
"webpack": "=5.89.0",
"webpack-cli": "=5.1.4"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-ast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"dependencies": {
"@babel/runtime-corejs3": "^7.20.7",
"@swagger-api/apidom-error": "^0.77.0",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.1.1",
"stampit": "^4.3.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@babel/runtime-corejs3": "^7.20.7",
"@swagger-api/apidom-ast": "^0.77.0",
"@swagger-api/apidom-error": "^0.77.0",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"minim": "~0.23.8",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.1.1",
Expand Down
6 changes: 4 additions & 2 deletions packages/apidom-core/src/traversal/filter.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Pred } from 'ramda';
import { ArraySlice, Element } from 'minim';

import { PredicateVisitor, visit } from './visitor';

// finds all elements matching the predicate
const filter = <T extends Element>(predicate: Pred, element: T): ArraySlice => {
const filter = <T extends Element>(
predicate: (element: any) => boolean,
element: T,
): ArraySlice => {
const visitor = PredicateVisitor({ predicate });

visit(element, visitor);
Expand Down
7 changes: 5 additions & 2 deletions packages/apidom-core/src/traversal/find.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { pathOr, Pred } from 'ramda';
import { pathOr } from 'ramda';
import { Element } from 'minim';

import { PredicateVisitor, BREAK, visit } from './visitor';

// find first element that satisfies the provided predicate
const find = <T extends Element>(predicate: Pred, element: T): T | undefined => {
const find = <T extends Element>(
predicate: (element: any) => boolean,
element: T,
): T | undefined => {
const visitor = PredicateVisitor({ predicate, returnOnTrue: BREAK });

visit(element, visitor);
Expand Down
7 changes: 5 additions & 2 deletions packages/apidom-core/src/traversal/reject.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { complement, Pred } from 'ramda';
import { complement } from 'ramda';
import { ArraySlice, Element } from 'minim';

import filter from './filter';

// complement of filter
const reject = <T extends Element>(predicate: Pred, element: T): ArraySlice => {
const reject = <T extends Element>(
predicate: (element: any) => boolean,
element: T,
): ArraySlice => {
return filter(complement(predicate), element);
};

Expand Down
3 changes: 1 addition & 2 deletions packages/apidom-core/src/traversal/some.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Pred } from 'ramda';
import { isNotUndefined } from 'ramda-adjunct';
import { Element } from 'minim';

import find from './find';

// tests whether at least one element passes the predicate
const some = <T extends Element>(predicate: Pred, element: T): boolean => {
const some = <T extends Element>(predicate: (element: any) => boolean, element: T): boolean => {
return isNotUndefined(find(predicate, element));
};

Expand Down
4 changes: 2 additions & 2 deletions packages/apidom-core/src/traversal/traverse.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import stampit from 'stampit';
import { Element } from 'minim';
import { pathOr, Pred } from 'ramda';
import { pathOr } from 'ramda';
import { isFunction, noop } from 'ramda-adjunct';

import { visit, PredicateVisitor } from './visitor';
Expand All @@ -9,7 +9,7 @@ import { isElement } from '../predicates';
type Callback = <T extends Element>(element: T) => void;
interface TraverseOptions {
callback?: Callback;
predicate?: Pred;
predicate?: (element: any) => boolean;
}

export const CallbackVisitor = stampit(PredicateVisitor, {
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-error/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime-corejs3": "^7.20.7",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-json-pointer-relative/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@swagger-api/apidom-core": "^0.77.0",
"@swagger-api/apidom-error": "^0.77.0",
"@swagger-api/apidom-json-pointer": "^0.77.0",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-json-pointer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@babel/runtime-corejs3": "^7.20.7",
"@swagger-api/apidom-core": "^0.77.0",
"@swagger-api/apidom-error": "^0.77.0",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-ls/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"@swagger-api/apidom-parser-adapter-openapi-yaml-3-1": "^0.77.0",
"@swagger-api/apidom-parser-adapter-yaml-1-2": "^0.77.0",
"@swagger-api/apidom-reference": "^0.77.0",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.1.1",
"vscode-languageserver-protocol": "^3.17.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-ns-api-design-systems/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@swagger-api/apidom-core": "^0.77.0",
"@swagger-api/apidom-error": "^0.77.0",
"@swagger-api/apidom-ns-openapi-3-1": "^0.77.0",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.1.1",
"stampit": "^4.3.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import stampit from 'stampit';
import { pathSatisfies, path, pick, pipe, keys } from 'ramda';
import { pathSatisfies, path, pick } from 'ramda';
import { isFunction, isUndefined } from 'ramda-adjunct';
import { visit, cloneDeep } from '@swagger-api/apidom-core';

Expand All @@ -24,7 +24,11 @@ const SpecificationVisitor = stampit(Visitor, {
},

retrieveFixedFields(specPath) {
return pipe(path(['visitors', ...specPath, 'fixedFields']), keys)(this.specObj);
const fixedFields = path(['visitors', ...specPath, 'fixedFields'], this.specObj);
if (typeof fixedFields === 'object' && fixedFields !== null) {
return Object.keys(fixedFields);
}
return [];
},

retrieveVisitor(specPath) {
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-ns-asyncapi-2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@babel/runtime-corejs3": "^7.20.7",
"@swagger-api/apidom-core": "^0.77.0",
"@swagger-api/apidom-ns-json-schema-draft-7": "^0.77.0",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.1.1",
"stampit": "^4.3.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import stampit from 'stampit';
import { pathSatisfies, path, pick, pipe, keys } from 'ramda';
import { pathSatisfies, path, pick } from 'ramda';
import { isFunction, isUndefined } from 'ramda-adjunct';
import { visit, cloneDeep } from '@swagger-api/apidom-core';

Expand All @@ -24,7 +24,11 @@ const SpecificationVisitor = stampit(Visitor, {
},

retrieveFixedFields(specPath) {
return pipe(path(['visitors', ...specPath, 'fixedFields']), keys)(this.specObj);
const fixedFields = path(['visitors', ...specPath, 'fixedFields'], this.specObj);
if (typeof fixedFields === 'object' && fixedFields !== null) {
return Object.keys(fixedFields);
}
return [];
},

retrieveVisitor(specPath) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import stampit from 'stampit';
import { ifElse, always, Pred } from 'ramda';
import { ifElse, always } from 'ramda';
import { dispatch, stubUndefined } from 'ramda-adjunct';
import { Element, BREAK } from '@swagger-api/apidom-core';

Expand All @@ -12,7 +12,7 @@ const AlternatingVisitor = stampit(SpecificationVisitor, {
methods: {
enter(element: Element) {
const functions = this.alternator.map(
({ predicate, specPath }: { predicate: Pred; specPath: string[] }) =>
({ predicate, specPath }: { predicate: (element: any) => boolean; specPath: string[] }) =>
ifElse(predicate, always(specPath), stubUndefined),
);
const specPath = dispatch(functions)(element);
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-ns-json-schema-draft-4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@babel/runtime-corejs3": "^7.20.7",
"@swagger-api/apidom-ast": "^0.77.0",
"@swagger-api/apidom-core": "^0.77.0",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.1.1",
"stampit": "^4.3.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import stampit from 'stampit';
import { pathSatisfies, path, pick, pipe, keys } from 'ramda';
import { pathSatisfies, path, pick } from 'ramda';
import { isFunction, isUndefined } from 'ramda-adjunct';
import { visit, cloneDeep } from '@swagger-api/apidom-core';

Expand Down Expand Up @@ -27,7 +27,11 @@ const SpecificationVisitor = stampit(Visitor, {
},

retrieveFixedFields(specPath) {
return pipe(path(['visitors', ...specPath, 'fixedFields']), keys)(this.specObj);
const fixedFields = path(['visitors', ...specPath, 'fixedFields'], this.specObj);
if (typeof fixedFields === 'object' && fixedFields !== null) {
return Object.keys(fixedFields);
}
return [];
},

retrieveVisitor(specPath) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import stampit from 'stampit';
import { ifElse, always, Pred } from 'ramda';
import { ifElse, always } from 'ramda';
import { dispatch, stubUndefined } from 'ramda-adjunct';
import { Element, BREAK } from '@swagger-api/apidom-core';

Expand All @@ -12,7 +12,7 @@ const AlternatingVisitor = stampit(SpecificationVisitor, {
methods: {
enter(element: Element) {
const functions = this.alternator.map(
({ predicate, specPath }: { predicate: Pred; specPath: string[] }) =>
({ predicate, specPath }: { predicate: (element: any) => boolean; specPath: string[] }) =>
ifElse(predicate, always(specPath), stubUndefined),
);
const specPath = dispatch(functions)(element);
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-ns-json-schema-draft-6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@swagger-api/apidom-core": "^0.77.0",
"@swagger-api/apidom-error": "^0.77.0",
"@swagger-api/apidom-ns-json-schema-draft-4": "^0.77.0",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.1.1",
"stampit": "^4.3.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-ns-json-schema-draft-7/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@swagger-api/apidom-core": "^0.77.0",
"@swagger-api/apidom-error": "^0.77.0",
"@swagger-api/apidom-ns-json-schema-draft-6": "^0.77.0",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.1.1",
"stampit": "^4.3.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-ns-openapi-2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@swagger-api/apidom-core": "^0.77.0",
"@swagger-api/apidom-error": "^0.77.0",
"@swagger-api/apidom-ns-json-schema-draft-4": "^0.77.0",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.1.1",
"stampit": "^4.3.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import stampit from 'stampit';
import { pathSatisfies, path, pick, pipe, keys } from 'ramda';
import { pathSatisfies, path, pick } from 'ramda';
import { isFunction, isUndefined } from 'ramda-adjunct';
import { visit, cloneDeep } from '@swagger-api/apidom-core';

Expand Down Expand Up @@ -35,7 +35,11 @@ const SpecificationVisitor = stampit(Visitor, {
},

retrieveFixedFields(specPath) {
return pipe(path(['visitors', ...specPath, 'fixedFields']), keys)(this.specObj);
const fixedFields = path(['visitors', ...specPath, 'fixedFields'], this.specObj);
if (typeof fixedFields === 'object' && fixedFields !== null) {
return Object.keys(fixedFields);
}
return [];
},

retrieveVisitor(specPath) {
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-ns-openapi-3-0/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@swagger-api/apidom-core": "^0.77.0",
"@swagger-api/apidom-error": "^0.77.0",
"@swagger-api/apidom-ns-json-schema-draft-4": "^0.77.0",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.1.1",
"stampit": "^4.3.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import stampit from 'stampit';
import { pathSatisfies, path, pick, pipe, keys } from 'ramda';
import { pathSatisfies, path, pick } from 'ramda';
import { isFunction, isUndefined } from 'ramda-adjunct';
import { visit, cloneDeep } from '@swagger-api/apidom-core';

Expand Down Expand Up @@ -35,7 +35,11 @@ const SpecificationVisitor = stampit(Visitor, {
},

retrieveFixedFields(specPath) {
return pipe(path(['visitors', ...specPath, 'fixedFields']), keys)(this.specObj);
const fixedFields = path(['visitors', ...specPath, 'fixedFields'], this.specObj);
if (typeof fixedFields === 'object' && fixedFields !== null) {
return Object.keys(fixedFields);
}
return [];
},

retrieveVisitor(specPath) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import stampit from 'stampit';
import { ifElse, always, Pred } from 'ramda';
import { ifElse, always } from 'ramda';
import { dispatch, stubUndefined } from 'ramda-adjunct';
import { Element, BREAK } from '@swagger-api/apidom-core';

Expand All @@ -12,7 +12,7 @@ const AlternatingVisitor = stampit(SpecificationVisitor, {
methods: {
enter(element: Element) {
const functions = this.alternator.map(
({ predicate, specPath }: { predicate: Pred; specPath: string[] }) =>
({ predicate, specPath }: { predicate: (element: any) => boolean; specPath: string[] }) =>
ifElse(predicate, always(specPath), stubUndefined),
);
const specPath = dispatch(functions)(element);
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-ns-openapi-3-1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@swagger-api/apidom-ast": "^0.77.0",
"@swagger-api/apidom-core": "^0.77.0",
"@swagger-api/apidom-ns-openapi-3-0": "^0.77.0",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.1.1",
"stampit": "^4.3.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/apidom-ns-workflows-1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"dependencies": {
"@babel/runtime-corejs3": "^7.20.7",
"@swagger-api/apidom-core": "*",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.1.1",
"stampit": "^4.3.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@swagger-api/apidom-core": "^0.77.0",
"@swagger-api/apidom-ns-api-design-systems": "^0.77.0",
"@swagger-api/apidom-parser-adapter-json": "^0.77.0",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.0.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@swagger-api/apidom-core": "^0.77.0",
"@swagger-api/apidom-ns-api-design-systems": "^0.77.0",
"@swagger-api/apidom-parser-adapter-yaml-1-2": "^0.77.0",
"@types/ramda": "~0.29.3",
"@types/ramda": "~0.29.6",
"ramda": "~0.29.0",
"ramda-adjunct": "^4.0.0"
},
Expand Down
Loading

0 comments on commit f0969e6

Please sign in to comment.