@redocly/openapi-core 0.0.0-snapshot.1759850691 → 0.0.0-snapshot.1760519150
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bundle/bundle-document.d.ts +30 -0
- package/lib/bundle/bundle-document.d.ts.map +1 -0
- package/lib/bundle/bundle-document.js +78 -0
- package/lib/bundle/bundle-document.js.map +1 -0
- package/lib/bundle/bundle-visitor.d.ts +7 -0
- package/lib/bundle/bundle-visitor.d.ts.map +1 -0
- package/lib/bundle/bundle-visitor.js +230 -0
- package/lib/bundle/bundle-visitor.js.map +1 -0
- package/lib/bundle-oas.d.ts +23 -0
- package/lib/bundle-oas.d.ts.map +1 -0
- package/lib/bundle-oas.js +55 -0
- package/lib/bundle-oas.js.map +1 -0
- package/lib/bundle.d.ts +4 -15
- package/lib/bundle.d.ts.map +1 -1
- package/lib/bundle.js +6 -299
- package/lib/bundle.js.map +1 -1
- package/lib/config/bundle-extends.js +1 -1
- package/lib/config/bundle-extends.js.map +1 -1
- package/lib/config/config-resolvers.d.ts.map +1 -1
- package/lib/config/config-resolvers.js +5 -1
- package/lib/config/config-resolvers.js.map +1 -1
- package/lib/config/config.d.ts +1 -1
- package/lib/config/config.d.ts.map +1 -1
- package/lib/config/config.js +6 -4
- package/lib/config/config.js.map +1 -1
- package/lib/config/get-resolve-config.d.ts +3 -0
- package/lib/config/get-resolve-config.d.ts.map +1 -0
- package/lib/config/get-resolve-config.js +9 -0
- package/lib/config/get-resolve-config.js.map +1 -0
- package/lib/config/group-assertion-rules.d.ts +3 -0
- package/lib/config/group-assertion-rules.d.ts.map +1 -0
- package/lib/config/group-assertion-rules.js +50 -0
- package/lib/config/group-assertion-rules.js.map +1 -0
- package/lib/config/load.d.ts +2 -2
- package/lib/config/load.d.ts.map +1 -1
- package/lib/config/load.js +1 -1
- package/lib/config/load.js.map +1 -1
- package/lib/config/rules.js +1 -1
- package/lib/config/rules.js.map +1 -1
- package/lib/config/utils.d.ts.map +1 -1
- package/lib/config/utils.js +2 -1
- package/lib/config/utils.js.map +1 -1
- package/lib/config/visitors.js +1 -1
- package/lib/config/visitors.js.map +1 -1
- package/lib/decorators/common/filters/filter-helper.d.ts.map +1 -1
- package/lib/decorators/common/filters/filter-helper.js +3 -1
- package/lib/decorators/common/filters/filter-helper.js.map +1 -1
- package/lib/decorators/common/info-description-override.js +1 -1
- package/lib/decorators/common/info-description-override.js.map +1 -1
- package/lib/decorators/common/media-type-examples-override.js +1 -1
- package/lib/decorators/common/media-type-examples-override.js.map +1 -1
- package/lib/decorators/common/operation-description-override.js +1 -1
- package/lib/decorators/common/operation-description-override.js.map +1 -1
- package/lib/decorators/common/remove-x-internal.d.ts.map +1 -1
- package/lib/decorators/common/remove-x-internal.js +3 -1
- package/lib/decorators/common/remove-x-internal.js.map +1 -1
- package/lib/decorators/common/tag-description-override.js +1 -1
- package/lib/decorators/common/tag-description-override.js.map +1 -1
- package/lib/decorators/oas2/remove-unused-components.js +1 -1
- package/lib/decorators/oas2/remove-unused-components.js.map +1 -1
- package/lib/decorators/oas3/remove-unused-components.js +1 -1
- package/lib/decorators/oas3/remove-unused-components.js.map +1 -1
- package/lib/detect-spec.d.ts +5 -0
- package/lib/detect-spec.d.ts.map +1 -0
- package/lib/detect-spec.js +72 -0
- package/lib/detect-spec.js.map +1 -0
- package/lib/errors/yaml-parse-error.d.ts +9 -0
- package/lib/errors/yaml-parse-error.d.ts.map +1 -0
- package/lib/errors/yaml-parse-error.js +14 -0
- package/lib/errors/yaml-parse-error.js.map +1 -0
- package/lib/index.d.ts +20 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +19 -4
- package/lib/index.js.map +1 -1
- package/lib/lint.d.ts +1 -1
- package/lib/lint.d.ts.map +1 -1
- package/lib/lint.js +2 -1
- package/lib/lint.js.map +1 -1
- package/lib/logger.js +1 -1
- package/lib/logger.js.map +1 -1
- package/lib/oas-types.d.ts +0 -1
- package/lib/oas-types.d.ts.map +1 -1
- package/lib/oas-types.js +0 -41
- package/lib/oas-types.js.map +1 -1
- package/lib/ref-utils.d.ts.map +1 -1
- package/lib/ref-utils.js +2 -1
- package/lib/ref-utils.js.map +1 -1
- package/lib/resolve.d.ts +1 -8
- package/lib/resolve.d.ts.map +1 -1
- package/lib/resolve.js +9 -18
- package/lib/resolve.js.map +1 -1
- package/lib/rules/common/assertions/asserts.d.ts.map +1 -1
- package/lib/rules/common/assertions/asserts.js +6 -2
- package/lib/rules/common/assertions/asserts.js.map +1 -1
- package/lib/rules/common/assertions/index.js +1 -1
- package/lib/rules/common/assertions/index.js.map +1 -1
- package/lib/rules/common/assertions/utils.d.ts +0 -8
- package/lib/rules/common/assertions/utils.d.ts.map +1 -1
- package/lib/rules/common/assertions/utils.js +4 -41
- package/lib/rules/common/assertions/utils.js.map +1 -1
- package/lib/rules/common/info-license-strict.js +1 -1
- package/lib/rules/common/info-license-strict.js.map +1 -1
- package/lib/rules/common/no-http-verbs-in-paths.d.ts.map +1 -1
- package/lib/rules/common/no-http-verbs-in-paths.js +3 -2
- package/lib/rules/common/no-http-verbs-in-paths.js.map +1 -1
- package/lib/rules/common/no-required-schema-properties-undefined.js +1 -1
- package/lib/rules/common/no-required-schema-properties-undefined.js.map +1 -1
- package/lib/rules/common/no-unresolved-refs.js +1 -1
- package/lib/rules/common/no-unresolved-refs.js.map +1 -1
- package/lib/rules/common/path-segment-plural.js +1 -1
- package/lib/rules/common/path-segment-plural.js.map +1 -1
- package/lib/rules/common/response-contains-header.js +1 -1
- package/lib/rules/common/response-contains-header.js.map +1 -1
- package/lib/rules/common/scalar-property-missing-example.js +1 -1
- package/lib/rules/common/scalar-property-missing-example.js.map +1 -1
- package/lib/rules/common/struct.d.ts.map +1 -1
- package/lib/rules/common/struct.js +2 -1
- package/lib/rules/common/struct.js.map +1 -1
- package/lib/rules/oas2/request-mime-type.js +1 -1
- package/lib/rules/oas2/request-mime-type.js.map +1 -1
- package/lib/rules/oas2/response-contains-property.js +1 -1
- package/lib/rules/oas2/response-contains-property.js.map +1 -1
- package/lib/rules/oas2/response-mime-type.js +1 -1
- package/lib/rules/oas2/response-mime-type.js.map +1 -1
- package/lib/rules/oas3/request-mime-type.js +1 -1
- package/lib/rules/oas3/request-mime-type.js.map +1 -1
- package/lib/rules/oas3/response-contains-property.js +1 -1
- package/lib/rules/oas3/response-contains-property.js.map +1 -1
- package/lib/rules/oas3/response-mime-type.js +1 -1
- package/lib/rules/oas3/response-mime-type.js.map +1 -1
- package/lib/rules/respect/respect-supported-versions.js +1 -1
- package/lib/rules/respect/respect-supported-versions.js.map +1 -1
- package/lib/rules/utils.js +1 -1
- package/lib/rules/utils.js.map +1 -1
- package/lib/types/json-schema-adapter.js +1 -1
- package/lib/types/json-schema-adapter.js.map +1 -1
- package/lib/types/redocly-yaml.d.ts.map +1 -1
- package/lib/types/redocly-yaml.js +2 -1
- package/lib/types/redocly-yaml.js.map +1 -1
- package/lib/types.d.ts +5 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/utils/assign-config.d.ts +7 -0
- package/lib/utils/assign-config.d.ts.map +1 -0
- package/lib/utils/assign-config.js +28 -0
- package/lib/utils/assign-config.js.map +1 -0
- package/lib/utils/does-yaml-file-exist.d.ts +2 -0
- package/lib/utils/does-yaml-file-exist.d.ts.map +1 -0
- package/lib/utils/does-yaml-file-exist.js +7 -0
- package/lib/utils/does-yaml-file-exist.js.map +1 -0
- package/lib/utils/get-intersection-length.d.ts +2 -0
- package/lib/utils/get-intersection-length.d.ts.map +1 -0
- package/lib/utils/get-intersection-length.js +11 -0
- package/lib/utils/get-intersection-length.js.map +1 -0
- package/lib/utils/get-matching-status-code-range.d.ts +2 -0
- package/lib/utils/get-matching-status-code-range.d.ts.map +1 -0
- package/lib/utils/get-matching-status-code-range.js +4 -0
- package/lib/utils/get-matching-status-code-range.js.map +1 -0
- package/lib/utils/get-own.d.ts +2 -0
- package/lib/utils/get-own.d.ts.map +1 -0
- package/lib/utils/get-own.js +4 -0
- package/lib/utils/get-own.js.map +1 -0
- package/lib/utils/identity.d.ts +2 -0
- package/lib/utils/identity.d.ts.map +1 -0
- package/lib/utils/identity.js +4 -0
- package/lib/utils/identity.js.map +1 -0
- package/lib/utils/is-custom-rule-id.d.ts +2 -0
- package/lib/utils/is-custom-rule-id.d.ts.map +1 -0
- package/lib/utils/is-custom-rule-id.js +4 -0
- package/lib/utils/is-custom-rule-id.js.map +1 -0
- package/lib/utils/is-defined.d.ts +2 -0
- package/lib/utils/is-defined.d.ts.map +1 -0
- package/lib/utils/is-defined.js +4 -0
- package/lib/utils/is-defined.js.map +1 -0
- package/lib/utils/is-empty-array.d.ts +2 -0
- package/lib/utils/is-empty-array.d.ts.map +1 -0
- package/lib/utils/is-empty-array.js +4 -0
- package/lib/utils/is-empty-array.js.map +1 -0
- package/lib/utils/is-empty-object.d.ts +2 -0
- package/lib/utils/is-empty-object.d.ts.map +1 -0
- package/lib/utils/is-empty-object.js +5 -0
- package/lib/utils/is-empty-object.js.map +1 -0
- package/lib/utils/is-not-empty-array.d.ts +2 -0
- package/lib/utils/is-not-empty-array.d.ts.map +1 -0
- package/lib/utils/is-not-empty-array.js +4 -0
- package/lib/utils/is-not-empty-array.js.map +1 -0
- package/lib/utils/is-not-empty-object.d.ts +2 -0
- package/lib/utils/is-not-empty-object.d.ts.map +1 -0
- package/lib/utils/is-not-empty-object.js +6 -0
- package/lib/utils/is-not-empty-object.js.map +1 -0
- package/lib/utils/is-not-string.d.ts +2 -0
- package/lib/utils/is-not-string.d.ts.map +1 -0
- package/lib/utils/is-not-string.js +5 -0
- package/lib/utils/is-not-string.js.map +1 -0
- package/lib/utils/is-ordered.d.ts +7 -0
- package/lib/utils/is-ordered.d.ts.map +1 -0
- package/lib/utils/is-ordered.js +27 -0
- package/lib/utils/is-ordered.js.map +1 -0
- package/lib/utils/is-path-parameter.d.ts +2 -0
- package/lib/utils/is-path-parameter.d.ts.map +1 -0
- package/lib/utils/is-path-parameter.js +4 -0
- package/lib/utils/is-path-parameter.js.map +1 -0
- package/lib/utils/is-plain-object.d.ts +2 -0
- package/lib/utils/is-plain-object.d.ts.map +1 -0
- package/lib/utils/is-plain-object.js +4 -0
- package/lib/utils/is-plain-object.js.map +1 -0
- package/lib/utils/is-string.d.ts +2 -0
- package/lib/utils/is-string.d.ts.map +1 -0
- package/lib/utils/is-string.js +4 -0
- package/lib/utils/is-string.js.map +1 -0
- package/lib/utils/is-truthy.d.ts +3 -0
- package/lib/utils/is-truthy.d.ts.map +1 -0
- package/lib/utils/is-truthy.js +4 -0
- package/lib/utils/is-truthy.js.map +1 -0
- package/lib/utils/keys-of.d.ts +2 -0
- package/lib/utils/keys-of.d.ts.map +1 -0
- package/lib/utils/keys-of.js +6 -0
- package/lib/utils/keys-of.js.map +1 -0
- package/lib/utils/make-ref-id.d.ts +2 -0
- package/lib/utils/make-ref-id.d.ts.map +1 -0
- package/lib/utils/make-ref-id.js +4 -0
- package/lib/utils/make-ref-id.js.map +1 -0
- package/lib/utils/next-tick.d.ts +2 -0
- package/lib/utils/next-tick.d.ts.map +1 -0
- package/lib/utils/next-tick.js +6 -0
- package/lib/utils/next-tick.js.map +1 -0
- package/lib/utils/omit.d.ts +2 -0
- package/lib/utils/omit.d.ts.map +1 -0
- package/lib/utils/omit.js +8 -0
- package/lib/utils/omit.js.map +1 -0
- package/lib/utils/pause.d.ts +2 -0
- package/lib/utils/pause.d.ts.map +1 -0
- package/lib/utils/pause.js +4 -0
- package/lib/utils/pause.js.map +1 -0
- package/lib/utils/pluralize.d.ts +2 -0
- package/lib/utils/pluralize.d.ts.map +1 -0
- package/lib/utils/pluralize.js +8 -0
- package/lib/utils/pluralize.js.map +1 -0
- package/lib/utils/read-file-from-url.d.ts +6 -0
- package/lib/utils/read-file-from-url.d.ts.map +1 -0
- package/lib/utils/read-file-from-url.js +26 -0
- package/lib/utils/read-file-from-url.js.map +1 -0
- package/lib/utils/regex-from-string.d.ts +2 -0
- package/lib/utils/regex-from-string.d.ts.map +1 -0
- package/lib/utils/regex-from-string.js +5 -0
- package/lib/utils/regex-from-string.js.map +1 -0
- package/lib/utils/slash.d.ts +5 -0
- package/lib/utils/slash.d.ts.map +1 -0
- package/lib/utils/slash.js +11 -0
- package/lib/utils/slash.js.map +1 -0
- package/lib/utils/split-camel-case-into-words.d.ts +2 -0
- package/lib/utils/split-camel-case-into-words.d.ts.map +1 -0
- package/lib/utils/split-camel-case-into-words.js +13 -0
- package/lib/utils/split-camel-case-into-words.js.map +1 -0
- package/lib/utils/stack.d.ts +12 -0
- package/lib/utils/stack.d.ts.map +1 -0
- package/lib/utils/stack.js +7 -0
- package/lib/utils/stack.js.map +1 -0
- package/lib/utils/validate-mime-type.d.ts +4 -0
- package/lib/utils/validate-mime-type.d.ts.map +1 -0
- package/lib/utils/validate-mime-type.js +31 -0
- package/lib/utils/validate-mime-type.js.map +1 -0
- package/lib/utils/yaml-fs-helper.d.ts +6 -0
- package/lib/utils/yaml-fs-helper.d.ts.map +1 -0
- package/lib/utils/yaml-fs-helper.js +23 -0
- package/lib/utils/yaml-fs-helper.js.map +1 -0
- package/lib/visitors.d.ts +1 -1
- package/lib/visitors.d.ts.map +1 -1
- package/lib/visitors.js +1 -1
- package/lib/visitors.js.map +1 -1
- package/lib/walk.d.ts +1 -1
- package/lib/walk.d.ts.map +1 -1
- package/lib/walk.js +4 -2
- package/lib/walk.js.map +1 -1
- package/package.json +8 -3
- package/lib/utils.d.ts +0 -61
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js +0 -204
- package/lib/utils.js.map +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Config } from '../config/config.js';
|
|
2
|
+
import type { NormalizedNodeType, NodeType } from '../types/index.js';
|
|
3
|
+
import type { NormalizedProblem } from '../walk.js';
|
|
4
|
+
import type { Document, BaseResolver } from '../resolve.js';
|
|
5
|
+
export type CoreBundleOptions = {
|
|
6
|
+
externalRefResolver?: BaseResolver;
|
|
7
|
+
config: Config;
|
|
8
|
+
dereference?: boolean;
|
|
9
|
+
base?: string | null;
|
|
10
|
+
removeUnusedComponents?: boolean;
|
|
11
|
+
keepUrlRefs?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type BundleResult = {
|
|
14
|
+
bundle: Document;
|
|
15
|
+
problems: NormalizedProblem[];
|
|
16
|
+
fileDependencies: Set<string>;
|
|
17
|
+
rootType: NormalizedNodeType;
|
|
18
|
+
refTypes?: Map<string, NormalizedNodeType>;
|
|
19
|
+
visitorsData: Record<string, Record<string, unknown>>;
|
|
20
|
+
};
|
|
21
|
+
export declare function bundleDocument(opts: {
|
|
22
|
+
document: Document;
|
|
23
|
+
config: Config;
|
|
24
|
+
types: Record<string, NodeType>;
|
|
25
|
+
externalRefResolver: BaseResolver;
|
|
26
|
+
dereference?: boolean;
|
|
27
|
+
removeUnusedComponents?: boolean;
|
|
28
|
+
keepUrlRefs?: boolean;
|
|
29
|
+
}): Promise<BundleResult>;
|
|
30
|
+
//# sourceMappingURL=bundle-document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-document.d.ts","sourceRoot":"","sources":["../../src/bundle/bundle-document.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAe,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,mBAAmB,CAAC,EAAE,YAAY,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAIF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,QAAQ,CAAC;IACjB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC3C,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACvD,CAAC;AAEF,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAChC,mBAAmB,EAAE,YAAY,CAAC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,OAAO,CAAC,YAAY,CAAC,CA6FxB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { resolveDocument } from '../resolve.js';
|
|
2
|
+
import { normalizeVisitors } from '../visitors.js';
|
|
3
|
+
import { normalizeTypes } from '../types/index.js';
|
|
4
|
+
import { walkDocument } from '../walk.js';
|
|
5
|
+
import { detectSpec, getMajorSpecVersion } from '../detect-spec.js';
|
|
6
|
+
import { initRules } from '../config/rules.js';
|
|
7
|
+
import { RemoveUnusedComponents as RemoveUnusedComponentsOas2 } from '../decorators/oas2/remove-unused-components.js';
|
|
8
|
+
import { RemoveUnusedComponents as RemoveUnusedComponentsOas3 } from '../decorators/oas3/remove-unused-components.js';
|
|
9
|
+
import { makeBundleVisitor } from '../bundle/bundle-visitor.js';
|
|
10
|
+
export async function bundleDocument(opts) {
|
|
11
|
+
const { document, config, types, externalRefResolver, dereference = false, removeUnusedComponents = false, keepUrlRefs = false, } = opts;
|
|
12
|
+
const specVersion = detectSpec(document.parsed);
|
|
13
|
+
const specMajorVersion = getMajorSpecVersion(specVersion);
|
|
14
|
+
const rules = config.getRulesForSpecVersion(specMajorVersion);
|
|
15
|
+
const normalizedTypes = normalizeTypes(config.extendTypes(types, specVersion), config);
|
|
16
|
+
const preprocessors = initRules(rules, config, 'preprocessors', specVersion);
|
|
17
|
+
const decorators = initRules(rules, config, 'decorators', specVersion);
|
|
18
|
+
const ctx = {
|
|
19
|
+
problems: [],
|
|
20
|
+
specVersion,
|
|
21
|
+
config,
|
|
22
|
+
refTypes: new Map(),
|
|
23
|
+
visitorsData: {},
|
|
24
|
+
};
|
|
25
|
+
if (removeUnusedComponents && !decorators.some((d) => d.ruleId === 'remove-unused-components')) {
|
|
26
|
+
decorators.push({
|
|
27
|
+
severity: 'error',
|
|
28
|
+
ruleId: 'remove-unused-components',
|
|
29
|
+
visitor: specMajorVersion === 'oas2'
|
|
30
|
+
? RemoveUnusedComponentsOas2({})
|
|
31
|
+
: RemoveUnusedComponentsOas3({}),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
let resolvedRefMap = await resolveDocument({
|
|
35
|
+
rootDocument: document,
|
|
36
|
+
rootType: normalizedTypes.Root,
|
|
37
|
+
externalRefResolver,
|
|
38
|
+
});
|
|
39
|
+
if (preprocessors.length > 0) {
|
|
40
|
+
// Make additional pass to resolve refs defined in preprocessors.
|
|
41
|
+
walkDocument({
|
|
42
|
+
document,
|
|
43
|
+
rootType: normalizedTypes.Root,
|
|
44
|
+
normalizedVisitors: normalizeVisitors(preprocessors, normalizedTypes),
|
|
45
|
+
resolvedRefMap,
|
|
46
|
+
ctx,
|
|
47
|
+
});
|
|
48
|
+
resolvedRefMap = await resolveDocument({
|
|
49
|
+
rootDocument: document,
|
|
50
|
+
rootType: normalizedTypes.Root,
|
|
51
|
+
externalRefResolver,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const bundleVisitor = normalizeVisitors([
|
|
55
|
+
{
|
|
56
|
+
severity: 'error',
|
|
57
|
+
ruleId: 'bundler',
|
|
58
|
+
visitor: makeBundleVisitor(specMajorVersion, dereference, document, resolvedRefMap, keepUrlRefs),
|
|
59
|
+
},
|
|
60
|
+
...decorators,
|
|
61
|
+
], normalizedTypes);
|
|
62
|
+
walkDocument({
|
|
63
|
+
document,
|
|
64
|
+
rootType: normalizedTypes.Root,
|
|
65
|
+
normalizedVisitors: bundleVisitor,
|
|
66
|
+
resolvedRefMap,
|
|
67
|
+
ctx,
|
|
68
|
+
});
|
|
69
|
+
return {
|
|
70
|
+
bundle: document,
|
|
71
|
+
problems: ctx.problems.map((problem) => config.addProblemToIgnore(problem)),
|
|
72
|
+
fileDependencies: externalRefResolver.getFiles(),
|
|
73
|
+
rootType: normalizedTypes.Root,
|
|
74
|
+
refTypes: ctx.refTypes,
|
|
75
|
+
visitorsData: ctx.visitorsData,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=bundle-document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-document.js","sourceRoot":"","sources":["../../src/bundle/bundle-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,IAAI,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AACtH,OAAO,EAAE,sBAAsB,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QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,YAAY,EAAE,GAAG,CAAC,YAAY;KAC/B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Document } from '../resolve.js';
|
|
2
|
+
import type { ResolvedRefMap } from '../resolve';
|
|
3
|
+
import type { SpecMajorVersion } from '../oas-types';
|
|
4
|
+
import type { Oas3Visitor, Oas2Visitor } from '../visitors';
|
|
5
|
+
export declare function mapTypeToComponent(typeName: string, version: SpecMajorVersion): "responses" | "definitions" | "examples" | "links" | "parameters" | "headers" | "schemas" | "requestBodies" | "securitySchemes" | "callbacks" | null;
|
|
6
|
+
export declare function makeBundleVisitor(version: SpecMajorVersion, dereference: boolean, rootDocument: Document, resolvedRefMap: ResolvedRefMap, keepUrlRefs: boolean): Oas3Visitor | Oas2Visitor;
|
|
7
|
+
//# sourceMappingURL=bundle-visitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-visitor.d.ts","sourceRoot":"","sources":["../../src/bundle/bundle-visitor.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG5D,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,wJAoE7E;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,gBAAgB,EACzB,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,QAAQ,EACtB,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,OAAO,6BA2LrB"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { isAbsoluteUrl, replaceRef, isExternalValue, isRef, refBaseName } from '../ref-utils.js';
|
|
2
|
+
import { makeRefId } from '../utils/make-ref-id.js';
|
|
3
|
+
import { reportUnresolvedRef } from '../rules/common/no-unresolved-refs.js';
|
|
4
|
+
import { isTruthy } from '../utils/is-truthy.js';
|
|
5
|
+
import { dequal } from '../utils/dequal.js';
|
|
6
|
+
export function mapTypeToComponent(typeName, version) {
|
|
7
|
+
switch (version) {
|
|
8
|
+
case 'oas3':
|
|
9
|
+
switch (typeName) {
|
|
10
|
+
case 'Schema':
|
|
11
|
+
return 'schemas';
|
|
12
|
+
case 'Parameter':
|
|
13
|
+
return 'parameters';
|
|
14
|
+
case 'Response':
|
|
15
|
+
return 'responses';
|
|
16
|
+
case 'Example':
|
|
17
|
+
return 'examples';
|
|
18
|
+
case 'RequestBody':
|
|
19
|
+
return 'requestBodies';
|
|
20
|
+
case 'Header':
|
|
21
|
+
return 'headers';
|
|
22
|
+
case 'SecuritySchema':
|
|
23
|
+
return 'securitySchemes';
|
|
24
|
+
case 'Link':
|
|
25
|
+
return 'links';
|
|
26
|
+
case 'Callback':
|
|
27
|
+
return 'callbacks';
|
|
28
|
+
default:
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
case 'oas2':
|
|
32
|
+
switch (typeName) {
|
|
33
|
+
case 'Schema':
|
|
34
|
+
return 'definitions';
|
|
35
|
+
case 'Parameter':
|
|
36
|
+
return 'parameters';
|
|
37
|
+
case 'Response':
|
|
38
|
+
return 'responses';
|
|
39
|
+
default:
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
case 'async2':
|
|
43
|
+
switch (typeName) {
|
|
44
|
+
case 'Schema':
|
|
45
|
+
return 'schemas';
|
|
46
|
+
case 'Parameter':
|
|
47
|
+
return 'parameters';
|
|
48
|
+
default:
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
case 'async3':
|
|
52
|
+
switch (typeName) {
|
|
53
|
+
case 'Schema':
|
|
54
|
+
return 'schemas';
|
|
55
|
+
case 'Parameter':
|
|
56
|
+
return 'parameters';
|
|
57
|
+
default:
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
case 'arazzo1':
|
|
61
|
+
switch (typeName) {
|
|
62
|
+
case 'Root.workflows_items.parameters_items':
|
|
63
|
+
case 'Root.workflows_items.steps_items.parameters_items':
|
|
64
|
+
return 'parameters';
|
|
65
|
+
default:
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
case 'overlay1':
|
|
69
|
+
switch (typeName) {
|
|
70
|
+
default:
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export function makeBundleVisitor(version, dereference, rootDocument, resolvedRefMap, keepUrlRefs) {
|
|
76
|
+
let components;
|
|
77
|
+
let rootLocation;
|
|
78
|
+
const visitor = {
|
|
79
|
+
ref: {
|
|
80
|
+
leave(node, ctx, resolved) {
|
|
81
|
+
if (!resolved.location || resolved.node === undefined) {
|
|
82
|
+
reportUnresolvedRef(resolved, ctx.report, ctx.location);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (resolved.location.source === rootDocument.source &&
|
|
86
|
+
resolved.location.source === ctx.location.source &&
|
|
87
|
+
ctx.type.name !== 'scalar' &&
|
|
88
|
+
!dereference) {
|
|
89
|
+
// Normalize explicit self-file refs to internal pointer
|
|
90
|
+
if (node.$ref !== resolved.location.pointer) {
|
|
91
|
+
node.$ref = resolved.location.pointer;
|
|
92
|
+
}
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (keepUrlRefs && isAbsoluteUrl(node.$ref)) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const componentType = mapTypeToComponent(ctx.type.name, version);
|
|
99
|
+
if (!componentType) {
|
|
100
|
+
replaceRef(node, resolved, ctx);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
if (dereference) {
|
|
104
|
+
saveComponent(componentType, resolved, ctx);
|
|
105
|
+
replaceRef(node, resolved, ctx);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
node.$ref = saveComponent(componentType, resolved, ctx);
|
|
109
|
+
resolveBundledComponent(node, resolved, ctx);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
Example: {
|
|
115
|
+
leave(node, ctx) {
|
|
116
|
+
if (isExternalValue(node) && node.value === undefined) {
|
|
117
|
+
const resolved = ctx.resolve({ $ref: node.externalValue });
|
|
118
|
+
if (!resolved.location || resolved.node === undefined) {
|
|
119
|
+
reportUnresolvedRef(resolved, ctx.report, ctx.location);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (keepUrlRefs && isAbsoluteUrl(node.externalValue)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
node.value = ctx.resolve({ $ref: node.externalValue }).node;
|
|
126
|
+
delete node.externalValue;
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
Root: {
|
|
131
|
+
enter(root, ctx) {
|
|
132
|
+
rootLocation = ctx.location;
|
|
133
|
+
if (version === 'oas3') {
|
|
134
|
+
components = root.components = root.components || {};
|
|
135
|
+
}
|
|
136
|
+
else if (version === 'oas2') {
|
|
137
|
+
components = root;
|
|
138
|
+
}
|
|
139
|
+
else if (version === 'async2') {
|
|
140
|
+
components = root.components = root.components || {};
|
|
141
|
+
}
|
|
142
|
+
else if (version === 'async3') {
|
|
143
|
+
components = root.components = root.components || {};
|
|
144
|
+
}
|
|
145
|
+
else if (version === 'arazzo1') {
|
|
146
|
+
components = root.components = root.components || {};
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
if (version === 'oas3') {
|
|
152
|
+
visitor.DiscriminatorMapping = {
|
|
153
|
+
leave(mapping, ctx) {
|
|
154
|
+
for (const name of Object.keys(mapping)) {
|
|
155
|
+
const $ref = mapping[name];
|
|
156
|
+
const resolved = ctx.resolve({ $ref });
|
|
157
|
+
if (!resolved.location || resolved.node === undefined) {
|
|
158
|
+
reportUnresolvedRef(resolved, ctx.report, ctx.location.child(name));
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const componentType = mapTypeToComponent('Schema', version);
|
|
162
|
+
mapping[name] = saveComponent(componentType, resolved, ctx);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function resolveBundledComponent(node, resolved, ctx) {
|
|
168
|
+
const newRefId = makeRefId(ctx.location.source.absoluteRef, node.$ref);
|
|
169
|
+
resolvedRefMap.set(newRefId, {
|
|
170
|
+
document: rootDocument,
|
|
171
|
+
isRemote: false,
|
|
172
|
+
node: resolved.node,
|
|
173
|
+
nodePointer: node.$ref,
|
|
174
|
+
resolved: true,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
function saveComponent(componentType, target, ctx) {
|
|
178
|
+
components[componentType] = components[componentType] || {};
|
|
179
|
+
const name = getComponentName(target, componentType, ctx);
|
|
180
|
+
components[componentType][name] = target.node;
|
|
181
|
+
if (version === 'oas3' || version === 'async2' || version === 'async3') {
|
|
182
|
+
return `#/components/${componentType}/${name}`;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
return `#/${componentType}/${name}`;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function isEqualOrEqualRef(node, target, ctx) {
|
|
189
|
+
if (isRef(node) &&
|
|
190
|
+
ctx.resolve(node, rootLocation.absolutePointer).location?.absolutePointer ===
|
|
191
|
+
target.location.absolutePointer) {
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
return dequal(node, target.node);
|
|
195
|
+
}
|
|
196
|
+
function getComponentName(target, componentType, ctx) {
|
|
197
|
+
const [fileRef, pointer] = [target.location.source.absoluteRef, target.location.pointer];
|
|
198
|
+
const componentsGroup = components[componentType];
|
|
199
|
+
let name = '';
|
|
200
|
+
const refParts = pointer.slice(2).split('/').filter(isTruthy); // slice(2) removes "#/"
|
|
201
|
+
while (refParts.length > 0) {
|
|
202
|
+
name = refParts.pop() + (name ? `-${name}` : '');
|
|
203
|
+
if (!componentsGroup ||
|
|
204
|
+
!componentsGroup[name] ||
|
|
205
|
+
isEqualOrEqualRef(componentsGroup[name], target, ctx)) {
|
|
206
|
+
return name;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
name = refBaseName(fileRef) + (name ? `_${name}` : '');
|
|
210
|
+
if (!componentsGroup[name] || isEqualOrEqualRef(componentsGroup[name], target, ctx)) {
|
|
211
|
+
return name;
|
|
212
|
+
}
|
|
213
|
+
const prevName = name;
|
|
214
|
+
let serialId = 2;
|
|
215
|
+
while (componentsGroup[name] && !isEqualOrEqualRef(componentsGroup[name], target, ctx)) {
|
|
216
|
+
name = `${prevName}-${serialId}`;
|
|
217
|
+
serialId++;
|
|
218
|
+
}
|
|
219
|
+
if (!componentsGroup[name]) {
|
|
220
|
+
ctx.report({
|
|
221
|
+
message: `Two schemas are referenced with the same name but different content. Renamed ${prevName} to ${name}.`,
|
|
222
|
+
location: ctx.location,
|
|
223
|
+
forceSeverity: 'warn',
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
return name;
|
|
227
|
+
}
|
|
228
|
+
return visitor;
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=bundle-visitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-visitor.js","sourceRoot":"","sources":["../../src/bundle/bundle-visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CA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rD,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAED,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;YACpF,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC;QACtB,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;YACvF,IAAI,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC;YACjC,QAAQ,EAAE,CAAC;QACb,CAAC;QAED,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B,GAAG,CAAC,MAAM,CAAC;gBACT,OAAO,EAAE,gFAAgF,QAAQ,OAAO,IAAI,GAAG;gBAC/G,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,aAAa,EAAE,MAAM;aACtB,CAAC,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseResolver } from './resolve.js';
|
|
2
|
+
import { Config } from './config/config.js';
|
|
3
|
+
import type { Document } from './resolve.js';
|
|
4
|
+
import type { CollectFn } from './types.js';
|
|
5
|
+
export type CoreBundleOptions = {
|
|
6
|
+
externalRefResolver?: BaseResolver;
|
|
7
|
+
config: Config;
|
|
8
|
+
dereference?: boolean;
|
|
9
|
+
base?: string | null;
|
|
10
|
+
removeUnusedComponents?: boolean;
|
|
11
|
+
keepUrlRefs?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function bundleOas(opts: {
|
|
14
|
+
ref?: string;
|
|
15
|
+
doc?: Document;
|
|
16
|
+
collectSpecData?: CollectFn;
|
|
17
|
+
} & CoreBundleOptions): Promise<import("./bundle/bundle-document.js").BundleResult>;
|
|
18
|
+
export declare function loadConfig(options?: {
|
|
19
|
+
configPath?: string;
|
|
20
|
+
customExtends?: string[];
|
|
21
|
+
externalRefResolver?: BaseResolver;
|
|
22
|
+
}): Config;
|
|
23
|
+
//# sourceMappingURL=bundle-oas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-oas.d.ts","sourceRoot":"","sources":["../src/bundle-oas.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAO5C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,mBAAmB,CAAC,EAAE,YAAY,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAsB,SAAS,CAC7B,IAAI,EAAE;IACJ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,eAAe,CAAC,EAAE,SAAS,CAAC;CAC7B,GAAG,iBAAiB,+DA8CtB;AAED,wBAAgB,UAAU,CACxB,OAAO,GAAE;IACP,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,CAAC,EAAE,YAAY,CAAC;CAC/B,UAaP"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Specialized OAS only bundle export for vite bundle
|
|
2
|
+
import { BaseResolver } from './resolve.js';
|
|
3
|
+
import { detectSpec } from './detect-spec.js';
|
|
4
|
+
import { bundleDocument } from './bundle/bundle-document.js';
|
|
5
|
+
import { Oas2Types } from './types/oas2.js';
|
|
6
|
+
import { Oas3Types } from './types/oas3.js';
|
|
7
|
+
import { Oas3_1Types } from './types/oas3_1.js';
|
|
8
|
+
import { Oas3_2Types } from './types/oas3_2.js';
|
|
9
|
+
import { Config } from './config/config.js';
|
|
10
|
+
export async function bundleOas(opts) {
|
|
11
|
+
const { ref, doc, externalRefResolver = new BaseResolver(opts.config.resolve), base = null, } = opts;
|
|
12
|
+
if (!(ref || doc)) {
|
|
13
|
+
throw new Error('Document or reference is required.\n');
|
|
14
|
+
}
|
|
15
|
+
const document = doc === undefined ? await externalRefResolver.resolveDocument(base, ref, true) : doc;
|
|
16
|
+
if (document instanceof Error) {
|
|
17
|
+
throw document;
|
|
18
|
+
}
|
|
19
|
+
opts.collectSpecData?.(document.parsed);
|
|
20
|
+
const version = detectSpec(document.parsed);
|
|
21
|
+
let types;
|
|
22
|
+
switch (version) {
|
|
23
|
+
case 'oas2':
|
|
24
|
+
types = Oas2Types;
|
|
25
|
+
break;
|
|
26
|
+
case 'oas3_0':
|
|
27
|
+
types = Oas3Types;
|
|
28
|
+
break;
|
|
29
|
+
case 'oas3_1':
|
|
30
|
+
types = Oas3_1Types;
|
|
31
|
+
break;
|
|
32
|
+
case 'oas3_2':
|
|
33
|
+
types = Oas3_2Types;
|
|
34
|
+
break;
|
|
35
|
+
default:
|
|
36
|
+
throw new Error(`Unsupported OpenAPI version: ${version}`);
|
|
37
|
+
}
|
|
38
|
+
return bundleDocument({
|
|
39
|
+
document,
|
|
40
|
+
...opts,
|
|
41
|
+
externalRefResolver,
|
|
42
|
+
types,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export function loadConfig(options = {}) {
|
|
46
|
+
return new Config({
|
|
47
|
+
rules: {},
|
|
48
|
+
preprocessors: {},
|
|
49
|
+
decorators: {},
|
|
50
|
+
plugins: [],
|
|
51
|
+
}, {
|
|
52
|
+
configPath: options.configPath,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=bundle-oas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-oas.js","sourceRoot":"","sources":["../src/bundle-oas.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAe5C,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,IAIqB;IAErB,MAAM,EACJ,GAAG,EACH,GAAG,EACH,mBAAmB,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAC3D,IAAI,GAAG,IAAI,GACZ,GAAG,IAAI,CAAC;IACT,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,QAAQ,GACZ,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,mBAAmB,CAAC,eAAe,CAAC,IAAI,EAAE,GAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAExF,IAAI,QAAQ,YAAY,KAAK,EAAE,CAAC;QAC9B,MAAM,QAAQ,CAAC;IACjB,CAAC;IACD,IAAI,CAAC,eAAe,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAExC,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE5C,IAAI,KAA+B,CAAC;IACpC,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,MAAM;YACT,KAAK,GAAG,SAAS,CAAC;YAClB,MAAM;QACR,KAAK,QAAQ;YACX,KAAK,GAAG,SAAS,CAAC;YAClB,MAAM;QACR,KAAK,QAAQ;YACX,KAAK,GAAG,WAAW,CAAC;YACpB,MAAM;QACR,KAAK,QAAQ;YACX,KAAK,GAAG,WAAW,CAAC;YACpB,MAAM;QACR;YACE,MAAM,IAAI,KAAK,CAAC,gCAAgC,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,cAAc,CAAC;QACpB,QAAQ;QACR,GAAG,IAAI;QACP,mBAAmB;QACnB,KAAK;KACN,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,UAII,EAAE;IAEN,OAAO,IAAI,MAAM,CACf;QACE,KAAK,EAAE,EAAE;QACT,aAAa,EAAE,EAAE;QACjB,UAAU,EAAE,EAAE;QACd,OAAO,EAAE,EAAE;KACZ,EACD;QACE,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CACF,CAAC;AACJ,CAAC"}
|
package/lib/bundle.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { BaseResolver } from './resolve.js';
|
|
2
|
-
import { type SpecMajorVersion } from './oas-types.js';
|
|
3
2
|
import { type Config } from './config/config.js';
|
|
4
3
|
import type { Plugin, ResolvedConfig } from './config/types.js';
|
|
5
|
-
import type { NormalizedNodeType
|
|
4
|
+
import type { NormalizedNodeType } from './types/index.js';
|
|
6
5
|
import type { NormalizedProblem } from './walk.js';
|
|
7
6
|
import type { Document, ResolvedRefMap } from './resolve.js';
|
|
8
|
-
import type { CollectFn } from './
|
|
7
|
+
import type { CollectFn } from './types.js';
|
|
9
8
|
export type CoreBundleOptions = {
|
|
10
9
|
externalRefResolver?: BaseResolver;
|
|
11
10
|
config: Config;
|
|
@@ -20,11 +19,11 @@ export declare function bundle(opts: {
|
|
|
20
19
|
ref?: string;
|
|
21
20
|
doc?: Document;
|
|
22
21
|
collectSpecData?: CollectFn;
|
|
23
|
-
} & CoreBundleOptions): Promise<BundleResult>;
|
|
22
|
+
} & CoreBundleOptions): Promise<import("./bundle/bundle-document.js").BundleResult>;
|
|
24
23
|
export declare function bundleFromString(opts: {
|
|
25
24
|
source: string;
|
|
26
25
|
absoluteRef?: string;
|
|
27
|
-
} & CoreBundleOptions): Promise<BundleResult>;
|
|
26
|
+
} & CoreBundleOptions): Promise<import("./bundle/bundle-document.js").BundleResult>;
|
|
28
27
|
export type BundleResult = {
|
|
29
28
|
bundle: Document;
|
|
30
29
|
problems: NormalizedProblem[];
|
|
@@ -33,14 +32,4 @@ export type BundleResult = {
|
|
|
33
32
|
refTypes?: Map<string, NormalizedNodeType>;
|
|
34
33
|
visitorsData: Record<string, Record<string, unknown>>;
|
|
35
34
|
};
|
|
36
|
-
export declare function bundleDocument(opts: {
|
|
37
|
-
document: Document;
|
|
38
|
-
config: Config;
|
|
39
|
-
customTypes?: Record<string, NodeType>;
|
|
40
|
-
externalRefResolver: BaseResolver;
|
|
41
|
-
dereference?: boolean;
|
|
42
|
-
removeUnusedComponents?: boolean;
|
|
43
|
-
keepUrlRefs?: boolean;
|
|
44
|
-
}): Promise<BundleResult>;
|
|
45
|
-
export declare function mapTypeToComponent(typeName: string, version: SpecMajorVersion): "responses" | "definitions" | "links" | "examples" | "parameters" | "headers" | "schemas" | "requestBodies" | "securitySchemes" | "callbacks" | null;
|
|
46
35
|
//# sourceMappingURL=bundle.d.ts.map
|
package/lib/bundle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0B,MAAM,cAAc,CAAC;AAKpE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAMjD,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAe,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,mBAAmB,CAAC,EAAE,YAAY,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,MAAM,yEAqBtB;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,MAAM,EAAE,GAChB,cAAc,CAoBhB;AAED,wBAAsB,MAAM,CAC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