Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@scalar/openapi-parser

Package Overview
Dependencies
Maintainers
8
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scalar/openapi-parser - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

dist/src/utils/workThroughQueue.js

11

CHANGELOG.md
# @scalar/openapi-parser
## 0.6.0
### Minor Changes
- 61252ab: refactor!: most functions return an object now
### Patch Changes
- c9dd499: feat: intercept fetch requests
- 61252ab: fix: max call stack exceeded error
## 0.5.0

@@ -4,0 +15,0 @@

4

dist/index.d.ts
export { Validator, jsonSchemaVersions } from './lib/Validator/Validator.js';
export { ResolveReferencesResult, resolveReferences } from './utils/resolveReferences.js';
export { AjvOptions, AnyObject, ErrorObject, Filesystem, FilesystemEntry, ResolveResult, ValidateResult } from './types/index.js';
export { AjvOptions, AnyObject, DereferenceResult, DetailsResult, ErrorObject, Filesystem, FilesystemEntry, FilterResult, LoadResult, UpgradeResult, ValidateResult } from './types/index.js';
export { dereference } from './utils/dereference.js';

@@ -29,2 +29,2 @@ export { details } from './utils/details.js';

export { Action, AnyApiDefinitionFormat, Queue, openapi } from './pipeline.js';
export { OpenAPI, OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from './types/openapi.js';
export { OpenAPI, OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from './types/openapi-types.js';

@@ -1,6 +0,7 @@

import { AnyObject, Filesystem, ErrorObject } from './types/index.js';
import { AnyObject, LoadResult, DereferenceResult, ValidateResult, UpgradeResult, FilterResult, Filesystem, DetailsResult } from './types/index.js';
import { dereference } from './utils/dereference.js';
import { filter } from './utils/filter.js';
import { load, LoadPlugin } from './utils/load/load.js';
import { upgrade } from './utils/upgrade.js';
import { OpenAPI } from './types/openapi.js';
import { validate } from './utils/validate.js';

@@ -11,3 +12,3 @@ /**

type Action = {
action: typeof load | typeof upgrade | typeof filter;
action: typeof load | typeof upgrade | typeof filter | typeof dereference | typeof validate;
options?: AnyObject;

@@ -40,38 +41,32 @@ };

}): {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
filter: (callback: (Specification: AnyObject) => boolean) => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
filter: () => any;
upgrade: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
filter: (callback: (Specification: AnyObject) => boolean) => any;
validate: () => Promise<{
validate: () => {
filter: (callback: (Specification: AnyObject) => boolean) => any;
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
dereference: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;

@@ -84,10 +79,7 @@ filter: (callback: (Specification: AnyObject) => boolean) => any;

toYaml: () => Promise<string>;
valid: boolean;
specification?: OpenAPI.Document<{}>;
version?: string;
errors?: ErrorObject[];
schema?: OpenAPI.Document<{}>;
}>;
};
dereference: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;

@@ -101,13 +93,13 @@ filter: (callback: (Specification: AnyObject) => boolean) => any;

};
validate: () => Promise<{
validate: () => {
filter: (callback: (Specification: AnyObject) => boolean) => any;
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
dereference: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;

@@ -120,10 +112,7 @@ filter: (callback: (Specification: AnyObject) => boolean) => any;

toYaml: () => Promise<string>;
valid: boolean;
specification?: OpenAPI.Document<{}>;
version?: string;
errors?: ErrorObject[];
schema?: OpenAPI.Document<{}>;
}>;
};
dereference: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;

@@ -138,30 +127,26 @@ filter: (callback: (Specification: AnyObject) => boolean) => any;

upgrade: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
filter: (callback: (Specification: AnyObject) => boolean) => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
filter: () => any;
upgrade: () => any;
validate: () => Promise<{
validate: () => {
filter: (callback: (Specification: AnyObject) => boolean) => any;
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
dereference: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;

@@ -174,10 +159,7 @@ filter: (callback: (Specification: AnyObject) => boolean) => any;

toYaml: () => Promise<string>;
valid: boolean;
specification?: OpenAPI.Document<{}>;
version?: string;
errors?: ErrorObject[];
schema?: OpenAPI.Document<{}>;
}>;
};
dereference: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;

@@ -191,16 +173,16 @@ filter: (callback: (Specification: AnyObject) => boolean) => any;

};
validate: () => Promise<{
validate: () => {
filter: (callback: (Specification: AnyObject) => boolean) => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
filter: () => any;
upgrade: () => any;
validate: () => Promise<any>;
validate: () => any;
dereference: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;

@@ -214,23 +196,21 @@ filter: (callback: (Specification: AnyObject) => boolean) => any;

};
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
dereference: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
filter: (callback: (Specification: AnyObject) => boolean) => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
filter: () => any;
upgrade: () => any;
validate: () => Promise<any>;
validate: () => any;
dereference: () => any;

@@ -245,39 +225,27 @@ toJson: () => Promise<string>;

toYaml: () => Promise<string>;
valid: boolean;
specification?: OpenAPI.Document<{}>;
version?: string;
errors?: ErrorObject[];
schema?: OpenAPI.Document<{}>;
}>;
};
dereference: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
filter: (callback: (Specification: AnyObject) => boolean) => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
filter: () => any;
upgrade: () => any;
validate: () => Promise<{
validate: () => {
filter: (callback: (Specification: AnyObject) => boolean) => any;
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
dereference: () => any;
toJson: () => Promise<string>;
toYaml: () => Promise<string>;
valid: boolean;
specification?: OpenAPI.Document<{}>;
version?: string;
errors?: ErrorObject[];
schema?: OpenAPI.Document<{}>;
}>;
};
dereference: () => any;

@@ -293,24 +261,22 @@ toJson: () => Promise<string>;

};
validate: () => Promise<{
validate: () => {
filter: (callback: (Specification: AnyObject) => boolean) => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
filter: () => any;
upgrade: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
filter: (callback: (Specification: AnyObject) => boolean) => any;
validate: () => Promise<any>;
validate: () => any;
dereference: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;

@@ -324,5 +290,7 @@ filter: (callback: (Specification: AnyObject) => boolean) => any;

};
validate: () => Promise<any>;
validate: () => any;
dereference: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;

@@ -336,31 +304,27 @@ filter: (callback: (Specification: AnyObject) => boolean) => any;

};
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
dereference: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
filter: (callback: (Specification: AnyObject) => boolean) => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
filter: () => any;
upgrade: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
filter: (callback: (Specification: AnyObject) => boolean) => any;
validate: () => Promise<any>;
validate: () => any;
dereference: () => any;

@@ -370,3 +334,3 @@ toJson: () => Promise<string>;

};
validate: () => Promise<any>;
validate: () => any;
dereference: () => any;

@@ -381,47 +345,33 @@ toJson: () => Promise<string>;

toYaml: () => Promise<string>;
valid: boolean;
specification?: OpenAPI.Document<{}>;
version?: string;
errors?: ErrorObject[];
schema?: OpenAPI.Document<{}>;
}>;
};
dereference: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
filter: (callback: (Specification: AnyObject) => boolean) => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
filter: () => any;
upgrade: () => {
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
filter: (callback: (Specification: AnyObject) => boolean) => any;
validate: () => Promise<{
validate: () => {
filter: (callback: (Specification: AnyObject) => boolean) => any;
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
dereference: () => any;
toJson: () => Promise<string>;
toYaml: () => Promise<string>;
valid: boolean;
specification?: OpenAPI.Document<{}>;
version?: string;
errors?: ErrorObject[];
schema?: OpenAPI.Document<{}>;
}>;
};
dereference: () => any;

@@ -431,20 +381,13 @@ toJson: () => Promise<string>;

};
validate: () => Promise<{
validate: () => {
filter: (callback: (Specification: AnyObject) => boolean) => any;
get: () => Promise<AnyObject>;
get: () => Promise<Partial<LoadResult & DereferenceResult & ValidateResult & UpgradeResult & FilterResult & {
filesystem: Filesystem;
}>>;
files: () => Promise<Filesystem>;
details: () => Promise<{
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
}>;
details: () => Promise<DetailsResult>;
dereference: () => any;
toJson: () => Promise<string>;
toYaml: () => Promise<string>;
valid: boolean;
specification?: OpenAPI.Document<{}>;
version?: string;
errors?: ErrorObject[];
schema?: OpenAPI.Document<{}>;
}>;
};
dereference: () => any;

@@ -451,0 +394,0 @@ toJson: () => Promise<string>;

@@ -1,2 +0,2 @@

import { makeFilesystem } from './utils/makeFilesystem.js';
import { workThroughQueue } from './utils/workThroughQueue.js';
import { upgrade } from './utils/upgrade.js';

@@ -54,6 +54,7 @@ import { validate } from './utils/validate.js';

}
async function validateAction(queue) {
const filesystem = await workThroughQueue(queue);
function validateAction(queue) {
queue.tasks.push({
action: validate
});
return {
...await validate(filesystem),
filter: (callback) => filterAction(queue, callback),

@@ -98,36 +99,25 @@ get: () => getAction(queue),

async function getAction(queue) {
const filesystem = await workThroughQueue(queue);
return getEntrypoint(filesystem).specification;
const result = await workThroughQueue(queue);
if (result.specification === void 0) {
result.specification = getEntrypoint(result.filesystem).specification;
}
return result;
}
async function filesAction(queue) {
return await workThroughQueue(queue);
const { filesystem } = await workThroughQueue(queue);
return filesystem;
}
async function detailsAction(queue) {
const filesystem = await workThroughQueue(queue);
const { filesystem } = await workThroughQueue(queue);
return details(getEntrypoint(filesystem).specification);
}
async function toJsonAction(queue) {
const filesystem = await workThroughQueue(queue);
const { filesystem } = await workThroughQueue(queue);
return toJson(getEntrypoint(filesystem).specification);
}
async function toYamlAction(queue) {
const filesystem = await workThroughQueue(queue);
const { filesystem } = await workThroughQueue(queue);
return toYaml(getEntrypoint(filesystem).specification);
}
async function workThroughQueue(queue) {
let specification = queue.specification;
for (const { action, options } of queue.tasks) {
if (typeof action !== "function") {
console.warn("[queue] The given action is not a function:", action);
continue;
}
if (action.constructor.name === "AsyncFunction") {
specification = await action(specification, options);
} else {
specification = action(specification, options);
}
}
return makeFilesystem(specification);
}
export { openapi };

@@ -7,7 +7,12 @@ import { getEntrypoint } from './getEntrypoint.js';

const filesystem = makeFilesystem(specification);
return traverse(getEntrypoint(filesystem).specification, (schema) => {
return callback(schema) ? schema : void 0;
});
return {
specification: traverse(
getEntrypoint(filesystem).specification,
(schema) => {
return callback(schema) ? schema : void 0;
}
)
};
}
export { filter };

@@ -8,6 +8,7 @@ import { parse } from 'yaml';

try {
parse(value);
parse(value, {
maxAliasCount: 1e4
});
return true;
} catch (error) {
console.log("ADSAS", error);
return false;

@@ -14,0 +15,0 @@ }

@@ -0,1 +1,2 @@

import { getEntrypoint } from '../getEntrypoint.js';
import { getListOfReferences } from '../getListOfReferences.js';

@@ -7,3 +8,5 @@ import { makeFilesystem } from '../makeFilesystem.js';

if (options?.filesystem && options?.filesystem.find((entry) => entry.filename === value)) {
return options.filesystem;
return {
filesystem: options.filesystem
};
}

@@ -13,3 +16,5 @@ const plugin = options?.plugins?.find((plugin2) => plugin2.check(value));

if (content === void 0) {
return [];
return {
filesystem: []
};
}

@@ -19,8 +24,14 @@ let filesystem = makeFilesystem(content, {

});
const listOfReferences = getListOfReferences(content);
const newEntry = options?.filename ? filesystem.find((entry) => entry.filename === options?.filename) : getEntrypoint(filesystem);
const listOfReferences = newEntry.references ?? getListOfReferences(content);
if (listOfReferences.length === 0) {
return filesystem;
return {
filesystem
};
}
for (const reference of listOfReferences) {
const plugin2 = options?.plugins?.find((plugin3) => plugin3.check(reference));
if (!plugin2) {
continue;
}
const target = plugin2.check(reference) && plugin2.resolvePath ? plugin2.resolvePath(value, reference) : reference;

@@ -30,3 +41,3 @@ if (filesystem.find((entry) => entry.filename === reference)) {

}
const referencedFiles = await load(target, {
const { filesystem: referencedFiles } = await load(target, {
...options,

@@ -47,5 +58,7 @@ // Make the filename the exact same value as the $ref

}
return filesystem;
return {
filesystem
};
}
export { load };

@@ -29,3 +29,3 @@ const fetchUrlsPluginDefaultConfiguration = {

numberOfRequests++;
const response = await fetch(value);
const response = await (configuration?.fetch ? configuration.fetch(value) : fetch(value));
return await response.text();

@@ -32,0 +32,0 @@ } catch (error) {

@@ -12,3 +12,5 @@ import { parse } from 'yaml';

} catch (error) {
return parse(specification);
return parse(specification, {
maxAliasCount: 1e4
});
}

@@ -15,0 +17,0 @@ }

import { getEntrypoint } from './getEntrypoint.js';
import { isFilesystem } from './isFilesystem.js';
import { makeFilesystem } from './makeFilesystem.js';

@@ -9,3 +8,2 @@ import { upgradeFromThreeToThreeOne } from './upgradeFromThreeToThreeOne.js';

const upgraders = [upgradeFromTwoToThree, upgradeFromThreeToThreeOne];
const wasFilesystem = isFilesystem(specification);
const result = upgraders.reduce(

@@ -15,5 +13,9 @@ (specification2, upgrader) => upgrader(specification2),

);
return wasFilesystem ? makeFilesystem(result) : result;
return {
specification: result,
// TODO: Make dynamic
version: "3.1"
};
}
export { upgrade };

@@ -1,6 +0,9 @@

import { ERRORS } from '../configuration.js';
import { OpenAPI } from './openapi.js';
export { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from './openapi.js';
import { OpenApiVersion, ERRORS } from '../configuration.js';
import { OpenAPI } from './openapi-types.js';
export { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from './openapi-types.js';
type AnyObject = Record<string, any>;
type LoadResult = {
filesystem: Filesystem;
};
type ValidateResult = {

@@ -13,7 +16,15 @@ valid: boolean;

};
type ErrorObject = {
message: string;
code?: keyof typeof ERRORS | string;
type UpgradeResult = {
specification: OpenAPI.Document;
version: string;
};
type ResolveResult = {
type FilterResult = {
specification: OpenAPI.Document;
};
type DetailsResult = {
version: OpenApiVersion;
specificationType: string;
specificationVersion: string;
};
type DereferenceResult = {
version: string | undefined;

@@ -24,2 +35,6 @@ specification?: OpenAPI.Document;

};
type ErrorObject = {
message: string;
code?: keyof typeof ERRORS | string;
};
type AjvOptions = {

@@ -44,2 +59,2 @@ strict?: boolean | 'log';

export { type AjvOptions, type AnyObject, type ErrorObject, type Filesystem, type FilesystemEntry, OpenAPI, type ResolveResult, type ValidateResult };
export { type AjvOptions, type AnyObject, type DereferenceResult, type DetailsResult, type ErrorObject, type Filesystem, type FilesystemEntry, type FilterResult, type LoadResult, OpenAPI, type UpgradeResult, type ValidateResult };

@@ -1,2 +0,2 @@

import { AnyObject, Filesystem, ResolveResult } from '../types/index.js';
import { AnyObject, Filesystem, DereferenceResult } from '../types/index.js';

@@ -6,4 +6,4 @@ /**

*/
declare function dereference(value: string | AnyObject | Filesystem): Promise<ResolveResult>;
declare function dereference(value: string | AnyObject | Filesystem): Promise<DereferenceResult>;
export { dereference };

@@ -1,2 +0,2 @@

import { AnyObject } from '../types/index.js';
import { AnyObject, DetailsResult } from '../types/index.js';

@@ -6,8 +6,4 @@ /**

*/
declare function details(specification: AnyObject): {
version: "2.0" | "3.0" | "3.1";
specificationType: string;
specificationVersion: string;
};
declare function details(specification: AnyObject): DetailsResult;
export { details };

@@ -1,2 +0,2 @@

import { AnyObject } from '../types/index.js';
import { AnyObject, FilterResult } from '../types/index.js';

@@ -6,4 +6,4 @@ /**

*/
declare function filter(specification: AnyObject, callback: (schema: AnyObject) => boolean): AnyObject;
declare function filter(specification: AnyObject, callback: (schema: AnyObject) => boolean): FilterResult;
export { filter };

@@ -1,2 +0,2 @@

import { Filesystem } from '../../types/index.js';
import { Filesystem, LoadResult } from '../../types/index.js';

@@ -14,4 +14,4 @@ type LoadPlugin = {

filesystem?: Filesystem;
}): Promise<Filesystem>;
}): Promise<LoadResult>;
export { type LoadPlugin, load };

