openapi-typesafe 1.0.0-rc.2 → 1.0.0-rc.4
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/CHANGELOG.md +1831 -0
- package/dist/adapters/node-deprecations/node-deprecations.cjs +14 -0
- package/dist/adapters/node-deprecations/node-deprecations.cjs.map +1 -0
- package/dist/adapters/node-deprecations/node-deprecations.mjs +12 -0
- package/dist/adapters/node-deprecations/node-deprecations.mjs.map +1 -0
- package/dist/adapters/node-file-system/file-claims.cjs +105 -0
- package/dist/adapters/node-file-system/file-claims.cjs.map +1 -0
- package/dist/adapters/node-file-system/file-claims.mjs +95 -0
- package/dist/adapters/node-file-system/file-claims.mjs.map +1 -0
- package/dist/adapters/node-file-system/file-identity.cjs +82 -0
- package/dist/adapters/node-file-system/file-identity.cjs.map +1 -0
- package/dist/adapters/node-file-system/file-identity.mjs +74 -0
- package/dist/adapters/node-file-system/file-identity.mjs.map +1 -0
- package/dist/adapters/node-file-system/node-file-system.cjs +90 -14
- package/dist/adapters/node-file-system/node-file-system.cjs.map +1 -1
- package/dist/adapters/node-file-system/node-file-system.mjs +90 -14
- package/dist/adapters/node-file-system/node-file-system.mjs.map +1 -1
- package/dist/adapters/redocly-loader/bundled-mapping-copies.cjs +75 -0
- package/dist/adapters/redocly-loader/bundled-mapping-copies.cjs.map +1 -0
- package/dist/adapters/redocly-loader/bundled-mapping-copies.mjs +72 -0
- package/dist/adapters/redocly-loader/bundled-mapping-copies.mjs.map +1 -0
- package/dist/adapters/redocly-loader/bundled-ref-repair.cjs +1 -1
- package/dist/adapters/redocly-loader/bundled-ref-repair.cjs.map +1 -1
- package/dist/adapters/redocly-loader/bundled-ref-repair.mjs +2 -2
- package/dist/adapters/redocly-loader/bundled-ref-repair.mjs.map +1 -1
- package/dist/adapters/redocly-loader/loaded-documents.cjs +28 -0
- package/dist/adapters/redocly-loader/loaded-documents.cjs.map +1 -0
- package/dist/adapters/redocly-loader/loaded-documents.mjs +21 -0
- package/dist/adapters/redocly-loader/loaded-documents.mjs.map +1 -0
- package/dist/adapters/redocly-loader/redocly-schema-loader.cjs +14 -15
- package/dist/adapters/redocly-loader/redocly-schema-loader.cjs.map +1 -1
- package/dist/adapters/redocly-loader/redocly-schema-loader.mjs +12 -13
- package/dist/adapters/redocly-loader/redocly-schema-loader.mjs.map +1 -1
- package/dist/adapters/redocly-loader/ref-access.cjs +31 -3
- package/dist/adapters/redocly-loader/ref-access.cjs.map +1 -1
- package/dist/adapters/redocly-loader/ref-access.mjs +31 -3
- package/dist/adapters/redocly-loader/ref-access.mjs.map +1 -1
- package/dist/adapters/redocly-loader/ref-holders.cjs +2 -2
- package/dist/adapters/redocly-loader/ref-holders.cjs.map +1 -1
- package/dist/adapters/redocly-loader/ref-holders.mjs +3 -3
- package/dist/adapters/redocly-loader/ref-holders.mjs.map +1 -1
- package/dist/adapters/redocly-loader/remote-body-limit.cjs +50 -0
- package/dist/adapters/redocly-loader/remote-body-limit.cjs.map +1 -0
- package/dist/adapters/redocly-loader/remote-body-limit.mjs +48 -0
- package/dist/adapters/redocly-loader/remote-body-limit.mjs.map +1 -0
- package/dist/adapters/redocly-loader/remote-fetch.cjs +35 -6
- package/dist/adapters/redocly-loader/remote-fetch.cjs.map +1 -1
- package/dist/adapters/redocly-loader/remote-fetch.mjs +35 -6
- package/dist/adapters/redocly-loader/remote-fetch.mjs.map +1 -1
- package/dist/adapters/redocly-loader/remote-node-limit.cjs +47 -0
- package/dist/adapters/redocly-loader/remote-node-limit.cjs.map +1 -0
- package/dist/adapters/redocly-loader/remote-node-limit.mjs +44 -0
- package/dist/adapters/redocly-loader/remote-node-limit.mjs.map +1 -0
- package/dist/adapters/redocly-loader/schema-load-errors.cjs +32 -8
- package/dist/adapters/redocly-loader/schema-load-errors.cjs.map +1 -1
- package/dist/adapters/redocly-loader/schema-load-errors.mjs +32 -9
- package/dist/adapters/redocly-loader/schema-load-errors.mjs.map +1 -1
- package/dist/adapters/redocly-loader/schema-source.cjs +11 -7
- package/dist/adapters/redocly-loader/schema-source.cjs.map +1 -1
- package/dist/adapters/redocly-loader/schema-source.mjs +12 -8
- package/dist/adapters/redocly-loader/schema-source.mjs.map +1 -1
- package/dist/adapters/redocly-loader/unsupported-keys.cjs +3 -5
- package/dist/adapters/redocly-loader/unsupported-keys.cjs.map +1 -1
- package/dist/adapters/redocly-loader/unsupported-keys.mjs +3 -5
- package/dist/adapters/redocly-loader/unsupported-keys.mjs.map +1 -1
- package/dist/adapters/terminal-logger/terminal-logger.cjs +6 -4
- package/dist/adapters/terminal-logger/terminal-logger.cjs.map +1 -1
- package/dist/adapters/terminal-logger/terminal-logger.mjs +6 -4
- package/dist/adapters/terminal-logger/terminal-logger.mjs.map +1 -1
- package/dist/api/default-ports.cjs +19 -2
- package/dist/api/default-ports.cjs.map +1 -1
- package/dist/api/default-ports.mjs +19 -3
- package/dist/api/default-ports.mjs.map +1 -1
- package/dist/api/discriminator-conflict-warnings.cjs +1 -1
- package/dist/api/discriminator-conflict-warnings.cjs.map +1 -1
- package/dist/api/discriminator-conflict-warnings.mjs +2 -2
- package/dist/api/discriminator-conflict-warnings.mjs.map +1 -1
- package/dist/api/discriminator-enum-parent.cjs +2 -2
- package/dist/api/discriminator-enum-parent.cjs.map +1 -1
- package/dist/api/discriminator-enum-parent.mjs +3 -3
- package/dist/api/discriminator-enum-parent.mjs.map +1 -1
- package/dist/api/discriminator-other-owners.cjs +5 -3
- package/dist/api/discriminator-other-owners.cjs.map +1 -1
- package/dist/api/discriminator-other-owners.mjs +5 -3
- package/dist/api/discriminator-other-owners.mjs.map +1 -1
- package/dist/api/discriminator-patch.cjs +8 -4
- package/dist/api/discriminator-patch.cjs.map +1 -1
- package/dist/api/discriminator-patch.mjs +9 -5
- package/dist/api/discriminator-patch.mjs.map +1 -1
- package/dist/api/discriminator-scan.cjs +17 -10
- package/dist/api/discriminator-scan.cjs.map +1 -1
- package/dist/api/discriminator-scan.mjs +18 -11
- package/dist/api/discriminator-scan.mjs.map +1 -1
- package/dist/api/document-run.cjs +4 -3
- package/dist/api/document-run.cjs.map +1 -1
- package/dist/api/document-run.mjs +4 -3
- package/dist/api/document-run.mjs.map +1 -1
- package/dist/api/legacy-callback-warning.cjs +7 -4
- package/dist/api/legacy-callback-warning.cjs.map +1 -1
- package/dist/api/legacy-callback-warning.mjs +8 -5
- package/dist/api/legacy-callback-warning.mjs.map +1 -1
- package/dist/api/legacy-utils.cjs.map +1 -1
- package/dist/api/legacy-utils.mjs.map +1 -1
- package/dist/api/openapi-ts.cjs +9 -5
- package/dist/api/openapi-ts.cjs.map +1 -1
- package/dist/api/openapi-ts.mjs +10 -7
- package/dist/api/openapi-ts.mjs.map +1 -1
- package/dist/api/schema-callbacks.cjs +36 -12
- package/dist/api/schema-callbacks.cjs.map +1 -1
- package/dist/api/schema-callbacks.mjs +36 -12
- package/dist/api/schema-callbacks.mjs.map +1 -1
- package/dist/api/string-to-ast.cjs +7 -9
- package/dist/api/string-to-ast.cjs.map +1 -1
- package/dist/api/string-to-ast.mjs +8 -9
- package/dist/api/string-to-ast.mjs.map +1 -1
- package/dist/api/transform-context.cjs +7 -3
- package/dist/api/transform-context.cjs.map +1 -1
- package/dist/api/transform-context.mjs +7 -3
- package/dist/api/transform-context.mjs.map +1 -1
- package/dist/api/transform-schema.cjs +42 -12
- package/dist/api/transform-schema.cjs.map +1 -1
- package/dist/api/transform-schema.mjs +44 -14
- package/dist/api/transform-schema.mjs.map +1 -1
- package/dist/application/print/text-writer.cjs +10 -3
- package/dist/application/print/text-writer.cjs.map +1 -1
- package/dist/application/print/text-writer.mjs +10 -3
- package/dist/application/print/text-writer.mjs.map +1 -1
- package/dist/application/stack-overflow.cjs +2 -1
- package/dist/application/stack-overflow.cjs.map +1 -1
- package/dist/application/stack-overflow.mjs +2 -1
- package/dist/application/stack-overflow.mjs.map +1 -1
- package/dist/application/transform/document/components.cjs +2 -2
- package/dist/application/transform/document/components.cjs.map +1 -1
- package/dist/application/transform/document/components.mjs +4 -4
- package/dist/application/transform/document/components.mjs.map +1 -1
- package/dist/application/transform/document/declared-type-names.cjs +23 -0
- package/dist/application/transform/document/declared-type-names.cjs.map +1 -0
- package/dist/application/transform/document/declared-type-names.mjs +20 -0
- package/dist/application/transform/document/declared-type-names.mjs.map +1 -0
- package/dist/application/transform/document/defs-root.cjs +1 -1
- package/dist/application/transform/document/defs-root.cjs.map +1 -1
- package/dist/application/transform/document/defs-root.mjs +2 -2
- package/dist/application/transform/document/defs-root.mjs.map +1 -1
- package/dist/application/transform/document/document.cjs +4 -1
- package/dist/application/transform/document/document.cjs.map +1 -1
- package/dist/application/transform/document/document.mjs +3 -2
- package/dist/application/transform/document/document.mjs.map +1 -1
- package/dist/application/transform/document/enum-names-given-back.cjs +62 -0
- package/dist/application/transform/document/enum-names-given-back.cjs.map +1 -0
- package/dist/application/transform/document/enum-names-given-back.mjs +58 -0
- package/dist/application/transform/document/enum-names-given-back.mjs.map +1 -0
- package/dist/application/transform/document/global-type-references.cjs +1 -0
- package/dist/application/transform/document/global-type-references.cjs.map +1 -1
- package/dist/application/transform/document/global-type-references.mjs +1 -1
- package/dist/application/transform/document/global-type-references.mjs.map +1 -1
- package/dist/application/transform/document/media-type.cjs +2 -2
- package/dist/application/transform/document/media-type.cjs.map +1 -1
- package/dist/application/transform/document/media-type.mjs +3 -3
- package/dist/application/transform/document/media-type.mjs.map +1 -1
- package/dist/application/transform/document/operation-keys-written.cjs +26 -0
- package/dist/application/transform/document/operation-keys-written.cjs.map +1 -0
- package/dist/application/transform/document/operation-keys-written.mjs +24 -0
- package/dist/application/transform/document/operation-keys-written.mjs.map +1 -0
- package/dist/application/transform/document/operation.cjs +1 -1
- package/dist/application/transform/document/operation.cjs.map +1 -1
- package/dist/application/transform/document/operation.mjs +2 -2
- package/dist/application/transform/document/operation.mjs.map +1 -1
- package/dist/application/transform/document/parameter-entries.cjs +34 -0
- package/dist/application/transform/document/parameter-entries.cjs.map +1 -0
- package/dist/application/transform/document/parameter-entries.mjs +30 -0
- package/dist/application/transform/document/parameter-entries.mjs.map +1 -0
- package/dist/application/transform/document/parameter.cjs +12 -4
- package/dist/application/transform/document/parameter.cjs.map +1 -1
- package/dist/application/transform/document/parameter.mjs +13 -5
- package/dist/application/transform/document/parameter.mjs.map +1 -1
- package/dist/application/transform/document/parameters.cjs +7 -30
- package/dist/application/transform/document/parameters.cjs.map +1 -1
- package/dist/application/transform/document/parameters.mjs +8 -31
- package/dist/application/transform/document/parameters.mjs.map +1 -1
- package/dist/application/transform/document/path-item.cjs +11 -14
- package/dist/application/transform/document/path-item.cjs.map +1 -1
- package/dist/application/transform/document/path-item.mjs +12 -16
- package/dist/application/transform/document/path-item.mjs.map +1 -1
- package/dist/application/transform/document/paths-enum.cjs +1 -0
- package/dist/application/transform/document/paths-enum.cjs.map +1 -1
- package/dist/application/transform/document/paths-enum.mjs +1 -1
- package/dist/application/transform/document/paths-enum.mjs.map +1 -1
- package/dist/application/transform/document/paths.cjs +6 -2
- package/dist/application/transform/document/paths.cjs.map +1 -1
- package/dist/application/transform/document/paths.mjs +8 -4
- package/dist/application/transform/document/paths.mjs.map +1 -1
- package/dist/application/transform/document/referenced-parameter.cjs +80 -0
- package/dist/application/transform/document/referenced-parameter.cjs.map +1 -0
- package/dist/application/transform/document/referenced-parameter.mjs +78 -0
- package/dist/application/transform/document/referenced-parameter.mjs.map +1 -0
- package/dist/application/transform/document/request-body.cjs +1 -1
- package/dist/application/transform/document/request-body.cjs.map +1 -1
- package/dist/application/transform/document/request-body.mjs +2 -2
- package/dist/application/transform/document/request-body.mjs.map +1 -1
- package/dist/application/transform/document/response.cjs +2 -2
- package/dist/application/transform/document/response.cjs.map +1 -1
- package/dist/application/transform/document/response.mjs +3 -3
- package/dist/application/transform/document/response.mjs.map +1 -1
- package/dist/application/transform/document/responses.cjs +1 -1
- package/dist/application/transform/document/responses.cjs.map +1 -1
- package/dist/application/transform/document/responses.mjs +2 -2
- package/dist/application/transform/document/responses.mjs.map +1 -1
- package/dist/application/transform/document/root-type-aliases.cjs +8 -23
- package/dist/application/transform/document/root-type-aliases.cjs.map +1 -1
- package/dist/application/transform/document/root-type-aliases.mjs +8 -24
- package/dist/application/transform/document/root-type-aliases.mjs.map +1 -1
- package/dist/application/transform/document/type-resolution.cjs +3 -1
- package/dist/application/transform/document/type-resolution.cjs.map +1 -1
- package/dist/application/transform/document/type-resolution.mjs +3 -1
- package/dist/application/transform/document/type-resolution.mjs.map +1 -1
- package/dist/application/transform/document/webhooks.cjs +1 -1
- package/dist/application/transform/document/webhooks.cjs.map +1 -1
- package/dist/application/transform/document/webhooks.mjs +2 -2
- package/dist/application/transform/document/webhooks.mjs.map +1 -1
- package/dist/application/transform/footer/document-footer.cjs +10 -2
- package/dist/application/transform/footer/document-footer.cjs.map +1 -1
- package/dist/application/transform/footer/document-footer.mjs +10 -2
- package/dist/application/transform/footer/document-footer.mjs.map +1 -1
- package/dist/application/transform/footer/enum-name-claims.cjs +48 -0
- package/dist/application/transform/footer/enum-name-claims.cjs.map +1 -0
- package/dist/application/transform/footer/enum-name-claims.mjs +46 -0
- package/dist/application/transform/footer/enum-name-claims.mjs.map +1 -0
- package/dist/application/transform/footer/operation-keys.cjs +23 -0
- package/dist/application/transform/footer/operation-keys.cjs.map +1 -0
- package/dist/application/transform/footer/operation-keys.mjs +21 -0
- package/dist/application/transform/footer/operation-keys.mjs.map +1 -0
- package/dist/application/transform/footer/type-evaluation.cjs +4 -4
- package/dist/application/transform/footer/type-evaluation.cjs.map +1 -1
- package/dist/application/transform/footer/type-evaluation.mjs +4 -4
- package/dist/application/transform/footer/type-evaluation.mjs.map +1 -1
- package/dist/application/transform/helper-types.cjs +1 -1
- package/dist/application/transform/helper-types.cjs.map +1 -1
- package/dist/application/transform/helper-types.mjs +1 -1
- package/dist/application/transform/helper-types.mjs.map +1 -1
- package/dist/application/transform/numbered-names.cjs +9 -0
- package/dist/application/transform/numbered-names.cjs.map +1 -1
- package/dist/application/transform/numbered-names.mjs +9 -1
- package/dist/application/transform/numbered-names.mjs.map +1 -1
- package/dist/application/transform/ref-pointer/generated-location.cjs +1 -1
- package/dist/application/transform/ref-pointer/generated-location.cjs.map +1 -1
- package/dist/application/transform/ref-pointer/generated-location.mjs +2 -2
- package/dist/application/transform/ref-pointer/generated-location.mjs.map +1 -1
- package/dist/application/transform/ref-pointer/pointer-type.cjs +1 -1
- package/dist/application/transform/ref-pointer/pointer-type.cjs.map +1 -1
- package/dist/application/transform/ref-pointer/pointer-type.mjs +2 -2
- package/dist/application/transform/ref-pointer/pointer-type.mjs.map +1 -1
- package/dist/application/transform/ref-type.cjs +2 -1
- package/dist/application/transform/ref-type.cjs.map +1 -1
- package/dist/application/transform/ref-type.mjs +2 -1
- package/dist/application/transform/ref-type.mjs.map +1 -1
- package/dist/application/transform/schema/access-flags.cjs +1 -1
- package/dist/application/transform/schema/access-flags.cjs.map +1 -1
- package/dist/application/transform/schema/access-flags.mjs +2 -2
- package/dist/application/transform/schema/access-flags.mjs.map +1 -1
- package/dist/application/transform/schema/array-type.cjs +2 -2
- package/dist/application/transform/schema/array-type.cjs.map +1 -1
- package/dist/application/transform/schema/array-type.mjs +3 -3
- package/dist/application/transform/schema/array-type.mjs.map +1 -1
- package/dist/application/transform/schema/composition-type.cjs +4 -4
- package/dist/application/transform/schema/composition-type.cjs.map +1 -1
- package/dist/application/transform/schema/composition-type.mjs +6 -6
- package/dist/application/transform/schema/composition-type.mjs.map +1 -1
- package/dist/application/transform/schema/enum-rule.cjs +4 -6
- package/dist/application/transform/schema/enum-rule.cjs.map +1 -1
- package/dist/application/transform/schema/enum-rule.mjs +6 -8
- package/dist/application/transform/schema/enum-rule.mjs.map +1 -1
- package/dist/application/transform/schema/object-type.cjs +3 -3
- package/dist/application/transform/schema/object-type.cjs.map +1 -1
- package/dist/application/transform/schema/object-type.mjs +4 -4
- package/dist/application/transform/schema/object-type.mjs.map +1 -1
- package/dist/application/transform/schema/presence-members.cjs +1 -1
- package/dist/application/transform/schema/presence-members.cjs.map +1 -1
- package/dist/application/transform/schema/presence-members.mjs +2 -2
- package/dist/application/transform/schema/presence-members.mjs.map +1 -1
- package/dist/application/transform/schema/ref-siblings.cjs +47 -0
- package/dist/application/transform/schema/ref-siblings.cjs.map +1 -0
- package/dist/application/transform/schema/ref-siblings.mjs +45 -0
- package/dist/application/transform/schema/ref-siblings.mjs.map +1 -0
- package/dist/application/transform/schema/required-variants.cjs +2 -2
- package/dist/application/transform/schema/required-variants.cjs.map +1 -1
- package/dist/application/transform/schema/required-variants.mjs +3 -3
- package/dist/application/transform/schema/required-variants.mjs.map +1 -1
- package/dist/application/transform/schema/schema-transform.cjs +4 -2
- package/dist/application/transform/schema/schema-transform.cjs.map +1 -1
- package/dist/application/transform/schema/schema-transform.mjs +4 -2
- package/dist/application/transform/schema/schema-transform.mjs.map +1 -1
- package/dist/application/transform/schema/unevaluated-properties.cjs +1 -1
- package/dist/application/transform/schema/unevaluated-properties.cjs.map +1 -1
- package/dist/application/transform/schema/unevaluated-properties.mjs +2 -2
- package/dist/application/transform/schema/unevaluated-properties.mjs.map +1 -1
- package/dist/application/transform/schema-comment.cjs +6 -2
- package/dist/application/transform/schema-comment.cjs.map +1 -1
- package/dist/application/transform/schema-comment.mjs +7 -3
- package/dist/application/transform/schema-comment.mjs.map +1 -1
- package/dist/cli/api-settings.cjs +62 -6
- package/dist/cli/api-settings.cjs.map +1 -1
- package/dist/cli/api-settings.mjs +60 -7
- package/dist/cli/api-settings.mjs.map +1 -1
- package/dist/cli/api-writes.cjs +72 -0
- package/dist/cli/api-writes.cjs.map +1 -0
- package/dist/cli/api-writes.mjs +69 -0
- package/dist/cli/api-writes.mjs.map +1 -0
- package/dist/cli/cli-errors.cjs +12 -1
- package/dist/cli/cli-errors.cjs.map +1 -1
- package/dist/cli/cli-errors.mjs +12 -1
- package/dist/cli/cli-errors.mjs.map +1 -1
- package/dist/cli/cli-output.cjs +106 -1
- package/dist/cli/cli-output.cjs.map +1 -1
- package/dist/cli/cli-output.mjs +99 -2
- package/dist/cli/cli-output.mjs.map +1 -1
- package/dist/cli/main.cjs +5 -1
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.mjs +6 -2
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/redocly-apis.cjs +82 -36
- package/dist/cli/redocly-apis.cjs.map +1 -1
- package/dist/cli/redocly-apis.mjs +85 -39
- package/dist/cli/redocly-apis.mjs.map +1 -1
- package/dist/cli/run-cli.cjs +13 -7
- package/dist/cli/run-cli.cjs.map +1 -1
- package/dist/cli/run-cli.mjs +14 -8
- package/dist/cli/run-cli.mjs.map +1 -1
- package/dist/domain/append-all.cjs +10 -0
- package/dist/domain/append-all.cjs.map +1 -0
- package/dist/domain/append-all.mjs +8 -0
- package/dist/domain/append-all.mjs.map +1 -0
- package/dist/domain/cause-secrets.cjs +37 -0
- package/dist/domain/cause-secrets.cjs.map +1 -0
- package/dist/domain/cause-secrets.mjs +35 -0
- package/dist/domain/cause-secrets.mjs.map +1 -0
- package/dist/domain/deprecations.cjs +11 -0
- package/dist/domain/deprecations.cjs.map +1 -0
- package/dist/domain/deprecations.mjs +9 -0
- package/dist/domain/deprecations.mjs.map +1 -0
- package/dist/domain/errors.cjs +9 -3
- package/dist/domain/errors.cjs.map +1 -1
- package/dist/domain/errors.mjs +9 -3
- package/dist/domain/errors.mjs.map +1 -1
- package/dist/domain/ir/identifier-text.cjs.map +1 -1
- package/dist/domain/ir/identifier-text.mjs +1 -1
- package/dist/domain/ir/identifier-text.mjs.map +1 -1
- package/dist/domain/ir/ir-shape.cjs +187 -0
- package/dist/domain/ir/ir-shape.cjs.map +1 -0
- package/dist/domain/ir/ir-shape.mjs +184 -0
- package/dist/domain/ir/ir-shape.mjs.map +1 -0
- package/dist/domain/ir/newer-identifier-ranges.cjs +182 -29
- package/dist/domain/ir/newer-identifier-ranges.cjs.map +1 -1
- package/dist/domain/ir/newer-identifier-ranges.mjs +182 -29
- package/dist/domain/ir/newer-identifier-ranges.mjs.map +1 -1
- package/dist/domain/openapi/alias-expansion.cjs +3 -1
- package/dist/domain/openapi/alias-expansion.cjs.map +1 -1
- package/dist/domain/openapi/alias-expansion.mjs +3 -1
- package/dist/domain/openapi/alias-expansion.mjs.map +1 -1
- package/dist/domain/openapi/discriminated-union.cjs +3 -3
- package/dist/domain/openapi/discriminated-union.cjs.map +1 -1
- package/dist/domain/openapi/discriminated-union.mjs +4 -4
- package/dist/domain/openapi/discriminated-union.mjs.map +1 -1
- package/dist/domain/openapi/discriminator-conflicts.cjs +10 -6
- package/dist/domain/openapi/discriminator-conflicts.cjs.map +1 -1
- package/dist/domain/openapi/discriminator-conflicts.mjs +11 -7
- package/dist/domain/openapi/discriminator-conflicts.mjs.map +1 -1
- package/dist/domain/openapi/json-pointer.cjs +43 -1
- package/dist/domain/openapi/json-pointer.cjs.map +1 -1
- package/dist/domain/openapi/json-pointer.mjs +40 -2
- package/dist/domain/openapi/json-pointer.mjs.map +1 -1
- package/dist/domain/openapi/schema-dialect.cjs +15 -0
- package/dist/domain/openapi/schema-dialect.cjs.map +1 -0
- package/dist/domain/openapi/schema-dialect.mjs +12 -0
- package/dist/domain/openapi/schema-dialect.mjs.map +1 -0
- package/dist/domain/openapi/unsupported-features.cjs +1 -1
- package/dist/domain/openapi/unsupported-features.cjs.map +1 -1
- package/dist/domain/openapi/unsupported-features.mjs +2 -2
- package/dist/domain/openapi/unsupported-features.mjs.map +1 -1
- package/dist/domain/output-fixes.cjs +25 -14
- package/dist/domain/output-fixes.cjs.map +1 -1
- package/dist/domain/output-fixes.mjs +25 -13
- package/dist/domain/output-fixes.mjs.map +1 -1
- package/dist/domain/url-secrets.cjs +48 -0
- package/dist/domain/url-secrets.cjs.map +1 -0
- package/dist/domain/url-secrets.mjs +45 -0
- package/dist/domain/url-secrets.mjs.map +1 -0
- package/dist/domain/warnings.cjs +0 -1
- package/dist/domain/warnings.cjs.map +1 -1
- package/dist/domain/warnings.mjs +0 -1
- package/dist/domain/warnings.mjs.map +1 -1
- package/dist/index.cjs +2 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +57 -20
- package/dist/index.d.mts +57 -20
- package/dist/index.d.ts +57 -20
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -6
- package/src/adapters/node-deprecations/node-deprecations.ts +14 -0
- package/src/adapters/node-file-system/file-claims.ts +138 -0
- package/src/adapters/node-file-system/file-identity.ts +137 -0
- package/src/adapters/node-file-system/node-file-system.ts +145 -18
- package/src/adapters/redocly-loader/bundled-mapping-copies.ts +95 -0
- package/src/adapters/redocly-loader/bundled-ref-repair.ts +2 -2
- package/src/adapters/redocly-loader/loaded-documents.ts +46 -0
- package/src/adapters/redocly-loader/redocly-schema-loader.ts +18 -24
- package/src/adapters/redocly-loader/ref-access.ts +37 -3
- package/src/adapters/redocly-loader/ref-holders.ts +3 -3
- package/src/adapters/redocly-loader/remote-body-limit.ts +66 -0
- package/src/adapters/redocly-loader/remote-fetch.ts +74 -11
- package/src/adapters/redocly-loader/remote-node-limit.ts +62 -0
- package/src/adapters/redocly-loader/schema-load-errors.ts +52 -13
- package/src/adapters/redocly-loader/schema-source.ts +20 -8
- package/src/adapters/redocly-loader/unsupported-keys.ts +3 -7
- package/src/adapters/terminal-logger/terminal-logger.ts +10 -5
- package/src/api/default-ports.ts +40 -4
- package/src/api/discriminator-conflict-warnings.ts +2 -2
- package/src/api/discriminator-enum-parent.ts +3 -3
- package/src/api/discriminator-other-owners.ts +5 -3
- package/src/api/discriminator-patch.ts +9 -6
- package/src/api/discriminator-scan.ts +19 -11
- package/src/api/document-run.ts +9 -3
- package/src/api/legacy-callback-warning.ts +13 -6
- package/src/api/legacy-utils.ts +5 -1
- package/src/api/openapi-ts.ts +26 -7
- package/src/api/run-context.ts +6 -0
- package/src/api/schema-callbacks.ts +60 -17
- package/src/api/string-to-ast.ts +11 -15
- package/src/api/transform-context.ts +7 -3
- package/src/api/transform-schema.ts +67 -15
- package/src/application/ports/deprecation-reporter.ts +9 -0
- package/src/application/ports/file-system.ts +39 -0
- package/src/application/ports/schema-loader.ts +11 -1
- package/src/application/print/text-writer.ts +10 -3
- package/src/application/stack-overflow.ts +9 -5
- package/src/application/transform/document/components.ts +4 -4
- package/src/application/transform/document/declared-type-names.ts +36 -0
- package/src/application/transform/document/defs-root.ts +2 -2
- package/src/application/transform/document/document.ts +4 -3
- package/src/application/transform/document/enum-names-given-back.ts +91 -0
- package/src/application/transform/document/global-type-references.ts +1 -1
- package/src/application/transform/document/media-type.ts +4 -3
- package/src/application/transform/document/operation-keys-written.ts +27 -0
- package/src/application/transform/document/operation.ts +2 -2
- package/src/application/transform/document/parameter-entries.ts +70 -0
- package/src/application/transform/document/parameter.ts +21 -9
- package/src/application/transform/document/parameters.ts +13 -58
- package/src/application/transform/document/path-item.ts +13 -31
- package/src/application/transform/document/paths-enum.ts +1 -1
- package/src/application/transform/document/paths.ts +8 -4
- package/src/application/transform/document/referenced-parameter.ts +146 -0
- package/src/application/transform/document/request-body.ts +2 -2
- package/src/application/transform/document/response.ts +3 -3
- package/src/application/transform/document/responses.ts +2 -2
- package/src/application/transform/document/root-type-aliases.ts +17 -38
- package/src/application/transform/document/type-resolution.ts +2 -1
- package/src/application/transform/document/webhooks.ts +2 -2
- package/src/application/transform/footer/document-footer.ts +18 -1
- package/src/application/transform/footer/enum-name-claims.ts +62 -0
- package/src/application/transform/footer/operation-keys.ts +28 -0
- package/src/application/transform/footer/type-evaluation.ts +4 -4
- package/src/application/transform/helper-types.ts +6 -5
- package/src/application/transform/numbered-names.ts +15 -0
- package/src/application/transform/ref-pointer/generated-location.ts +2 -2
- package/src/application/transform/ref-pointer/pointer-type.ts +2 -4
- package/src/application/transform/ref-type.ts +2 -1
- package/src/application/transform/schema/access-flags.ts +2 -2
- package/src/application/transform/schema/array-type.ts +3 -5
- package/src/application/transform/schema/composition-type.ts +6 -6
- package/src/application/transform/schema/enum-rule.ts +10 -8
- package/src/application/transform/schema/object-type.ts +4 -4
- package/src/application/transform/schema/presence-members.ts +2 -2
- package/src/application/transform/schema/ref-siblings.ts +76 -0
- package/src/application/transform/schema/required-variants.ts +3 -3
- package/src/application/transform/schema/schema-context.ts +3 -0
- package/src/application/transform/schema/schema-transform.ts +4 -2
- package/src/application/transform/schema/unevaluated-properties.ts +2 -2
- package/src/application/transform/schema-comment.ts +7 -3
- package/src/application/transform/transform-context.ts +5 -0
- package/src/cli/api-settings.ts +82 -7
- package/src/cli/api-writes.ts +117 -0
- package/src/cli/cli-dependencies.ts +21 -4
- package/src/cli/cli-errors.ts +20 -1
- package/src/cli/cli-output.ts +186 -7
- package/src/cli/main.ts +6 -3
- package/src/cli/redocly-apis.ts +153 -48
- package/src/cli/run-cli.ts +37 -8
- package/src/domain/append-all.ts +10 -0
- package/src/domain/cause-secrets.ts +52 -0
- package/src/domain/deprecations.ts +15 -0
- package/src/domain/errors.ts +22 -7
- package/src/domain/ir/identifier-text.ts +6 -5
- package/src/domain/ir/ir-shape.ts +299 -0
- package/src/domain/ir/newer-identifier-ranges.ts +183 -30
- package/src/domain/openapi/alias-expansion.ts +4 -1
- package/src/domain/openapi/discriminated-union.ts +6 -4
- package/src/domain/openapi/discriminator-conflicts.ts +21 -7
- package/src/domain/openapi/document-object.ts +2 -0
- package/src/domain/openapi/json-pointer.ts +96 -7
- package/src/domain/openapi/schema-dialect.ts +22 -0
- package/src/domain/openapi/unsupported-features.ts +2 -2
- package/src/domain/output-fixes.ts +37 -18
- package/src/domain/url-secrets.ts +72 -0
- package/src/domain/warnings.ts +0 -1
- package/src/index.ts +2 -6
- package/src/types/generator-options.ts +1 -1
- package/dist/cli/main.d.cts +0 -2
- package/dist/cli/main.d.mts +0 -2
- package/dist/cli/main.d.ts +0 -2
- package/dist/domain/url-credentials.cjs +0 -10
- package/dist/domain/url-credentials.cjs.map +0 -1
- package/dist/domain/url-credentials.mjs +0 -8
- package/dist/domain/url-credentials.mjs.map +0 -1
- package/src/domain/url-credentials.ts +0 -18
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
pathStringError,
|
|
18
18
|
sourceEmptyError,
|
|
19
19
|
sourceInvalidError,
|
|
20
|
+
type TextOrigin,
|
|
21
|
+
urlInvalidError,
|
|
20
22
|
} from "./schema-load-errors.js";
|
|
21
23
|
|
|
22
24
|
/** Parse a schema source of any supported type into a Redocly document (ENGINEERING_PLAN 4.5). */
|
|
@@ -24,6 +26,8 @@ import {
|
|
|
24
26
|
export interface ParseSchemaOptions {
|
|
25
27
|
absoluteRef: string;
|
|
26
28
|
resolver: BaseResolver;
|
|
29
|
+
/** Where document text came from, for the message of text that is only a string. */
|
|
30
|
+
textOrigin?: TextOrigin;
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
/**
|
|
@@ -38,21 +42,28 @@ async function readStream(stream: Readable, absoluteRef: string): Promise<string
|
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
/** A URL source string; a scheme is the same in any case (RFC 3986, section 3.1). */
|
|
46
|
+
const URL_PREFIX_RE = /^(?:https?|file):\/\//i;
|
|
42
47
|
|
|
43
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* A string is a URL, JSON (starts with `{`) or YAML. A string that starts like a URL but does not
|
|
50
|
+
* parse as one fails with `SCHEMA_SOURCE_INVALID`, not the parser's `TypeError`.
|
|
51
|
+
*/
|
|
44
52
|
function parseSchemaText(
|
|
45
53
|
schema: string,
|
|
46
54
|
options: ParseSchemaOptions,
|
|
47
55
|
): Promise<Document> | Document {
|
|
48
|
-
if (
|
|
49
|
-
const url =
|
|
56
|
+
if (URL_PREFIX_RE.test(schema)) {
|
|
57
|
+
const url = URL.parse(schema);
|
|
58
|
+
if (url === null) {
|
|
59
|
+
throw urlInvalidError(schema);
|
|
60
|
+
}
|
|
50
61
|
const absoluteRef = url.protocol === "file:" ? fileURLToPath(url) : url.href;
|
|
51
62
|
return parseSchema(url, { absoluteRef, resolver: options.resolver });
|
|
52
63
|
}
|
|
53
64
|
return schema[0] === "{"
|
|
54
65
|
? parseJsonText(schema, options.absoluteRef)
|
|
55
|
-
: parseYamlText(schema, options.absoluteRef);
|
|
66
|
+
: parseYamlText(schema, options.absoluteRef, options.textOrigin ?? "string");
|
|
56
67
|
}
|
|
57
68
|
|
|
58
69
|
function parseJsonText(text: string, absoluteRef: string): Document {
|
|
@@ -63,7 +74,7 @@ function parseJsonText(text: string, absoluteRef: string): Document {
|
|
|
63
74
|
}
|
|
64
75
|
}
|
|
65
76
|
|
|
66
|
-
function parseYamlText(text: string, absoluteRef: string): Document {
|
|
77
|
+
function parseYamlText(text: string, absoluteRef: string, origin: TextOrigin): Document {
|
|
67
78
|
let document: Document;
|
|
68
79
|
try {
|
|
69
80
|
document = makeDocumentFromString(text, absoluteRef);
|
|
@@ -72,7 +83,7 @@ function parseYamlText(text: string, absoluteRef: string): Document {
|
|
|
72
83
|
}
|
|
73
84
|
// Text that is only a YAML string scalar, such as "./openapi.yaml", was meant as a file path.
|
|
74
85
|
if (typeof document.parsed === "string") {
|
|
75
|
-
throw pathStringError(text);
|
|
86
|
+
throw pathStringError(text, origin);
|
|
76
87
|
}
|
|
77
88
|
const failure = aliasExpansionFailure(document.parsed);
|
|
78
89
|
if (failure !== undefined) {
|
|
@@ -139,7 +150,8 @@ export async function parseSchema(schema: unknown, options: ParseSchemaOptions):
|
|
|
139
150
|
return resolveSchemaURL(options);
|
|
140
151
|
}
|
|
141
152
|
if (schema instanceof Readable) {
|
|
142
|
-
|
|
153
|
+
const text = await readStream(schema, options.absoluteRef);
|
|
154
|
+
return parseSchema(text, { ...options, textOrigin: "stream" });
|
|
143
155
|
}
|
|
144
156
|
if (schema instanceof Buffer) {
|
|
145
157
|
return parseSchema(schema.toString("utf8"), options);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ERROR_CODES, OpenAPITypesafeError } from "../../domain/errors.js";
|
|
2
|
+
import { childPointer, ROOT_POINTER } from "../../domain/openapi/json-pointer.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Keys Redocly 1.34 cannot walk. It looks up the type of every key with `type.properties[key]`,
|
|
@@ -57,11 +58,6 @@ interface PendingNode {
|
|
|
57
58
|
readonly pointer: string;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
/** RFC 6901: `~` becomes `~0` and `/` becomes `~1`. */
|
|
61
|
-
function escapePointerSegment(segment: string): string {
|
|
62
|
-
return segment.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
63
|
-
}
|
|
64
|
-
|
|
65
61
|
/**
|
|
66
62
|
* The unsupported keys of one parsed document. The walk uses its own stack, so a deeply nested
|
|
67
63
|
* document is checked without running out of call stack; nodes shared by YAML aliases are checked
|
|
@@ -77,10 +73,10 @@ function unsupportedKeysOf(document: LoadedDocument): UnsupportedKey[] {
|
|
|
77
73
|
pending.push({ value, pointer });
|
|
78
74
|
}
|
|
79
75
|
};
|
|
80
|
-
enqueue(document.parsed,
|
|
76
|
+
enqueue(document.parsed, ROOT_POINTER);
|
|
81
77
|
for (let node = pending.pop(); node !== undefined; node = pending.pop()) {
|
|
82
78
|
for (const [key, child] of Object.entries(node.value)) {
|
|
83
|
-
const pointer =
|
|
79
|
+
const pointer = childPointer(node.pointer, key);
|
|
84
80
|
if (isUnsupportedEntry(key, child)) {
|
|
85
81
|
found.push({ key, pointer, source: document.source });
|
|
86
82
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import colors from "ansi-colors";
|
|
2
2
|
import type { DebugGroup, Logger } from "../../application/ports/logger.js";
|
|
3
|
-
import {
|
|
3
|
+
import { redactUrlSecrets } from "../../domain/url-secrets.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The Logger port on a terminal, with the original output format: ` ⚠ ` warnings, ` ✘ `
|
|
@@ -16,7 +16,10 @@ export interface TerminalSink {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface TerminalLoggerOptions {
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Drop warnings and error lines; debug lines, which `DEBUG` asks for, are still written. The
|
|
21
|
+
* error lines are the problems of a document that fails to load, which the thrown error lists.
|
|
22
|
+
*/
|
|
20
23
|
readonly silent: boolean;
|
|
21
24
|
/** The value of `DEBUG`: `*`, `openapi-ts:*` or `openapi-ts:<group>` turn debug lines on. */
|
|
22
25
|
readonly debugFilter: string | undefined;
|
|
@@ -81,18 +84,20 @@ class TerminalLogger implements Logger {
|
|
|
81
84
|
// The original wrote no space without a duration (`openapi-ts:lintIgnored …`).
|
|
82
85
|
const time =
|
|
83
86
|
durationMs === undefined ? " " : this.#palette.green(` ${formatDuration(durationMs)} `);
|
|
84
|
-
const text =
|
|
87
|
+
const text = redactUrlSecrets(message);
|
|
85
88
|
this.#options.sink.debug(` ${this.#palette.bold(name)}${time}${text}`);
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
warn(message: string): void {
|
|
89
92
|
if (!this.#options.silent) {
|
|
90
|
-
this.#options.sink.warn(this.#palette.yellow(` ⚠ ${
|
|
93
|
+
this.#options.sink.warn(this.#palette.yellow(` ⚠ ${redactUrlSecrets(message)}`));
|
|
91
94
|
}
|
|
92
95
|
}
|
|
93
96
|
|
|
94
97
|
error(message: string): void {
|
|
95
|
-
this.#options.
|
|
98
|
+
if (!this.#options.silent) {
|
|
99
|
+
this.#options.sink.error(this.#palette.red(` ✘ ${redactUrlSecrets(message)}`));
|
|
100
|
+
}
|
|
96
101
|
}
|
|
97
102
|
}
|
|
98
103
|
|
package/src/api/default-ports.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { performance } from "node:perf_hooks";
|
|
2
2
|
import { createConfig, type Config as RedoclyConfig } from "@redocly/openapi-core";
|
|
3
3
|
import supportsColor from "supports-color";
|
|
4
|
+
import { createNodeDeprecationReporter } from "../adapters/node-deprecations/node-deprecations.js";
|
|
4
5
|
import type { RemoteDocumentLimits } from "../adapters/redocly-loader/remote-fetch.js";
|
|
5
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
createTerminalLogger,
|
|
8
|
+
type TerminalSink,
|
|
9
|
+
} from "../adapters/terminal-logger/terminal-logger.js";
|
|
10
|
+
import type { DeprecationReporter } from "../application/ports/deprecation-reporter.js";
|
|
6
11
|
import type { Logger } from "../application/ports/logger.js";
|
|
7
12
|
|
|
8
13
|
/**
|
|
@@ -16,16 +21,34 @@ export function terminalSupportsColor(): boolean {
|
|
|
16
21
|
return Boolean(stdout) && stdout !== false && stdout.hasBasic !== false;
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Every line of the logger goes to stderr: the CLI writes the types to stdout, and `console.debug`
|
|
26
|
+
* writes there too, so debug lines would end up inside the generated file.
|
|
27
|
+
*/
|
|
28
|
+
const STDERR_SINK: TerminalSink = {
|
|
29
|
+
// biome-ignore lint/suspicious/noConsole: the terminal logger's own channel
|
|
30
|
+
debug: (line) => console.error(line),
|
|
31
|
+
// biome-ignore lint/suspicious/noConsole: the terminal logger's own channel
|
|
32
|
+
warn: (line) => console.warn(line),
|
|
33
|
+
// biome-ignore lint/suspicious/noConsole: the terminal logger's own channel
|
|
34
|
+
error: (line) => console.error(line),
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** The terminal logger with `DEBUG` from the environment, writing to stderr. */
|
|
20
38
|
export function defaultLogger(silent: boolean): Logger {
|
|
21
39
|
return createTerminalLogger({
|
|
22
40
|
silent,
|
|
23
41
|
debugFilter: process.env.DEBUG,
|
|
24
42
|
useColors: terminalSupportsColor(),
|
|
25
|
-
sink:
|
|
43
|
+
sink: STDERR_SINK,
|
|
26
44
|
});
|
|
27
45
|
}
|
|
28
46
|
|
|
47
|
+
/** Deprecations as Node.js `DeprecationWarning`s, each code once per process. */
|
|
48
|
+
export function defaultDeprecationReporter(): DeprecationReporter {
|
|
49
|
+
return createNodeDeprecationReporter();
|
|
50
|
+
}
|
|
51
|
+
|
|
29
52
|
/**
|
|
30
53
|
* How long one remote `$ref` (or a remote source) may take to load. Large documents (the 27 MB
|
|
31
54
|
* Cloudflare spec) download in seconds; a minute covers slow hosts, while Node's own fetch would
|
|
@@ -33,14 +56,27 @@ export function defaultLogger(silent: boolean): Logger {
|
|
|
33
56
|
*/
|
|
34
57
|
export const REMOTE_REF_TIMEOUT_MS = 60_000;
|
|
35
58
|
|
|
59
|
+
const MEBIBYTE = 1024 * 1024;
|
|
60
|
+
|
|
36
61
|
/**
|
|
37
|
-
* Bounds on the remote documents of one
|
|
62
|
+
* Bounds on the remote documents of one schema (ADR-033). Large split documents have a few thousand
|
|
38
63
|
* files, so 10,000 leaves room and still ends an endless fan-out. 16 parallel fetches keep a
|
|
39
64
|
* multi-file document fast without exhausting local ports.
|
|
65
|
+
*
|
|
66
|
+
* The size limits count decoded bytes and parsed nodes (threat model T2, ADR-033 decision 6).
|
|
67
|
+
* The largest document of the 1,820-entry compatibility corpus is Microsoft Graph beta: 71 MiB,
|
|
68
|
+
* 2.65 million nodes (keys and values), 1.6 GB peak memory when loaded from a URL. A remote body
|
|
69
|
+
* took about 7 bytes of memory per byte of text and 110 per node in our measurements, so 128 MiB
|
|
70
|
+
* per document (1.8 times Graph beta), 256 MiB per schema (a split document may be twice as
|
|
71
|
+
* large) and 8 million nodes per schema (3 times Graph beta) let crafted documents finish within
|
|
72
|
+
* a heap of 2 GB; with the default heap of 4 GB they peak at about 1.2 to 2.3 GB.
|
|
40
73
|
*/
|
|
41
74
|
export const DEFAULT_REMOTE_DOCUMENT_LIMITS: RemoteDocumentLimits = {
|
|
42
75
|
maxDocuments: 10_000,
|
|
43
76
|
maxParallelFetches: 16,
|
|
77
|
+
maxDocumentBytes: 128 * MEBIBYTE,
|
|
78
|
+
maxTotalBytes: 256 * MEBIBYTE,
|
|
79
|
+
maxNodes: 8_000_000,
|
|
44
80
|
};
|
|
45
81
|
|
|
46
82
|
/** The working directory of the process: the default `cwd` of an inline source. */
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
type DiscriminatorValueConflict,
|
|
4
4
|
findDiscriminatorValueConflicts,
|
|
5
5
|
} from "../domain/openapi/discriminator-conflicts.js";
|
|
6
|
-
import { OutputFix } from "../domain/output-fixes.js";
|
|
6
|
+
import { FIX, type OutputFix } from "../domain/output-fixes.js";
|
|
7
7
|
import { WARNING_CODES, warningText } from "../domain/warnings.js";
|
|
8
8
|
|
|
9
9
|
const DOCS_BASE_URL = "https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs";
|
|
@@ -36,7 +36,7 @@ export function warnDiscriminatorValueConflicts(
|
|
|
36
36
|
fixes: readonly OutputFix[],
|
|
37
37
|
logger: Logger,
|
|
38
38
|
): void {
|
|
39
|
-
const isUnionReused = fixes.includes(
|
|
39
|
+
const isUnionReused = fixes.includes(FIX.ALLOF_DISCRIMINATED_UNION);
|
|
40
40
|
for (const conflict of findDiscriminatorValueConflicts(document, { isUnionReused })) {
|
|
41
41
|
logger.warn(warningText(warningOf(conflict), WARNING_CODES.DISCRIMINATOR_VALUE_NOT_ALLOWED));
|
|
42
42
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { appendPointer, parseRefPointer, ROOT_POINTER } from "../domain/openapi/json-pointer.js";
|
|
2
2
|
import type { SchemaObject } from "../types.js";
|
|
3
3
|
import type { EnumPatch } from "./discriminator-enum.js";
|
|
4
4
|
|
|
@@ -31,7 +31,7 @@ const ROOT_SEGMENTS = 3;
|
|
|
31
31
|
function typedAt(ref: string): string {
|
|
32
32
|
const segments = parseRefPointer(ref);
|
|
33
33
|
const nested = segments.slice(ROOT_SEGMENTS).filter((segment) => segment !== PROPERTIES_KEYWORD);
|
|
34
|
-
return
|
|
34
|
+
return appendPointer(ROOT_POINTER, [...segments.slice(0, ROOT_SEGMENTS), ...nested]);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
function isSchemaObject(value: unknown): value is SchemaObject {
|
|
@@ -41,7 +41,7 @@ function isSchemaObject(value: unknown): value is SchemaObject {
|
|
|
41
41
|
/** The property `name` of a schema object typed at `ref`. */
|
|
42
42
|
function ownProperty(item: SchemaObject, ref: string, name: string): DeclaredProperty | undefined {
|
|
43
43
|
const property = ("properties" in item ? item.properties : undefined)?.[name];
|
|
44
|
-
return property === undefined ? undefined : { property, path:
|
|
44
|
+
return property === undefined ? undefined : { property, path: appendPointer(ref, [name]) };
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/** The property `name` of the schema at `ref`, its own or from an `allOf` item, depth first. */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { appendAll } from "../domain/append-all.js";
|
|
2
|
+
import { canonicalRef } from "../domain/openapi/json-pointer.js";
|
|
1
3
|
import type { DiscriminatorObject, ReferenceObject, SchemaObject } from "../types.js";
|
|
2
4
|
import type { EnumPatch } from "./discriminator-enum.js";
|
|
3
5
|
import { enumKey, patchDiscriminatorEnum, type ScanState } from "./discriminator-patch.js";
|
|
@@ -22,7 +24,7 @@ function allOfRefs(state: ScanState, ref: string): string[] {
|
|
|
22
24
|
const schema = resolveDocumentRef<SchemaObject>(state.schema, ref, { silent, logger });
|
|
23
25
|
const items = (schema?.allOf ?? []) as (SchemaObject | ReferenceObject)[];
|
|
24
26
|
return items.flatMap((item) =>
|
|
25
|
-
"$ref" in item && typeof item.$ref === "string" ? [item.$ref] : [],
|
|
27
|
+
"$ref" in item && typeof item.$ref === "string" ? [canonicalRef(item.$ref)] : [],
|
|
26
28
|
);
|
|
27
29
|
}
|
|
28
30
|
|
|
@@ -45,7 +47,7 @@ function otherOwners(state: ScanState, parentRef: string): OtherOwner[] {
|
|
|
45
47
|
if (discriminator && name !== undefined && name !== own && !found.has(name)) {
|
|
46
48
|
found.set(name, { discriminator, ownerRef: ref });
|
|
47
49
|
}
|
|
48
|
-
queue
|
|
50
|
+
appendAll(queue, allOfRefs(state, ref));
|
|
49
51
|
}
|
|
50
52
|
return [...found.values()];
|
|
51
53
|
}
|
|
@@ -75,7 +77,7 @@ export function inheritOtherOwners(state: ScanState, parentRef: string, ref: str
|
|
|
75
77
|
}
|
|
76
78
|
recordOtherProperty(state, ref, discriminator.propertyName);
|
|
77
79
|
const mapped = Object.entries(discriminator.mapping ?? {})
|
|
78
|
-
.filter(([, target]) => target === ref)
|
|
80
|
+
.filter(([, target]) => canonicalRef(target) === ref)
|
|
79
81
|
.map(([value]) => value);
|
|
80
82
|
const name = ref.slice(ref.lastIndexOf("/") + 1);
|
|
81
83
|
const patch: EnumPatch = { ref, values: mapped, discriminator, discriminatorRef: ownerRef };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Logger } from "../application/ports/logger.js";
|
|
2
|
-
import {
|
|
2
|
+
import { appendAll } from "../domain/append-all.js";
|
|
3
|
+
import { FIX, type OutputFix } from "../domain/output-fixes.js";
|
|
3
4
|
import { WARNING_CODES, warningText } from "../domain/warnings.js";
|
|
4
5
|
import type { DiscriminatorObject, OpenAPI3, SchemaObject } from "../types.js";
|
|
5
6
|
import { addEnumProperty, declaresValues, type EnumPatch } from "./discriminator-enum.js";
|
|
@@ -46,7 +47,7 @@ export interface ScanState extends DiscriminatorScanOptions {
|
|
|
46
47
|
|
|
47
48
|
/** Whether `discriminator-values` is on: values of two discriminators merge into one enum. */
|
|
48
49
|
export function mergesValues(state: ScanState): boolean {
|
|
49
|
-
return state.fixes.has(
|
|
50
|
+
return state.fixes.has(FIX.DISCRIMINATOR_VALUES);
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
function patchedSchema(state: ScanState, patch: EnumPatch): SchemaObject | undefined {
|
|
@@ -60,8 +61,7 @@ function patchedSchema(state: ScanState, patch: EnumPatch): SchemaObject | undef
|
|
|
60
61
|
*/
|
|
61
62
|
function isDeclared(state: ScanState, patch: EnumPatch): boolean {
|
|
62
63
|
return (
|
|
63
|
-
state.fixes.has(
|
|
64
|
-
declaresValues(patchedSchema(state, patch), patch)
|
|
64
|
+
state.fixes.has(FIX.DISCRIMINATOR_VALUES) && declaresValues(patchedSchema(state, patch), patch)
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -70,7 +70,7 @@ function isDeclared(state: ScanState, patch: EnumPatch): boolean {
|
|
|
70
70
|
* added, or a discriminator object that a schema inherited.
|
|
71
71
|
*/
|
|
72
72
|
export function recordEnumParent(state: ScanState, owner: DiscriminatorOwner, key: object): void {
|
|
73
|
-
if (!state.fixes.has(
|
|
73
|
+
if (!state.fixes.has(FIX.DISCRIMINATOR_VALUES)) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
const { silent, logger } = state;
|
|
@@ -105,7 +105,10 @@ function mergeIntoPatchedEnum(state: ScanState, key: string, values: readonly st
|
|
|
105
105
|
return false;
|
|
106
106
|
}
|
|
107
107
|
const merged = patched.enum as unknown[];
|
|
108
|
-
|
|
108
|
+
appendAll(
|
|
109
|
+
merged,
|
|
110
|
+
values.filter((value) => !merged.includes(value)),
|
|
111
|
+
);
|
|
109
112
|
return true;
|
|
110
113
|
}
|
|
111
114
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Logger } from "../application/ports/logger.js";
|
|
2
2
|
import { isUnionMember, unionAt } from "../domain/openapi/discriminated-union.js";
|
|
3
|
-
import {
|
|
3
|
+
import { appendPointer, canonicalRef, ROOT_POINTER } from "../domain/openapi/json-pointer.js";
|
|
4
|
+
import { FIX } from "../domain/output-fixes.js";
|
|
4
5
|
import type {
|
|
5
6
|
DiscriminatorObject,
|
|
6
7
|
GeneratorOptions,
|
|
@@ -22,7 +23,6 @@ import {
|
|
|
22
23
|
type ScanState,
|
|
23
24
|
} from "./discriminator-patch.js";
|
|
24
25
|
import { resolveDocumentRef, walkDocument } from "./document-refs.js";
|
|
25
|
-
import { createRef } from "./legacy-utils.js";
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* The inherited discriminator pre-pass. It finds every discriminator in the bundled document and
|
|
@@ -39,9 +39,11 @@ function inferredMapping(oneOf: (SchemaObject | ReferenceObject)[]): Discriminat
|
|
|
39
39
|
if (!("$ref" in item)) {
|
|
40
40
|
continue;
|
|
41
41
|
}
|
|
42
|
+
// The value is the name as the `$ref` writes it, as in the original.
|
|
42
43
|
const value = item.$ref.split("/").pop();
|
|
44
|
+
const ref = canonicalRef(item.$ref);
|
|
43
45
|
if (value) {
|
|
44
|
-
mapping[
|
|
46
|
+
mapping[ref] = { ...mapping[ref], inferred: value };
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
return mapping;
|
|
@@ -52,10 +54,11 @@ function addDefinedMapping(
|
|
|
52
54
|
mapping: DiscriminatorMapping,
|
|
53
55
|
defined: Readonly<Record<string, string>>,
|
|
54
56
|
): void {
|
|
55
|
-
for (const [mappedValue,
|
|
56
|
-
if (!
|
|
57
|
+
for (const [mappedValue, target] of Object.entries(defined)) {
|
|
58
|
+
if (!target) {
|
|
57
59
|
continue;
|
|
58
60
|
}
|
|
61
|
+
const mappedRef = canonicalRef(target);
|
|
59
62
|
if (!mapping[mappedRef]?.defined) {
|
|
60
63
|
mapping[mappedRef] = { defined: [] };
|
|
61
64
|
}
|
|
@@ -94,7 +97,7 @@ function collectDiscriminator(
|
|
|
94
97
|
if (!discriminator?.propertyName) {
|
|
95
98
|
return;
|
|
96
99
|
}
|
|
97
|
-
const discriminatorRef =
|
|
100
|
+
const discriminatorRef = appendPointer(ROOT_POINTER, path);
|
|
98
101
|
state.objects[discriminatorRef] = discriminator;
|
|
99
102
|
state.owners.add(discriminatorRef);
|
|
100
103
|
if (!Array.isArray(value.oneOf)) {
|
|
@@ -110,7 +113,7 @@ function collectDiscriminator(
|
|
|
110
113
|
/** The mapping keys of `discriminator` that point at `ref`. */
|
|
111
114
|
function valuesMappedTo(discriminator: DiscriminatorObject, ref: string): string[] {
|
|
112
115
|
return Object.entries(discriminator.mapping ?? {})
|
|
113
|
-
.filter(([, mappedRef]) => mappedRef === ref)
|
|
116
|
+
.filter(([, mappedRef]) => canonicalRef(mappedRef) === ref)
|
|
114
117
|
.map(([mappedValue]) => mappedValue);
|
|
115
118
|
}
|
|
116
119
|
|
|
@@ -121,7 +124,7 @@ function valuesMappedTo(discriminator: DiscriminatorObject, ref: string): string
|
|
|
121
124
|
* schema that the union's mapping names is a member.
|
|
122
125
|
*/
|
|
123
126
|
function inheritsDiscriminator(state: ScanState, parentRef: string, ref: string): boolean {
|
|
124
|
-
if (!state.fixes.has(
|
|
127
|
+
if (!state.fixes.has(FIX.ALLOF_DISCRIMINATED_UNION)) {
|
|
125
128
|
return true;
|
|
126
129
|
}
|
|
127
130
|
const resolve = (target: string) => resolveDocumentRef(state.schema, target, state);
|
|
@@ -141,7 +144,7 @@ function recordInherited(
|
|
|
141
144
|
discriminator: DiscriminatorObject,
|
|
142
145
|
ownerRef: string,
|
|
143
146
|
): void {
|
|
144
|
-
if (state.fixes.has(
|
|
147
|
+
if (state.fixes.has(FIX.DISCRIMINATOR_VALUES) && state.owners.has(ref)) {
|
|
145
148
|
return;
|
|
146
149
|
}
|
|
147
150
|
const inherited = { ...discriminator };
|
|
@@ -184,12 +187,17 @@ function inheritDiscriminators(
|
|
|
184
187
|
}
|
|
185
188
|
for (const item of value.allOf as (SchemaObject | ReferenceObject)[]) {
|
|
186
189
|
if ("$ref" in item) {
|
|
187
|
-
if (!inheritFromRef(state, item.$ref,
|
|
190
|
+
if (!inheritFromRef(state, canonicalRef(item.$ref), appendPointer(ROOT_POINTER, path))) {
|
|
188
191
|
return;
|
|
189
192
|
}
|
|
190
193
|
} else if (item.discriminator?.propertyName) {
|
|
191
194
|
// The inline item is typed at the schema's own location.
|
|
192
|
-
recordInherited(
|
|
195
|
+
recordInherited(
|
|
196
|
+
state,
|
|
197
|
+
appendPointer(ROOT_POINTER, path),
|
|
198
|
+
item.discriminator,
|
|
199
|
+
appendPointer(ROOT_POINTER, path),
|
|
200
|
+
);
|
|
193
201
|
}
|
|
194
202
|
}
|
|
195
203
|
}
|
package/src/api/document-run.ts
CHANGED
|
@@ -2,6 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
3
|
import type { Config as RedoclyConfig } from "@redocly/openapi-core";
|
|
4
4
|
import { sourceEmptyError } from "../adapters/redocly-loader/schema-load-errors.js";
|
|
5
|
+
import type { DeprecationReporter } from "../application/ports/deprecation-reporter.js";
|
|
5
6
|
import type { Logger } from "../application/ports/logger.js";
|
|
6
7
|
import type { RefAccess, SchemaLoader } from "../application/ports/schema-loader.js";
|
|
7
8
|
import { withStackOverflowReported } from "../application/stack-overflow.js";
|
|
@@ -25,15 +26,18 @@ import { warnUnsupportedFeatures } from "./unsupported-feature-warnings.js";
|
|
|
25
26
|
export interface GeneratorPorts {
|
|
26
27
|
readonly loader: SchemaLoader;
|
|
27
28
|
readonly logger: Logger;
|
|
29
|
+
/** Where the run reports the deprecated callback forms (ADR-004). */
|
|
30
|
+
readonly deprecations: DeprecationReporter;
|
|
28
31
|
/** The Redocly config the loader uses; the run's context exposes it as `ctx.redoc`. */
|
|
29
32
|
readonly redoc: RedoclyConfig;
|
|
30
33
|
/** A monotonic time in milliseconds, for debug durations. */
|
|
31
34
|
readonly now: () => number;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
/** A validated, bundled document
|
|
37
|
+
/** A validated, bundled document, the local files it was read from, and the run's context. */
|
|
35
38
|
export interface DocumentRun {
|
|
36
39
|
readonly schema: OpenAPI3;
|
|
40
|
+
readonly localFiles: readonly URL[];
|
|
37
41
|
readonly ctx: RunContext;
|
|
38
42
|
}
|
|
39
43
|
|
|
@@ -47,6 +51,7 @@ type ContextFlags = Omit<
|
|
|
47
51
|
| "runFooter"
|
|
48
52
|
| "legacyCallbackWarnings"
|
|
49
53
|
| "logger"
|
|
54
|
+
| "deprecations"
|
|
50
55
|
| "fix"
|
|
51
56
|
>;
|
|
52
57
|
|
|
@@ -152,7 +157,7 @@ export async function createDocumentRun(
|
|
|
152
157
|
const fix = outputFixesOf(options, logger);
|
|
153
158
|
const silent = options.silent ?? false;
|
|
154
159
|
const cwd = sourceCwd(options);
|
|
155
|
-
const schema = await ports.loader.load({
|
|
160
|
+
const { document: schema, localFiles } = await ports.loader.load({
|
|
156
161
|
source,
|
|
157
162
|
cwd,
|
|
158
163
|
shouldLint: options.lint ?? true,
|
|
@@ -175,6 +180,7 @@ export async function createDocumentRun(
|
|
|
175
180
|
redoc: ports.redoc,
|
|
176
181
|
resolve: ($ref) => resolveDocumentRef(schema, $ref, { silent, logger }),
|
|
177
182
|
logger,
|
|
183
|
+
deprecations: ports.deprecations,
|
|
178
184
|
};
|
|
179
|
-
return { schema, ctx };
|
|
185
|
+
return { schema, localFiles, ctx };
|
|
180
186
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DEPRECATION_CODES, type DeprecationCode } from "../domain/deprecations.js";
|
|
2
2
|
import type { LegacyCallbackName } from "../types.js";
|
|
3
|
-
import {
|
|
3
|
+
import { defaultDeprecationReporter } from "./default-ports.js";
|
|
4
4
|
import type { RunContext } from "./run-context.js";
|
|
5
5
|
|
|
6
6
|
/** Where the IR callbacks are documented; the warning points users there. */
|
|
@@ -13,6 +13,12 @@ const USES: Readonly<Record<LegacyCallbackName, string>> = {
|
|
|
13
13
|
transformProperty: "`transformProperty` receives TypeScript nodes",
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
const CODES: Readonly<Record<LegacyCallbackName, DeprecationCode>> = {
|
|
17
|
+
transform: DEPRECATION_CODES.OPENAPI_TYPESAFE_DEP_TS_TRANSFORM,
|
|
18
|
+
postTransform: DEPRECATION_CODES.OPENAPI_TYPESAFE_DEP_TS_POST_TRANSFORM,
|
|
19
|
+
transformProperty: DEPRECATION_CODES.OPENAPI_TYPESAFE_DEP_TS_TRANSFORM_PROPERTY,
|
|
20
|
+
};
|
|
21
|
+
|
|
16
22
|
function message(name: LegacyCallbackName): string {
|
|
17
23
|
return (
|
|
18
24
|
`${USES[name]}. This form works in 1.x through the TypeScript bridge and is removed in 2.0. ` +
|
|
@@ -20,14 +26,15 @@ function message(name: LegacyCallbackName): string {
|
|
|
20
26
|
);
|
|
21
27
|
}
|
|
22
28
|
|
|
23
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Report a deprecated callback form once per run and callback, as a deprecation (not through the
|
|
31
|
+
* logger, so `silent` does not hide it). The Node.js reporter shows each code once per process.
|
|
32
|
+
*/
|
|
24
33
|
export function warnLegacyCallback(ctx: RunContext, name: LegacyCallbackName): void {
|
|
25
34
|
ctx.legacyCallbackWarnings ??= new Set();
|
|
26
35
|
if (ctx.legacyCallbackWarnings.has(name)) {
|
|
27
36
|
return;
|
|
28
37
|
}
|
|
29
38
|
ctx.legacyCallbackWarnings.add(name);
|
|
30
|
-
(ctx.
|
|
31
|
-
warningText(message(name), WARNING_CODES.LEGACY_CALLBACK_DEPRECATED),
|
|
32
|
-
);
|
|
39
|
+
(ctx.deprecations ?? defaultDeprecationReporter()).report(CODES[name], message(name));
|
|
33
40
|
}
|
package/src/api/legacy-utils.ts
CHANGED
|
@@ -36,7 +36,11 @@ export function createDiscriminatorProperty(
|
|
|
36
36
|
return discriminatorProperty(discriminator, path, readonly);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Create a $ref pointer (even from other $refs). A part that contains `#/` is read as a `$ref`
|
|
41
|
+
* and contributes its decoded segments, so it throws URIError for a malformed percent escape; any
|
|
42
|
+
* other part is one segment. To append raw document keys, escape each one instead.
|
|
43
|
+
*/
|
|
40
44
|
export function createRef(parts: (number | string | undefined | null)[]): string {
|
|
41
45
|
return createDomainRef(parts);
|
|
42
46
|
}
|
package/src/api/openapi-ts.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { IrDeclaration } from "../domain/ir/nodes.js";
|
|
|
4
4
|
import type { GeneratorOptions, SchemaSource } from "../types.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_REMOTE_DOCUMENT_LIMITS,
|
|
7
|
+
defaultDeprecationReporter,
|
|
7
8
|
defaultLogger,
|
|
8
9
|
defaultRedoclyConfig,
|
|
9
10
|
monotonicNow,
|
|
@@ -17,24 +18,42 @@ import transformSchema from "./transform-schema.js";
|
|
|
17
18
|
* `generateDeclarations` runs with any ports, which is how the CLI calls it.
|
|
18
19
|
*/
|
|
19
20
|
|
|
21
|
+
/** The declarations of one document, and the local files it was read from. */
|
|
22
|
+
export interface GeneratedDocument {
|
|
23
|
+
readonly declarations: IrDeclaration[];
|
|
24
|
+
readonly localFiles: readonly URL[];
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
/** Load, validate and bundle the source, then transform it into IR declarations. */
|
|
21
|
-
export async function
|
|
28
|
+
export async function generateDocument(
|
|
22
29
|
source: SchemaSource,
|
|
23
30
|
options: GeneratorOptions,
|
|
24
31
|
ports: GeneratorPorts,
|
|
25
|
-
): Promise<
|
|
26
|
-
const { schema, ctx } = await createDocumentRun(source, options, ports);
|
|
32
|
+
): Promise<GeneratedDocument> {
|
|
33
|
+
const { schema, localFiles, ctx } = await createDocumentRun(source, options, ports);
|
|
27
34
|
const startedAt = ports.now();
|
|
28
|
-
const
|
|
35
|
+
const declarations = withStackOverflowReported("transform", () => transformSchema(schema, ctx));
|
|
29
36
|
ports.logger.debug(
|
|
30
37
|
"Completed AST transformation for entire document",
|
|
31
38
|
"ts",
|
|
32
39
|
ports.now() - startedAt,
|
|
33
40
|
);
|
|
34
|
-
return
|
|
41
|
+
return { declarations, localFiles };
|
|
35
42
|
}
|
|
36
43
|
|
|
37
|
-
/**
|
|
44
|
+
/** As `generateDocument`, the declarations only. */
|
|
45
|
+
export async function generateDeclarations(
|
|
46
|
+
source: SchemaSource,
|
|
47
|
+
options: GeneratorOptions,
|
|
48
|
+
ports: GeneratorPorts,
|
|
49
|
+
): Promise<IrDeclaration[]> {
|
|
50
|
+
return (await generateDocument(source, options, ports)).declarations;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The default ports: the terminal logger, Node.js deprecation warnings, the given or default
|
|
55
|
+
* Redocly config, Redocly loading.
|
|
56
|
+
*/
|
|
38
57
|
export async function defaultGeneratorPorts(options: GeneratorOptions): Promise<GeneratorPorts> {
|
|
39
58
|
const logger = defaultLogger(options.silent ?? false);
|
|
40
59
|
const redoc = options.redocly ?? (await defaultRedoclyConfig());
|
|
@@ -45,7 +64,7 @@ export async function defaultGeneratorPorts(options: GeneratorOptions): Promise<
|
|
|
45
64
|
remoteRefTimeoutMs: REMOTE_REF_TIMEOUT_MS,
|
|
46
65
|
remoteDocumentLimits: DEFAULT_REMOTE_DOCUMENT_LIMITS,
|
|
47
66
|
});
|
|
48
|
-
return { loader, logger, redoc, now: monotonicNow };
|
|
67
|
+
return { loader, logger, deprecations: defaultDeprecationReporter(), redoc, now: monotonicNow };
|
|
49
68
|
}
|
|
50
69
|
|
|
51
70
|
/**
|
package/src/api/run-context.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { DeprecationReporter } from "../application/ports/deprecation-reporter.js";
|
|
1
2
|
import type { Logger } from "../application/ports/logger.js";
|
|
2
3
|
import type { DocumentFooter } from "../application/transform/transform-context.js";
|
|
4
|
+
import type { SchemaDialect } from "../domain/openapi/schema-dialect.js";
|
|
3
5
|
import type { GlobalContext, LegacyCallbackName, SchemaObject } from "../types.js";
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -25,10 +27,14 @@ export interface RunContext extends GlobalContext {
|
|
|
25
27
|
*/
|
|
26
28
|
readonly otherProperties?: Readonly<Record<string, readonly string[]>>;
|
|
27
29
|
};
|
|
30
|
+
/** The schema dialect of the run's document; without it, OpenAPI 3.0 (`schemaDialectOf`). */
|
|
31
|
+
schemaDialect?: SchemaDialect;
|
|
28
32
|
/** Footer state of this run (enum registry and enum naming), created on first use. */
|
|
29
33
|
runFooter?: DocumentFooter;
|
|
30
34
|
/** The deprecated callback forms this run has warned about (once each). */
|
|
31
35
|
legacyCallbackWarnings?: Set<LegacyCallbackName>;
|
|
32
36
|
/** Where this run reports warnings and debug output; without it, the terminal. */
|
|
33
37
|
logger?: Logger;
|
|
38
|
+
/** Where this run reports deprecated forms; without it, Node.js `DeprecationWarning`s. */
|
|
39
|
+
deprecations?: DeprecationReporter;
|
|
34
40
|
}
|