@@ -7,5 +7,12 @@ import { LoadPlugin } from '../load.js';

declare const fetchUrlsPlugin: (customConfiguration?: {
/**
* Limit the number of requests. Set to `false` to disable the limit.
*/
limit?: number | false;
/**
* Fetch function to use instead of the global fetch. Use this to intercept requests.
*/
fetch?: (url: string) => Promise<Response>;
}) => LoadPlugin;
export { fetchUrlsPlugin, fetchUrlsPluginDefaultConfiguration };
import { ErrorObject, AnyObject, Filesystem, FilesystemEntry } from '../types/index.js';
import { OpenAPI } from '../types/openapi.js';
import { OpenAPI } from '../types/openapi-types.js';

@@ -4,0 +4,0 @@ type ResolveReferencesResult = {

@@ -1,2 +0,2 @@

import { AnyObject, Filesystem } from '../types/index.js';
import { AnyObject, Filesystem, UpgradeResult } from '../types/index.js';

@@ -6,4 +6,4 @@ /**

*/
declare function upgrade(specification: AnyObject | Filesystem, _options?: AnyObject): AnyObject | Filesystem;
declare function upgrade(specification: AnyObject | Filesystem, _options?: AnyObject): UpgradeResult;
export { upgrade };

@@ -1,1 +0,1 @@

{"builtAt":1717167358859,"assets":[{"name":"src/index.js","size":1587},{"name":"src/pipeline.js","size":3978},{"name":"src/lib/Validator/Validator.js","size":3166},{"name":"src/utils/resolveReferences.js","size":2951},{"name":"src/utils/dereference.js","size":566},{"name":"src/utils/details.js","size":571},{"name":"src/utils/escapeJsonPointer.js","size":122},{"name":"src/utils/filter.js","size":392},{"name":"src/utils/getEntrypoint.js","size":121},{"name":"src/utils/getListOfReferences.js","size":477},{"name":"src/utils/getSegmentsFromPath.js","size":228},{"name":"src/utils/isFilesystem.js","size":189},{"name":"src/utils/isJson.js","size":129},{"name":"src/utils/isObject.js","size":112},{"name":"src/utils/isYaml.js","size":249},{"name":"src/utils/load/load.js","size":1581},{"name":"src/utils/load/plugins/fetchUrlsPlugin.js","size":1065},{"name":"src/utils/load/plugins/readFilesPlugin.js","size":1224},{"name":"src/utils/normalize.js","size":393},{"name":"src/utils/toJson.js","size":78},{"name":"src/utils/toYaml.js","size":99},{"name":"src/utils/transformErrors.js","size":402},{"name":"src/utils/traverse.js","size":557},{"name":"src/utils/unescapeJsonPointer.js","size":136},{"name":"src/utils/upgrade.js","size":717},{"name":"src/utils/upgradeFromThreeToThreeOne.js","size":2127},{"name":"src/utils/upgradeFromTwoToThree.js","size":109},{"name":"src/utils/validate.js","size":413},{"name":"src/utils/makeFilesystem.js","size":520},{"name":"src/configuration.js","size":858},{"name":"src/utils/betterAjvErrors/index.js","size":439},{"name":"schemas/v2.0/schema.json.js","size":30949},{"name":"schemas/v3.0/schema.json.js","size":25234},{"name":"schemas/v3.1/schema.json.js","size":24839},{"name":"src/utils/betterAjvErrors/helpers.js","size":3303},{"name":"src/polyfills/path.js","size":1963},{"name":"src/utils/betterAjvErrors/utils.js","size":756},{"name":"src/utils/betterAjvErrors/validation-errors/enum.js","size":1252},{"name":"src/utils/betterAjvErrors/validation-errors/default.js","size":444},{"name":"src/utils/betterAjvErrors/validation-errors/unevaluated-prop.js","size":505},{"name":"src/utils/betterAjvErrors/validation-errors/required.js","size":384},{"name":"src/utils/betterAjvErrors/validation-errors/pattern.js","size":493},{"name":"src/utils/betterAjvErrors/validation-errors/additional-prop.js","size":501},{"name":"src/utils/betterAjvErrors/validation-errors/base.js","size":648}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["src/index.js"],"names":["src/index"]},{"id":"1610f8d","entry":false,"initial":true,"files":["src/pipeline.js"],"names":["src/pipeline"]},{"id":"a5b5029","entry":false,"initial":true,"files":["src/lib/Validator/Validator.js"],"names":["src/lib/Validator/Validator"]},{"id":"aea20c6","entry":false,"initial":true,"files":["src/utils/resolveReferences.js"],"names":["src/utils/resolveReferences"]},{"id":"f9b6a1a","entry":false,"initial":true,"files":["src/utils/dereference.js"],"names":["src/utils/dereference"]},{"id":"c64a2fa","entry":false,"initial":true,"files":["src/utils/details.js"],"names":["src/utils/details"]},{"id":"398f36d","entry":false,"initial":true,"files":["src/utils/escapeJsonPointer.js"],"names":["src/utils/escapeJsonPointer"]},{"id":"6c7ec36","entry":false,"initial":true,"files":["src/utils/filter.js"],"names":["src/utils/filter"]},{"id":"c07bf08","entry":false,"initial":true,"files":["src/utils/getEntrypoint.js"],"names":["src/utils/getEntrypoint"]},{"id":"13f9e1e","entry":false,"initial":true,"files":["src/utils/getListOfReferences.js"],"names":["src/utils/getListOfReferences"]},{"id":"b5bffbd","entry":false,"initial":true,"files":["src/utils/getSegmentsFromPath.js"],"names":["src/utils/getSegmentsFromPath"]},{"id":"8ea971a","entry":false,"initial":true,"files":["src/utils/isFilesystem.js"],"names":["src/utils/isFilesystem"]},{"id":"20e0bc7","entry":false,"initial":true,"files":["src/utils/isJson.js"],"names":["src/utils/isJson"]},{"id":"3180f00","entry":false,"initial":true,"files":["src/utils/isObject.js"],"names":["src/utils/isObject"]},{"id":"2305281","entry":false,"initial":true,"files":["src/utils/isYaml.js"],"names":["src/utils/isYaml"]},{"id":"6e9fd1a","entry":false,"initial":true,"files":["src/utils/load/load.js"],"names":["src/utils/load/load"]},{"id":"924bd2a","entry":false,"initial":true,"files":["src/utils/load/plugins/fetchUrlsPlugin.js"],"names":["src/utils/load/plugins/fetchUrlsPlugin"]},{"id":"eb4c5f3","entry":false,"initial":true,"files":["src/utils/load/plugins/readFilesPlugin.js"],"names":["src/utils/load/plugins/readFilesPlugin"]},{"id":"c62fce7","entry":false,"initial":true,"files":["src/utils/normalize.js"],"names":["src/utils/normalize"]},{"id":"ff23e2d","entry":false,"initial":true,"files":["src/utils/toJson.js"],"names":["src/utils/toJson"]},{"id":"893a485","entry":false,"initial":true,"files":["src/utils/toYaml.js"],"names":["src/utils/toYaml"]},{"id":"8d99789","entry":false,"initial":true,"files":["src/utils/transformErrors.js"],"names":["src/utils/transformErrors"]},{"id":"e6dbaad","entry":false,"initial":true,"files":["src/utils/traverse.js"],"names":["src/utils/traverse"]},{"id":"a5b1973","entry":false,"initial":true,"files":["src/utils/unescapeJsonPointer.js"],"names":["src/utils/unescapeJsonPointer"]},{"id":"7e74bc8","entry":false,"initial":true,"files":["src/utils/upgrade.js"],"names":["src/utils/upgrade"]},{"id":"acc1a8d","entry":false,"initial":true,"files":["src/utils/upgradeFromThreeToThreeOne.js"],"names":["src/utils/upgradeFromThreeToThreeOne"]},{"id":"d98a7d1","entry":false,"initial":true,"files":["src/utils/upgradeFromTwoToThree.js"],"names":["src/utils/upgradeFromTwoToThree"]},{"id":"ec25ebd","entry":false,"initial":true,"files":["src/utils/validate.js"],"names":["src/utils/validate"]},{"id":"90e5eec","entry":false,"initial":true,"files":["src/utils/makeFilesystem.js"],"names":["src/utils/makeFilesystem"]},{"id":"1eb4908","entry":false,"initial":true,"files":["src/configuration.js"],"names":["src/configuration"]},{"id":"a7c663b","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/index.js"],"names":["src/utils/betterAjvErrors/index"]},{"id":"7d833d7","entry":false,"initial":true,"files":["schemas/v2.0/schema.json.js"],"names":["schemas/v2.0/schema.json"]},{"id":"3870082","entry":false,"initial":true,"files":["schemas/v3.0/schema.json.js"],"names":["schemas/v3.0/schema.json"]},{"id":"ba96e53","entry":false,"initial":true,"files":["schemas/v3.1/schema.json.js"],"names":["schemas/v3.1/schema.json"]},{"id":"003968b","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/helpers.js"],"names":["src/utils/betterAjvErrors/helpers"]},{"id":"20a5186","entry":false,"initial":true,"files":["src/polyfills/path.js"],"names":["src/polyfills/path"]},{"id":"8c3e592","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/utils.js"],"names":["src/utils/betterAjvErrors/utils"]},{"id":"b67304b","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/validation-errors/enum.js"],"names":["src/utils/betterAjvErrors/validation-errors/enum"]},{"id":"0587cdd","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/validation-errors/default.js"],"names":["src/utils/betterAjvErrors/validation-errors/default"]},{"id":"4f9c5a8","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/validation-errors/unevaluated-prop.js"],"names":["src/utils/betterAjvErrors/validation-errors/unevaluated-prop"]},{"id":"74cdbcb","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/validation-errors/required.js"],"names":["src/utils/betterAjvErrors/validation-errors/required"]},{"id":"8f5040f","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/validation-errors/pattern.js"],"names":["src/utils/betterAjvErrors/validation-errors/pattern"]},{"id":"7c5b700","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/validation-errors/additional-prop.js"],"names":["src/utils/betterAjvErrors/validation-errors/additional-prop"]},{"id":"372b5cd","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/validation-errors/base.js"],"names":["src/utils/betterAjvErrors/validation-errors/base"]}],"modules":[{"name":"./src/index.ts","size":0,"chunks":["a1ee98a"]},{"name":"./src/pipeline.ts","size":3466,"chunks":["1610f8d"]},{"name":"./src/lib/Validator/Validator.ts","size":2737,"chunks":["a5b5029"]},{"name":"./src/utils/resolveReferences.ts","size":2702,"chunks":["aea20c6"]},{"name":"./src/utils/dereference.ts","size":333,"chunks":["f9b6a1a"]},{"name":"./src/utils/details.ts","size":493,"chunks":["c64a2fa"]},{"name":"./src/utils/escapeJsonPointer.ts","size":90,"chunks":["398f36d"]},{"name":"./src/utils/filter.ts","size":222,"chunks":["6c7ec36"]},{"name":"./src/utils/getEntrypoint.ts","size":93,"chunks":["c07bf08"]},{"name":"./src/utils/getListOfReferences.ts","size":400,"chunks":["13f9e1e"]},{"name":"./src/utils/getSegmentsFromPath.ts","size":129,"chunks":["b5bffbd"]},{"name":"./src/utils/isFilesystem.ts","size":162,"chunks":["8ea971a"]},{"name":"./src/utils/isJson.ts","size":108,"chunks":["20e0bc7"]},{"name":"./src/utils/isObject.ts","size":89,"chunks":["3180f00"]},{"name":"./src/utils/isYaml.ts","size":197,"chunks":["2305281"]},{"name":"./src/utils/load/load.ts","size":1396,"chunks":["6e9fd1a"]},{"name":"./src/utils/load/plugins/fetchUrlsPlugin.ts","size":998,"chunks":["924bd2a"]},{"name":"./src/utils/load/plugins/readFilesPlugin.ts","size":971,"chunks":["eb4c5f3"]},{"name":"./src/utils/normalize.ts","size":288,"chunks":["c62fce7"]},{"name":"./src/utils/toJson.ts","size":57,"chunks":["ff23e2d"]},{"name":"./src/utils/toYaml.ts","size":43,"chunks":["893a485"]},{"name":"./src/utils/transformErrors.ts","size":309,"chunks":["8d99789"]},{"name":"./src/utils/traverse.ts","size":534,"chunks":["e6dbaad"]},{"name":"./src/utils/unescapeJsonPointer.ts","size":102,"chunks":["a5b1973"]},{"name":"./src/utils/upgrade.ts","size":392,"chunks":["7e74bc8"]},{"name":"./src/utils/upgradeFromThreeToThreeOne.ts","size":2043,"chunks":["acc1a8d"]},{"name":"./src/utils/upgradeFromTwoToThree.ts","size":73,"chunks":["d98a7d1"]},{"name":"./src/utils/validate.ts","size":276,"chunks":["ec25ebd"]},{"name":"./src/utils/makeFilesystem.ts","size":332,"chunks":["90e5eec"]},{"name":"./src/configuration.ts","size":628,"chunks":["1eb4908"]},{"name":"./src/utils/betterAjvErrors/index.ts","size":371,"chunks":["a7c663b"]},{"name":"./schemas/v2.0/schema.json","size":30812,"chunks":["7d833d7"]},{"name":"./schemas/v3.0/schema.json","size":25091,"chunks":["3870082"]},{"name":"./schemas/v3.1/schema.json","size":24706,"chunks":["ba96e53"]},{"name":"./src/utils/betterAjvErrors/helpers.ts","size":2636,"chunks":["003968b"]},{"name":"./src/polyfills/path.ts","size":1912,"chunks":["20a5186"]},{"name":"./src/utils/betterAjvErrors/utils.js","size":637,"chunks":["8c3e592"]},{"name":"./src/utils/betterAjvErrors/validation-errors/enum.js","size":1099,"chunks":["b67304b"]},{"name":"./src/utils/betterAjvErrors/validation-errors/default.js","size":350,"chunks":["0587cdd"]},{"name":"./src/utils/betterAjvErrors/validation-errors/unevaluated-prop.js","size":403,"chunks":["4f9c5a8"]},{"name":"./src/utils/betterAjvErrors/validation-errors/required.js","size":289,"chunks":["74cdbcb"]},{"name":"./src/utils/betterAjvErrors/validation-errors/pattern.js","size":399,"chunks":["8f5040f"]},{"name":"./src/utils/betterAjvErrors/validation-errors/additional-prop.js","size":400,"chunks":["7c5b700"]},{"name":"./src/utils/betterAjvErrors/validation-errors/base.js","size":603,"chunks":["372b5cd"]}]}
{"builtAt":1717672264982,"assets":[{"name":"src/index.js","size":1587},{"name":"src/pipeline.js","size":3563},{"name":"src/lib/Validator/Validator.js","size":3166},{"name":"src/utils/resolveReferences.js","size":2951},{"name":"src/utils/dereference.js","size":566},{"name":"src/utils/details.js","size":571},{"name":"src/utils/escapeJsonPointer.js","size":122},{"name":"src/utils/filter.js","size":443},{"name":"src/utils/getEntrypoint.js","size":121},{"name":"src/utils/getListOfReferences.js","size":477},{"name":"src/utils/getSegmentsFromPath.js","size":228},{"name":"src/utils/isFilesystem.js","size":189},{"name":"src/utils/isJson.js","size":129},{"name":"src/utils/isObject.js","size":112},{"name":"src/utils/isYaml.js","size":250},{"name":"src/utils/load/load.js","size":1924},{"name":"src/utils/load/plugins/fetchUrlsPlugin.js","size":1119},{"name":"src/utils/load/plugins/readFilesPlugin.js","size":1224},{"name":"src/utils/normalize.js","size":431},{"name":"src/utils/toJson.js","size":78},{"name":"src/utils/toYaml.js","size":99},{"name":"src/utils/transformErrors.js","size":402},{"name":"src/utils/traverse.js","size":557},{"name":"src/utils/unescapeJsonPointer.js","size":136},{"name":"src/utils/upgrade.js","size":644},{"name":"src/utils/upgradeFromThreeToThreeOne.js","size":2127},{"name":"src/utils/upgradeFromTwoToThree.js","size":109},{"name":"src/utils/validate.js","size":413},{"name":"src/utils/workThroughQueue.js","size":637},{"name":"src/utils/makeFilesystem.js","size":520},{"name":"src/configuration.js","size":858},{"name":"src/utils/betterAjvErrors/index.js","size":439},{"name":"schemas/v2.0/schema.json.js","size":30949},{"name":"schemas/v3.0/schema.json.js","size":25234},{"name":"schemas/v3.1/schema.json.js","size":24839},{"name":"src/utils/betterAjvErrors/helpers.js","size":3303},{"name":"src/polyfills/path.js","size":1963},{"name":"src/utils/betterAjvErrors/utils.js","size":756},{"name":"src/utils/betterAjvErrors/validation-errors/enum.js","size":1252},{"name":"src/utils/betterAjvErrors/validation-errors/default.js","size":444},{"name":"src/utils/betterAjvErrors/validation-errors/unevaluated-prop.js","size":505},{"name":"src/utils/betterAjvErrors/validation-errors/required.js","size":384},{"name":"src/utils/betterAjvErrors/validation-errors/pattern.js","size":493},{"name":"src/utils/betterAjvErrors/validation-errors/additional-prop.js","size":501},{"name":"src/utils/betterAjvErrors/validation-errors/base.js","size":648}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["src/index.js"],"names":["src/index"]},{"id":"1610f8d","entry":false,"initial":true,"files":["src/pipeline.js"],"names":["src/pipeline"]},{"id":"a5b5029","entry":false,"initial":true,"files":["src/lib/Validator/Validator.js"],"names":["src/lib/Validator/Validator"]},{"id":"aea20c6","entry":false,"initial":true,"files":["src/utils/resolveReferences.js"],"names":["src/utils/resolveReferences"]},{"id":"f9b6a1a","entry":false,"initial":true,"files":["src/utils/dereference.js"],"names":["src/utils/dereference"]},{"id":"c64a2fa","entry":false,"initial":true,"files":["src/utils/details.js"],"names":["src/utils/details"]},{"id":"398f36d","entry":false,"initial":true,"files":["src/utils/escapeJsonPointer.js"],"names":["src/utils/escapeJsonPointer"]},{"id":"6c7ec36","entry":false,"initial":true,"files":["src/utils/filter.js"],"names":["src/utils/filter"]},{"id":"c07bf08","entry":false,"initial":true,"files":["src/utils/getEntrypoint.js"],"names":["src/utils/getEntrypoint"]},{"id":"13f9e1e","entry":false,"initial":true,"files":["src/utils/getListOfReferences.js"],"names":["src/utils/getListOfReferences"]},{"id":"b5bffbd","entry":false,"initial":true,"files":["src/utils/getSegmentsFromPath.js"],"names":["src/utils/getSegmentsFromPath"]},{"id":"8ea971a","entry":false,"initial":true,"files":["src/utils/isFilesystem.js"],"names":["src/utils/isFilesystem"]},{"id":"20e0bc7","entry":false,"initial":true,"files":["src/utils/isJson.js"],"names":["src/utils/isJson"]},{"id":"3180f00","entry":false,"initial":true,"files":["src/utils/isObject.js"],"names":["src/utils/isObject"]},{"id":"2305281","entry":false,"initial":true,"files":["src/utils/isYaml.js"],"names":["src/utils/isYaml"]},{"id":"6e9fd1a","entry":false,"initial":true,"files":["src/utils/load/load.js"],"names":["src/utils/load/load"]},{"id":"924bd2a","entry":false,"initial":true,"files":["src/utils/load/plugins/fetchUrlsPlugin.js"],"names":["src/utils/load/plugins/fetchUrlsPlugin"]},{"id":"eb4c5f3","entry":false,"initial":true,"files":["src/utils/load/plugins/readFilesPlugin.js"],"names":["src/utils/load/plugins/readFilesPlugin"]},{"id":"c62fce7","entry":false,"initial":true,"files":["src/utils/normalize.js"],"names":["src/utils/normalize"]},{"id":"ff23e2d","entry":false,"initial":true,"files":["src/utils/toJson.js"],"names":["src/utils/toJson"]},{"id":"893a485","entry":false,"initial":true,"files":["src/utils/toYaml.js"],"names":["src/utils/toYaml"]},{"id":"8d99789","entry":false,"initial":true,"files":["src/utils/transformErrors.js"],"names":["src/utils/transformErrors"]},{"id":"e6dbaad","entry":false,"initial":true,"files":["src/utils/traverse.js"],"names":["src/utils/traverse"]},{"id":"a5b1973","entry":false,"initial":true,"files":["src/utils/unescapeJsonPointer.js"],"names":["src/utils/unescapeJsonPointer"]},{"id":"7e74bc8","entry":false,"initial":true,"files":["src/utils/upgrade.js"],"names":["src/utils/upgrade"]},{"id":"acc1a8d","entry":false,"initial":true,"files":["src/utils/upgradeFromThreeToThreeOne.js"],"names":["src/utils/upgradeFromThreeToThreeOne"]},{"id":"d98a7d1","entry":false,"initial":true,"files":["src/utils/upgradeFromTwoToThree.js"],"names":["src/utils/upgradeFromTwoToThree"]},{"id":"ec25ebd","entry":false,"initial":true,"files":["src/utils/validate.js"],"names":["src/utils/validate"]},{"id":"7c18e02","entry":false,"initial":true,"files":["src/utils/workThroughQueue.js"],"names":["src/utils/workThroughQueue"]},{"id":"90e5eec","entry":false,"initial":true,"files":["src/utils/makeFilesystem.js"],"names":["src/utils/makeFilesystem"]},{"id":"1eb4908","entry":false,"initial":true,"files":["src/configuration.js"],"names":["src/configuration"]},{"id":"a7c663b","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/index.js"],"names":["src/utils/betterAjvErrors/index"]},{"id":"7d833d7","entry":false,"initial":true,"files":["schemas/v2.0/schema.json.js"],"names":["schemas/v2.0/schema.json"]},{"id":"3870082","entry":false,"initial":true,"files":["schemas/v3.0/schema.json.js"],"names":["schemas/v3.0/schema.json"]},{"id":"ba96e53","entry":false,"initial":true,"files":["schemas/v3.1/schema.json.js"],"names":["schemas/v3.1/schema.json"]},{"id":"003968b","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/helpers.js"],"names":["src/utils/betterAjvErrors/helpers"]},{"id":"20a5186","entry":false,"initial":true,"files":["src/polyfills/path.js"],"names":["src/polyfills/path"]},{"id":"8c3e592","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/utils.js"],"names":["src/utils/betterAjvErrors/utils"]},{"id":"b67304b","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/validation-errors/enum.js"],"names":["src/utils/betterAjvErrors/validation-errors/enum"]},{"id":"0587cdd","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/validation-errors/default.js"],"names":["src/utils/betterAjvErrors/validation-errors/default"]},{"id":"4f9c5a8","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/validation-errors/unevaluated-prop.js"],"names":["src/utils/betterAjvErrors/validation-errors/unevaluated-prop"]},{"id":"74cdbcb","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/validation-errors/required.js"],"names":["src/utils/betterAjvErrors/validation-errors/required"]},{"id":"8f5040f","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/validation-errors/pattern.js"],"names":["src/utils/betterAjvErrors/validation-errors/pattern"]},{"id":"7c5b700","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/validation-errors/additional-prop.js"],"names":["src/utils/betterAjvErrors/validation-errors/additional-prop"]},{"id":"372b5cd","entry":false,"initial":true,"files":["src/utils/betterAjvErrors/validation-errors/base.js"],"names":["src/utils/betterAjvErrors/validation-errors/base"]}],"modules":[{"name":"./src/index.ts","size":0,"chunks":["a1ee98a"]},{"name":"./src/pipeline.ts","size":3047,"chunks":["1610f8d"]},{"name":"./src/lib/Validator/Validator.ts","size":2737,"chunks":["a5b5029"]},{"name":"./src/utils/resolveReferences.ts","size":2702,"chunks":["aea20c6"]},{"name":"./src/utils/dereference.ts","size":333,"chunks":["f9b6a1a"]},{"name":"./src/utils/details.ts","size":493,"chunks":["c64a2fa"]},{"name":"./src/utils/escapeJsonPointer.ts","size":90,"chunks":["398f36d"]},{"name":"./src/utils/filter.ts","size":273,"chunks":["6c7ec36"]},{"name":"./src/utils/getEntrypoint.ts","size":93,"chunks":["c07bf08"]},{"name":"./src/utils/getListOfReferences.ts","size":400,"chunks":["13f9e1e"]},{"name":"./src/utils/getSegmentsFromPath.ts","size":129,"chunks":["b5bffbd"]},{"name":"./src/utils/isFilesystem.ts","size":162,"chunks":["8ea971a"]},{"name":"./src/utils/isJson.ts","size":108,"chunks":["20e0bc7"]},{"name":"./src/utils/isObject.ts","size":89,"chunks":["3180f00"]},{"name":"./src/utils/isYaml.ts","size":198,"chunks":["2305281"]},{"name":"./src/utils/load/load.ts","size":1686,"chunks":["6e9fd1a"]},{"name":"./src/utils/load/plugins/fetchUrlsPlugin.ts","size":1052,"chunks":["924bd2a"]},{"name":"./src/utils/load/plugins/readFilesPlugin.ts","size":971,"chunks":["eb4c5f3"]},{"name":"./src/utils/normalize.ts","size":326,"chunks":["c62fce7"]},{"name":"./src/utils/toJson.ts","size":57,"chunks":["ff23e2d"]},{"name":"./src/utils/toYaml.ts","size":43,"chunks":["893a485"]},{"name":"./src/utils/transformErrors.ts","size":309,"chunks":["8d99789"]},{"name":"./src/utils/traverse.ts","size":534,"chunks":["e6dbaad"]},{"name":"./src/utils/unescapeJsonPointer.ts","size":102,"chunks":["a5b1973"]},{"name":"./src/utils/upgrade.ts","size":369,"chunks":["7e74bc8"]},{"name":"./src/utils/upgradeFromThreeToThreeOne.ts","size":2043,"chunks":["acc1a8d"]},{"name":"./src/utils/upgradeFromTwoToThree.ts","size":73,"chunks":["d98a7d1"]},{"name":"./src/utils/validate.ts","size":276,"chunks":["ec25ebd"]},{"name":"./src/utils/workThroughQueue.ts","size":606,"chunks":["7c18e02"]},{"name":"./src/utils/makeFilesystem.ts","size":332,"chunks":["90e5eec"]},{"name":"./src/configuration.ts","size":628,"chunks":["1eb4908"]},{"name":"./src/utils/betterAjvErrors/index.ts","size":371,"chunks":["a7c663b"]},{"name":"./schemas/v2.0/schema.json","size":30812,"chunks":["7d833d7"]},{"name":"./schemas/v3.0/schema.json","size":25091,"chunks":["3870082"]},{"name":"./schemas/v3.1/schema.json","size":24706,"chunks":["ba96e53"]},{"name":"./src/utils/betterAjvErrors/helpers.ts","size":2636,"chunks":["003968b"]},{"name":"./src/polyfills/path.ts","size":1912,"chunks":["20a5186"]},{"name":"./src/utils/betterAjvErrors/utils.js","size":637,"chunks":["8c3e592"]},{"name":"./src/utils/betterAjvErrors/validation-errors/enum.js","size":1099,"chunks":["b67304b"]},{"name":"./src/utils/betterAjvErrors/validation-errors/default.js","size":350,"chunks":["0587cdd"]},{"name":"./src/utils/betterAjvErrors/validation-errors/unevaluated-prop.js","size":403,"chunks":["4f9c5a8"]},{"name":"./src/utils/betterAjvErrors/validation-errors/required.js","size":289,"chunks":["74cdbcb"]},{"name":"./src/utils/betterAjvErrors/validation-errors/pattern.js","size":399,"chunks":["8f5040f"]},{"name":"./src/utils/betterAjvErrors/validation-errors/additional-prop.js","size":400,"chunks":["7c5b700"]},{"name":"./src/utils/betterAjvErrors/validation-errors/base.js","size":603,"chunks":["372b5cd"]}]}

@@ -15,3 +15,3 @@ {

"bugs": "https://github.com/scalar/scalar/issues/new/choose",
"version": "0.5.0",
"version": "0.6.0",
"engines": {

@@ -38,4 +38,4 @@ "node": ">=18"

"@rollup/plugin-typescript": "^11.1.6",
"@types/node": "^20.12.12",
"glob": "^10.3.16",
"@types/node": "^20.14.0",
"glob": "^10.4.1",
"just-diff": "^6.0.2",

@@ -50,3 +50,3 @@ "rollup": "^4.18.0",

"dependencies": {
"ajv": "^8.13.0",
"ajv": "^8.14.0",
"ajv-draft-04": "^1.0.0",

@@ -53,0 +53,0 @@ "ajv-formats": "^3.0.1",

@@ -50,8 +50,8 @@ # Scalar OpenAPI Parser

const result = await validate(file)
const { valid, errors } = await validate(file)
console.log(result.valid)
console.log(valid)
if (!result.valid) {
console.log(result.errors)
if (!valid) {
console.log(errors)
}

@@ -74,5 +74,5 @@ ```

const result = await dereference(file)
const { version } = await dereference(file)
console.log(result.version)
console.log(version)
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc