openapi-typesafe 0.0.0 → 1.0.0-rc.1
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/LICENSE +22 -0
- package/README.md +71 -1
- package/bin/cli.js +4 -0
- package/dist/adapters/node-file-system/node-file-system.cjs +46 -0
- package/dist/adapters/node-file-system/node-file-system.cjs.map +1 -0
- package/dist/adapters/node-file-system/node-file-system.mjs +40 -0
- package/dist/adapters/node-file-system/node-file-system.mjs.map +1 -0
- package/dist/adapters/redocly-loader/alias-limit.cjs +16 -0
- package/dist/adapters/redocly-loader/alias-limit.cjs.map +1 -0
- package/dist/adapters/redocly-loader/alias-limit.mjs +14 -0
- package/dist/adapters/redocly-loader/alias-limit.mjs.map +1 -0
- package/dist/adapters/redocly-loader/allowed-hosts.cjs +42 -0
- package/dist/adapters/redocly-loader/allowed-hosts.cjs.map +1 -0
- package/dist/adapters/redocly-loader/allowed-hosts.mjs +40 -0
- package/dist/adapters/redocly-loader/allowed-hosts.mjs.map +1 -0
- package/dist/adapters/redocly-loader/bundled-ref-repair.cjs +53 -0
- package/dist/adapters/redocly-loader/bundled-ref-repair.cjs.map +1 -0
- package/dist/adapters/redocly-loader/bundled-ref-repair.mjs +51 -0
- package/dist/adapters/redocly-loader/bundled-ref-repair.mjs.map +1 -0
- package/dist/adapters/redocly-loader/malformed-refs.cjs +41 -0
- package/dist/adapters/redocly-loader/malformed-refs.cjs.map +1 -0
- package/dist/adapters/redocly-loader/malformed-refs.mjs +38 -0
- package/dist/adapters/redocly-loader/malformed-refs.mjs.map +1 -0
- package/dist/adapters/redocly-loader/redocly-config-source.cjs +61 -0
- package/dist/adapters/redocly-loader/redocly-config-source.cjs.map +1 -0
- package/dist/adapters/redocly-loader/redocly-config-source.mjs +54 -0
- package/dist/adapters/redocly-loader/redocly-config-source.mjs.map +1 -0
- package/dist/adapters/redocly-loader/redocly-schema-loader.cjs +179 -0
- package/dist/adapters/redocly-loader/redocly-schema-loader.cjs.map +1 -0
- package/dist/adapters/redocly-loader/redocly-schema-loader.mjs +177 -0
- package/dist/adapters/redocly-loader/redocly-schema-loader.mjs.map +1 -0
- package/dist/adapters/redocly-loader/ref-access.cjs +107 -0
- package/dist/adapters/redocly-loader/ref-access.cjs.map +1 -0
- package/dist/adapters/redocly-loader/ref-access.mjs +99 -0
- package/dist/adapters/redocly-loader/ref-access.mjs.map +1 -0
- package/dist/adapters/redocly-loader/ref-holders.cjs +31 -0
- package/dist/adapters/redocly-loader/ref-holders.cjs.map +1 -0
- package/dist/adapters/redocly-loader/ref-holders.mjs +29 -0
- package/dist/adapters/redocly-loader/ref-holders.mjs.map +1 -0
- package/dist/adapters/redocly-loader/remote-fetch.cjs +60 -0
- package/dist/adapters/redocly-loader/remote-fetch.cjs.map +1 -0
- package/dist/adapters/redocly-loader/remote-fetch.mjs +56 -0
- package/dist/adapters/redocly-loader/remote-fetch.mjs.map +1 -0
- package/dist/adapters/redocly-loader/schema-load-errors.cjs +87 -0
- package/dist/adapters/redocly-loader/schema-load-errors.cjs.map +1 -0
- package/dist/adapters/redocly-loader/schema-load-errors.mjs +77 -0
- package/dist/adapters/redocly-loader/schema-load-errors.mjs.map +1 -0
- package/dist/adapters/redocly-loader/schema-source.cjs +104 -0
- package/dist/adapters/redocly-loader/schema-source.cjs.map +1 -0
- package/dist/adapters/redocly-loader/schema-source.mjs +98 -0
- package/dist/adapters/redocly-loader/schema-source.mjs.map +1 -0
- package/dist/adapters/redocly-loader/unsupported-keys.cjs +62 -0
- package/dist/adapters/redocly-loader/unsupported-keys.cjs.map +1 -0
- package/dist/adapters/redocly-loader/unsupported-keys.mjs +58 -0
- package/dist/adapters/redocly-loader/unsupported-keys.mjs.map +1 -0
- package/dist/adapters/terminal-logger/terminal-logger.cjs +67 -0
- package/dist/adapters/terminal-logger/terminal-logger.cjs.map +1 -0
- package/dist/adapters/terminal-logger/terminal-logger.mjs +59 -0
- package/dist/adapters/terminal-logger/terminal-logger.mjs.map +1 -0
- package/dist/adapters/type-ast-bridge/footer-nodes.cjs +21 -0
- package/dist/adapters/type-ast-bridge/footer-nodes.cjs.map +1 -0
- package/dist/adapters/type-ast-bridge/footer-nodes.mjs +17 -0
- package/dist/adapters/type-ast-bridge/footer-nodes.mjs.map +1 -0
- package/dist/adapters/type-ast-bridge/ir-declarations-to-typescript.cjs +75 -0
- package/dist/adapters/type-ast-bridge/ir-declarations-to-typescript.cjs.map +1 -0
- package/dist/adapters/type-ast-bridge/ir-declarations-to-typescript.mjs +71 -0
- package/dist/adapters/type-ast-bridge/ir-declarations-to-typescript.mjs.map +1 -0
- package/dist/adapters/type-ast-bridge/ir-to-typescript.cjs +148 -0
- package/dist/adapters/type-ast-bridge/ir-to-typescript.cjs.map +1 -0
- package/dist/adapters/type-ast-bridge/ir-to-typescript.mjs +142 -0
- package/dist/adapters/type-ast-bridge/ir-to-typescript.mjs.map +1 -0
- package/dist/adapters/type-ast-bridge/lazy-node.cjs +23 -0
- package/dist/adapters/type-ast-bridge/lazy-node.cjs.map +1 -0
- package/dist/adapters/type-ast-bridge/lazy-node.mjs +21 -0
- package/dist/adapters/type-ast-bridge/lazy-node.mjs.map +1 -0
- package/dist/adapters/type-ast-bridge/load-typescript.cjs +57 -0
- package/dist/adapters/type-ast-bridge/load-typescript.cjs.map +1 -0
- package/dist/adapters/type-ast-bridge/load-typescript.mjs +51 -0
- package/dist/adapters/type-ast-bridge/load-typescript.mjs.map +1 -0
- package/dist/adapters/type-ast-bridge/print-typescript.cjs +21 -0
- package/dist/adapters/type-ast-bridge/print-typescript.cjs.map +1 -0
- package/dist/adapters/type-ast-bridge/print-typescript.mjs +19 -0
- package/dist/adapters/type-ast-bridge/print-typescript.mjs.map +1 -0
- package/dist/adapters/type-ast-bridge/typescript-raw-text.cjs +33 -0
- package/dist/adapters/type-ast-bridge/typescript-raw-text.cjs.map +1 -0
- package/dist/adapters/type-ast-bridge/typescript-raw-text.mjs +29 -0
- package/dist/adapters/type-ast-bridge/typescript-raw-text.mjs.map +1 -0
- package/dist/adapters/type-ast-bridge/typescript-to-ir.cjs +210 -0
- package/dist/adapters/type-ast-bridge/typescript-to-ir.cjs.map +1 -0
- package/dist/adapters/type-ast-bridge/typescript-to-ir.mjs +207 -0
- package/dist/adapters/type-ast-bridge/typescript-to-ir.mjs.map +1 -0
- package/dist/api/ast-to-string.cjs +39 -0
- package/dist/api/ast-to-string.cjs.map +1 -0
- package/dist/api/ast-to-string.mjs +37 -0
- package/dist/api/ast-to-string.mjs.map +1 -0
- package/dist/api/comment-header.cjs +11 -0
- package/dist/api/comment-header.cjs.map +1 -0
- package/dist/api/comment-header.mjs +9 -0
- package/dist/api/comment-header.mjs.map +1 -0
- package/dist/api/default-ports.cjs +38 -0
- package/dist/api/default-ports.cjs.map +1 -0
- package/dist/api/default-ports.mjs +28 -0
- package/dist/api/default-ports.mjs.map +1 -0
- package/dist/api/discriminator-conflict-warnings.cjs +25 -0
- package/dist/api/discriminator-conflict-warnings.cjs.map +1 -0
- package/dist/api/discriminator-conflict-warnings.mjs +23 -0
- package/dist/api/discriminator-conflict-warnings.mjs.map +1 -0
- package/dist/api/discriminator-enum-names.cjs +19 -0
- package/dist/api/discriminator-enum-names.cjs.map +1 -0
- package/dist/api/discriminator-enum-names.mjs +17 -0
- package/dist/api/discriminator-enum-names.mjs.map +1 -0
- package/dist/api/discriminator-enum-parent.cjs +59 -0
- package/dist/api/discriminator-enum-parent.cjs.map +1 -0
- package/dist/api/discriminator-enum-parent.mjs +57 -0
- package/dist/api/discriminator-enum-parent.mjs.map +1 -0
- package/dist/api/discriminator-enum.cjs +69 -0
- package/dist/api/discriminator-enum.cjs.map +1 -0
- package/dist/api/discriminator-enum.mjs +66 -0
- package/dist/api/discriminator-enum.mjs.map +1 -0
- package/dist/api/discriminator-other-owners.cjs +67 -0
- package/dist/api/discriminator-other-owners.cjs.map +1 -0
- package/dist/api/discriminator-other-owners.mjs +64 -0
- package/dist/api/discriminator-other-owners.mjs.map +1 -0
- package/dist/api/discriminator-patch.cjs +88 -0
- package/dist/api/discriminator-patch.cjs.map +1 -0
- package/dist/api/discriminator-patch.mjs +82 -0
- package/dist/api/discriminator-patch.mjs.map +1 -0
- package/dist/api/discriminator-scan.cjs +153 -0
- package/dist/api/discriminator-scan.cjs.map +1 -0
- package/dist/api/discriminator-scan.mjs +150 -0
- package/dist/api/discriminator-scan.mjs.map +1 -0
- package/dist/api/document-declarations.cjs +28 -0
- package/dist/api/document-declarations.cjs.map +1 -0
- package/dist/api/document-declarations.mjs +26 -0
- package/dist/api/document-declarations.mjs.map +1 -0
- package/dist/api/document-refs.cjs +53 -0
- package/dist/api/document-refs.cjs.map +1 -0
- package/dist/api/document-refs.mjs +50 -0
- package/dist/api/document-refs.mjs.map +1 -0
- package/dist/api/document-run.cjs +122 -0
- package/dist/api/document-run.cjs.map +1 -0
- package/dist/api/document-run.mjs +116 -0
- package/dist/api/document-run.mjs.map +1 -0
- package/dist/api/enum-values-warnings.cjs +16 -0
- package/dist/api/enum-values-warnings.cjs.map +1 -0
- package/dist/api/enum-values-warnings.mjs +14 -0
- package/dist/api/enum-values-warnings.mjs.map +1 -0
- package/dist/api/footer-entry.cjs +18 -0
- package/dist/api/footer-entry.cjs.map +1 -0
- package/dist/api/footer-entry.mjs +15 -0
- package/dist/api/footer-entry.mjs.map +1 -0
- package/dist/api/footer-sink.cjs +53 -0
- package/dist/api/footer-sink.cjs.map +1 -0
- package/dist/api/footer-sink.mjs +51 -0
- package/dist/api/footer-sink.mjs.map +1 -0
- package/dist/api/legacy-callback-warning.cjs +25 -0
- package/dist/api/legacy-callback-warning.cjs.map +1 -0
- package/dist/api/legacy-callback-warning.mjs +22 -0
- package/dist/api/legacy-callback-warning.mjs.map +1 -0
- package/dist/api/legacy-ts-helpers.cjs +203 -0
- package/dist/api/legacy-ts-helpers.cjs.map +1 -0
- package/dist/api/legacy-ts-helpers.mjs +187 -0
- package/dist/api/legacy-ts-helpers.mjs.map +1 -0
- package/dist/api/legacy-utils.cjs +65 -0
- package/dist/api/legacy-utils.cjs.map +1 -0
- package/dist/api/legacy-utils.mjs +50 -0
- package/dist/api/legacy-utils.mjs.map +1 -0
- package/dist/api/openapi-ts.cjs +40 -0
- package/dist/api/openapi-ts.cjs.map +1 -0
- package/dist/api/openapi-ts.mjs +34 -0
- package/dist/api/openapi-ts.mjs.map +1 -0
- package/dist/api/path-template-warnings.cjs +21 -0
- package/dist/api/path-template-warnings.cjs.map +1 -0
- package/dist/api/path-template-warnings.mjs +19 -0
- package/dist/api/path-template-warnings.mjs.map +1 -0
- package/dist/api/schema-callbacks.cjs +140 -0
- package/dist/api/schema-callbacks.cjs.map +1 -0
- package/dist/api/schema-callbacks.mjs +136 -0
- package/dist/api/schema-callbacks.mjs.map +1 -0
- package/dist/api/string-to-ast.cjs +21 -0
- package/dist/api/string-to-ast.cjs.map +1 -0
- package/dist/api/string-to-ast.mjs +18 -0
- package/dist/api/string-to-ast.mjs.map +1 -0
- package/dist/api/transform-context.cjs +84 -0
- package/dist/api/transform-context.cjs.map +1 -0
- package/dist/api/transform-context.mjs +67 -0
- package/dist/api/transform-context.mjs.map +1 -0
- package/dist/api/transform-schema.cjs +80 -0
- package/dist/api/transform-schema.cjs.map +1 -0
- package/dist/api/transform-schema.mjs +75 -0
- package/dist/api/transform-schema.mjs.map +1 -0
- package/dist/api/type-helpers.cjs +85 -0
- package/dist/api/type-helpers.cjs.map +1 -0
- package/dist/api/type-helpers.mjs +66 -0
- package/dist/api/type-helpers.mjs.map +1 -0
- package/dist/api/unsupported-feature-warnings.cjs +22 -0
- package/dist/api/unsupported-feature-warnings.cjs.map +1 -0
- package/dist/api/unsupported-feature-warnings.mjs +20 -0
- package/dist/api/unsupported-feature-warnings.mjs.map +1 -0
- package/dist/application/print/comment-writer.cjs +95 -0
- package/dist/application/print/comment-writer.cjs.map +1 -0
- package/dist/application/print/comment-writer.mjs +93 -0
- package/dist/application/print/comment-writer.mjs.map +1 -0
- package/dist/application/print/declaration-printer.cjs +83 -0
- package/dist/application/print/declaration-printer.cjs.map +1 -0
- package/dist/application/print/declaration-printer.mjs +81 -0
- package/dist/application/print/declaration-printer.mjs.map +1 -0
- package/dist/application/print/literal-text.cjs +52 -0
- package/dist/application/print/literal-text.cjs.map +1 -0
- package/dist/application/print/literal-text.mjs +48 -0
- package/dist/application/print/literal-text.mjs.map +1 -0
- package/dist/application/print/print-nodes.cjs +38 -0
- package/dist/application/print/print-nodes.cjs.map +1 -0
- package/dist/application/print/print-nodes.mjs +36 -0
- package/dist/application/print/print-nodes.mjs.map +1 -0
- package/dist/application/print/print-options.cjs +6 -0
- package/dist/application/print/print-options.cjs.map +1 -0
- package/dist/application/print/print-options.mjs +4 -0
- package/dist/application/print/print-options.mjs.map +1 -0
- package/dist/application/print/text-writer.cjs +63 -0
- package/dist/application/print/text-writer.cjs.map +1 -0
- package/dist/application/print/text-writer.mjs +60 -0
- package/dist/application/print/text-writer.mjs.map +1 -0
- package/dist/application/print/type-printer.cjs +219 -0
- package/dist/application/print/type-printer.cjs.map +1 -0
- package/dist/application/print/type-printer.mjs +215 -0
- package/dist/application/print/type-printer.mjs.map +1 -0
- package/dist/application/stack-overflow.cjs +36 -0
- package/dist/application/stack-overflow.cjs.map +1 -0
- package/dist/application/stack-overflow.mjs +31 -0
- package/dist/application/stack-overflow.mjs.map +1 -0
- package/dist/application/transform/document/assignability.cjs +144 -0
- package/dist/application/transform/document/assignability.cjs.map +1 -0
- package/dist/application/transform/document/assignability.mjs +138 -0
- package/dist/application/transform/document/assignability.mjs.map +1 -0
- package/dist/application/transform/document/components.cjs +104 -0
- package/dist/application/transform/document/components.cjs.map +1 -0
- package/dist/application/transform/document/components.mjs +102 -0
- package/dist/application/transform/document/components.mjs.map +1 -0
- package/dist/application/transform/document/declared-types.cjs +66 -0
- package/dist/application/transform/document/declared-types.cjs.map +1 -0
- package/dist/application/transform/document/declared-types.mjs +63 -0
- package/dist/application/transform/document/declared-types.mjs.map +1 -0
- package/dist/application/transform/document/defs-root.cjs +18 -0
- package/dist/application/transform/document/defs-root.cjs.map +1 -0
- package/dist/application/transform/document/defs-root.mjs +16 -0
- package/dist/application/transform/document/defs-root.mjs.map +1 -0
- package/dist/application/transform/document/document-member.cjs +13 -0
- package/dist/application/transform/document/document-member.cjs.map +1 -0
- package/dist/application/transform/document/document-member.mjs +11 -0
- package/dist/application/transform/document/document-member.mjs.map +1 -0
- package/dist/application/transform/document/document.cjs +109 -0
- package/dist/application/transform/document/document.cjs.map +1 -0
- package/dist/application/transform/document/document.mjs +106 -0
- package/dist/application/transform/document/document.mjs.map +1 -0
- package/dist/application/transform/document/exploded-query.cjs +46 -0
- package/dist/application/transform/document/exploded-query.cjs.map +1 -0
- package/dist/application/transform/document/exploded-query.mjs +43 -0
- package/dist/application/transform/document/exploded-query.mjs.map +1 -0
- package/dist/application/transform/document/global-type-references.cjs +63 -0
- package/dist/application/transform/document/global-type-references.cjs.map +1 -0
- package/dist/application/transform/document/global-type-references.mjs +61 -0
- package/dist/application/transform/document/global-type-references.mjs.map +1 -0
- package/dist/application/transform/document/header.cjs +27 -0
- package/dist/application/transform/document/header.cjs.map +1 -0
- package/dist/application/transform/document/header.mjs +25 -0
- package/dist/application/transform/document/header.mjs.map +1 -0
- package/dist/application/transform/document/kept-deprecated.cjs +96 -0
- package/dist/application/transform/document/kept-deprecated.cjs.map +1 -0
- package/dist/application/transform/document/kept-deprecated.mjs +94 -0
- package/dist/application/transform/document/kept-deprecated.mjs.map +1 -0
- package/dist/application/transform/document/list-assignability.cjs +54 -0
- package/dist/application/transform/document/list-assignability.cjs.map +1 -0
- package/dist/application/transform/document/list-assignability.mjs +52 -0
- package/dist/application/transform/document/list-assignability.mjs.map +1 -0
- package/dist/application/transform/document/media-type.cjs +42 -0
- package/dist/application/transform/document/media-type.cjs.map +1 -0
- package/dist/application/transform/document/media-type.mjs +38 -0
- package/dist/application/transform/document/media-type.mjs.map +1 -0
- package/dist/application/transform/document/operation.cjs +45 -0
- package/dist/application/transform/document/operation.cjs.map +1 -0
- package/dist/application/transform/document/operation.mjs +43 -0
- package/dist/application/transform/document/operation.mjs.map +1 -0
- package/dist/application/transform/document/parameter.cjs +25 -0
- package/dist/application/transform/document/parameter.cjs.map +1 -0
- package/dist/application/transform/document/parameter.mjs +23 -0
- package/dist/application/transform/document/parameter.mjs.map +1 -0
- package/dist/application/transform/document/parameters.cjs +146 -0
- package/dist/application/transform/document/parameters.cjs.map +1 -0
- package/dist/application/transform/document/parameters.mjs +144 -0
- package/dist/application/transform/document/parameters.mjs.map +1 -0
- package/dist/application/transform/document/path-item.cjs +82 -0
- package/dist/application/transform/document/path-item.cjs.map +1 -0
- package/dist/application/transform/document/path-item.mjs +80 -0
- package/dist/application/transform/document/path-item.mjs.map +1 -0
- package/dist/application/transform/document/path-key-overlaps.cjs +107 -0
- package/dist/application/transform/document/path-key-overlaps.cjs.map +1 -0
- package/dist/application/transform/document/path-key-overlaps.mjs +105 -0
- package/dist/application/transform/document/path-key-overlaps.mjs.map +1 -0
- package/dist/application/transform/document/path-template-replace.cjs +48 -0
- package/dist/application/transform/document/path-template-replace.cjs.map +1 -0
- package/dist/application/transform/document/path-template-replace.mjs +45 -0
- package/dist/application/transform/document/path-template-replace.mjs.map +1 -0
- package/dist/application/transform/document/paths-enum.cjs +75 -0
- package/dist/application/transform/document/paths-enum.cjs.map +1 -0
- package/dist/application/transform/document/paths-enum.mjs +72 -0
- package/dist/application/transform/document/paths-enum.mjs.map +1 -0
- package/dist/application/transform/document/paths.cjs +153 -0
- package/dist/application/transform/document/paths.cjs.map +1 -0
- package/dist/application/transform/document/paths.mjs +149 -0
- package/dist/application/transform/document/paths.mjs.map +1 -0
- package/dist/application/transform/document/request-body.cjs +36 -0
- package/dist/application/transform/document/request-body.cjs.map +1 -0
- package/dist/application/transform/document/request-body.mjs +34 -0
- package/dist/application/transform/document/request-body.mjs.map +1 -0
- package/dist/application/transform/document/response.cjs +59 -0
- package/dist/application/transform/document/response.cjs.map +1 -0
- package/dist/application/transform/document/response.mjs +57 -0
- package/dist/application/transform/document/response.mjs.map +1 -0
- package/dist/application/transform/document/responses.cjs +23 -0
- package/dist/application/transform/document/responses.cjs.map +1 -0
- package/dist/application/transform/document/responses.mjs +21 -0
- package/dist/application/transform/document/responses.mjs.map +1 -0
- package/dist/application/transform/document/root-type-aliases.cjs +70 -0
- package/dist/application/transform/document/root-type-aliases.cjs.map +1 -0
- package/dist/application/transform/document/root-type-aliases.mjs +67 -0
- package/dist/application/transform/document/root-type-aliases.mjs.map +1 -0
- package/dist/application/transform/document/template-key-match.cjs +128 -0
- package/dist/application/transform/document/template-key-match.cjs.map +1 -0
- package/dist/application/transform/document/template-key-match.mjs +125 -0
- package/dist/application/transform/document/template-key-match.mjs.map +1 -0
- package/dist/application/transform/document/type-assignability.cjs +192 -0
- package/dist/application/transform/document/type-assignability.cjs.map +1 -0
- package/dist/application/transform/document/type-assignability.mjs +190 -0
- package/dist/application/transform/document/type-assignability.mjs.map +1 -0
- package/dist/application/transform/document/type-key.cjs +70 -0
- package/dist/application/transform/document/type-key.cjs.map +1 -0
- package/dist/application/transform/document/type-key.mjs +68 -0
- package/dist/application/transform/document/type-key.mjs.map +1 -0
- package/dist/application/transform/document/type-resolution.cjs +131 -0
- package/dist/application/transform/document/type-resolution.cjs.map +1 -0
- package/dist/application/transform/document/type-resolution.mjs +125 -0
- package/dist/application/transform/document/type-resolution.mjs.map +1 -0
- package/dist/application/transform/document/webhooks.cjs +19 -0
- package/dist/application/transform/document/webhooks.cjs.map +1 -0
- package/dist/application/transform/document/webhooks.mjs +17 -0
- package/dist/application/transform/document/webhooks.mjs.map +1 -0
- package/dist/application/transform/document-entries.cjs +17 -0
- package/dist/application/transform/document-entries.cjs.map +1 -0
- package/dist/application/transform/document-entries.mjs +14 -0
- package/dist/application/transform/document-entries.mjs.map +1 -0
- package/dist/application/transform/footer/document-footer.cjs +150 -0
- package/dist/application/transform/footer/document-footer.cjs.map +1 -0
- package/dist/application/transform/footer/document-footer.mjs +148 -0
- package/dist/application/transform/footer/document-footer.mjs.map +1 -0
- package/dist/application/transform/footer/enum-naming.cjs +138 -0
- package/dist/application/transform/footer/enum-naming.cjs.map +1 -0
- package/dist/application/transform/footer/enum-naming.mjs +131 -0
- package/dist/application/transform/footer/enum-naming.mjs.map +1 -0
- package/dist/application/transform/footer/enum-values-check.cjs +129 -0
- package/dist/application/transform/footer/enum-values-check.cjs.map +1 -0
- package/dist/application/transform/footer/enum-values-check.mjs +127 -0
- package/dist/application/transform/footer/enum-values-check.mjs.map +1 -0
- package/dist/application/transform/footer/evaluation.cjs +33 -0
- package/dist/application/transform/footer/evaluation.cjs.map +1 -0
- package/dist/application/transform/footer/evaluation.mjs +26 -0
- package/dist/application/transform/footer/evaluation.mjs.map +1 -0
- package/dist/application/transform/footer/shared-enum-names.cjs +60 -0
- package/dist/application/transform/footer/shared-enum-names.cjs.map +1 -0
- package/dist/application/transform/footer/shared-enum-names.mjs +57 -0
- package/dist/application/transform/footer/shared-enum-names.mjs.map +1 -0
- package/dist/application/transform/footer/type-evaluation.cjs +246 -0
- package/dist/application/transform/footer/type-evaluation.cjs.map +1 -0
- package/dist/application/transform/footer/type-evaluation.mjs +244 -0
- package/dist/application/transform/footer/type-evaluation.mjs.map +1 -0
- package/dist/application/transform/footer/type-rules.cjs +172 -0
- package/dist/application/transform/footer/type-rules.cjs.map +1 -0
- package/dist/application/transform/footer/type-rules.mjs +166 -0
- package/dist/application/transform/footer/type-rules.mjs.map +1 -0
- package/dist/application/transform/helper-types.cjs +68 -0
- package/dist/application/transform/helper-types.cjs.map +1 -0
- package/dist/application/transform/helper-types.mjs +65 -0
- package/dist/application/transform/helper-types.mjs.map +1 -0
- package/dist/application/transform/literal-type.cjs +36 -0
- package/dist/application/transform/literal-type.cjs.map +1 -0
- package/dist/application/transform/literal-type.mjs +34 -0
- package/dist/application/transform/literal-type.mjs.map +1 -0
- package/dist/application/transform/numbered-names.cjs +18 -0
- package/dist/application/transform/numbered-names.cjs.map +1 -0
- package/dist/application/transform/numbered-names.mjs +16 -0
- package/dist/application/transform/numbered-names.mjs.map +1 -0
- package/dist/application/transform/ref-pointer/generated-location.cjs +138 -0
- package/dist/application/transform/ref-pointer/generated-location.cjs.map +1 -0
- package/dist/application/transform/ref-pointer/generated-location.mjs +136 -0
- package/dist/application/transform/ref-pointer/generated-location.mjs.map +1 -0
- package/dist/application/transform/ref-pointer/generated-shape.cjs +171 -0
- package/dist/application/transform/ref-pointer/generated-shape.cjs.map +1 -0
- package/dist/application/transform/ref-pointer/generated-shape.mjs +162 -0
- package/dist/application/transform/ref-pointer/generated-shape.mjs.map +1 -0
- package/dist/application/transform/ref-pointer/inline-cycles.cjs +44 -0
- package/dist/application/transform/ref-pointer/inline-cycles.cjs.map +1 -0
- package/dist/application/transform/ref-pointer/inline-cycles.mjs +42 -0
- package/dist/application/transform/ref-pointer/inline-cycles.mjs.map +1 -0
- package/dist/application/transform/ref-pointer/original-index.cjs +62 -0
- package/dist/application/transform/ref-pointer/original-index.cjs.map +1 -0
- package/dist/application/transform/ref-pointer/original-index.mjs +60 -0
- package/dist/application/transform/ref-pointer/original-index.mjs.map +1 -0
- package/dist/application/transform/ref-pointer/pointer-type.cjs +60 -0
- package/dist/application/transform/ref-pointer/pointer-type.cjs.map +1 -0
- package/dist/application/transform/ref-pointer/pointer-type.mjs +57 -0
- package/dist/application/transform/ref-pointer/pointer-type.mjs.map +1 -0
- package/dist/application/transform/ref-pointer/pointer-walk.cjs +66 -0
- package/dist/application/transform/ref-pointer/pointer-walk.cjs.map +1 -0
- package/dist/application/transform/ref-pointer/pointer-walk.mjs +56 -0
- package/dist/application/transform/ref-pointer/pointer-walk.mjs.map +1 -0
- package/dist/application/transform/ref-pointer/typed-walk.cjs +124 -0
- package/dist/application/transform/ref-pointer/typed-walk.cjs.map +1 -0
- package/dist/application/transform/ref-pointer/typed-walk.mjs +122 -0
- package/dist/application/transform/ref-pointer/typed-walk.mjs.map +1 -0
- package/dist/application/transform/ref-type.cjs +62 -0
- package/dist/application/transform/ref-type.cjs.map +1 -0
- package/dist/application/transform/ref-type.mjs +55 -0
- package/dist/application/transform/ref-type.mjs.map +1 -0
- package/dist/application/transform/schema/access-flags.cjs +38 -0
- package/dist/application/transform/schema/access-flags.cjs.map +1 -0
- package/dist/application/transform/schema/access-flags.mjs +36 -0
- package/dist/application/transform/schema/access-flags.mjs.map +1 -0
- package/dist/application/transform/schema/array-type.cjs +136 -0
- package/dist/application/transform/schema/array-type.cjs.map +1 -0
- package/dist/application/transform/schema/array-type.mjs +134 -0
- package/dist/application/transform/schema/array-type.mjs.map +1 -0
- package/dist/application/transform/schema/composition-type.cjs +142 -0
- package/dist/application/transform/schema/composition-type.cjs.map +1 -0
- package/dist/application/transform/schema/composition-type.mjs +140 -0
- package/dist/application/transform/schema/composition-type.mjs.map +1 -0
- package/dist/application/transform/schema/core-type.cjs +86 -0
- package/dist/application/transform/schema/core-type.cjs.map +1 -0
- package/dist/application/transform/schema/core-type.mjs +84 -0
- package/dist/application/transform/schema/core-type.mjs.map +1 -0
- package/dist/application/transform/schema/discriminated-union.cjs +30 -0
- package/dist/application/transform/schema/discriminated-union.cjs.map +1 -0
- package/dist/application/transform/schema/discriminated-union.mjs +27 -0
- package/dist/application/transform/schema/discriminated-union.mjs.map +1 -0
- package/dist/application/transform/schema/discriminator-property.cjs +22 -0
- package/dist/application/transform/schema/discriminator-property.cjs.map +1 -0
- package/dist/application/transform/schema/discriminator-property.mjs +20 -0
- package/dist/application/transform/schema/discriminator-property.mjs.map +1 -0
- package/dist/application/transform/schema/enum-rule.cjs +163 -0
- package/dist/application/transform/schema/enum-rule.cjs.map +1 -0
- package/dist/application/transform/schema/enum-rule.mjs +160 -0
- package/dist/application/transform/schema/enum-rule.mjs.map +1 -0
- package/dist/application/transform/schema/inherited-discriminator.cjs +29 -0
- package/dist/application/transform/schema/inherited-discriminator.cjs.map +1 -0
- package/dist/application/transform/schema/inherited-discriminator.mjs +26 -0
- package/dist/application/transform/schema/inherited-discriminator.mjs.map +1 -0
- package/dist/application/transform/schema/object-type.cjs +186 -0
- package/dist/application/transform/schema/object-type.cjs.map +1 -0
- package/dist/application/transform/schema/object-type.mjs +182 -0
- package/dist/application/transform/schema/object-type.mjs.map +1 -0
- package/dist/application/transform/schema/presence-members.cjs +59 -0
- package/dist/application/transform/schema/presence-members.cjs.map +1 -0
- package/dist/application/transform/schema/presence-members.mjs +57 -0
- package/dist/application/transform/schema/presence-members.mjs.map +1 -0
- package/dist/application/transform/schema/required-variants.cjs +45 -0
- package/dist/application/transform/schema/required-variants.cjs.map +1 -0
- package/dist/application/transform/schema/required-variants.mjs +42 -0
- package/dist/application/transform/schema/required-variants.mjs.map +1 -0
- package/dist/application/transform/schema/schema-transform.cjs +72 -0
- package/dist/application/transform/schema/schema-transform.cjs.map +1 -0
- package/dist/application/transform/schema/schema-transform.mjs +68 -0
- package/dist/application/transform/schema/schema-transform.mjs.map +1 -0
- package/dist/application/transform/schema/unevaluated-properties.cjs +61 -0
- package/dist/application/transform/schema/unevaluated-properties.cjs.map +1 -0
- package/dist/application/transform/schema/unevaluated-properties.mjs +59 -0
- package/dist/application/transform/schema/unevaluated-properties.mjs.map +1 -0
- package/dist/application/transform/schema-comment.cjs +130 -0
- package/dist/application/transform/schema-comment.cjs.map +1 -0
- package/dist/application/transform/schema-comment.mjs +125 -0
- package/dist/application/transform/schema-comment.mjs.map +1 -0
- package/dist/application/transform/shared-types.cjs +8 -0
- package/dist/application/transform/shared-types.cjs.map +1 -0
- package/dist/application/transform/shared-types.mjs +6 -0
- package/dist/application/transform/shared-types.mjs.map +1 -0
- package/dist/application/transform/type-combinators.cjs +49 -0
- package/dist/application/transform/type-combinators.cjs.map +1 -0
- package/dist/application/transform/type-combinators.mjs +42 -0
- package/dist/application/transform/type-combinators.mjs.map +1 -0
- package/dist/cli/cli-arguments.cjs +145 -0
- package/dist/cli/cli-arguments.cjs.map +1 -0
- package/dist/cli/cli-arguments.mjs +137 -0
- package/dist/cli/cli-arguments.mjs.map +1 -0
- package/dist/cli/cli-errors.cjs +81 -0
- package/dist/cli/cli-errors.cjs.map +1 -0
- package/dist/cli/cli-errors.mjs +77 -0
- package/dist/cli/cli-errors.mjs.map +1 -0
- package/dist/cli/cli-output.cjs +42 -0
- package/dist/cli/cli-output.cjs.map +1 -0
- package/dist/cli/cli-output.mjs +35 -0
- package/dist/cli/cli-output.mjs.map +1 -0
- package/dist/cli/docs-links.cjs +6 -0
- package/dist/cli/docs-links.cjs.map +1 -0
- package/dist/cli/docs-links.mjs +4 -0
- package/dist/cli/docs-links.mjs.map +1 -0
- package/dist/cli/fix-option.cjs +19 -0
- package/dist/cli/fix-option.cjs.map +1 -0
- package/dist/cli/fix-option.mjs +16 -0
- package/dist/cli/fix-option.mjs.map +1 -0
- package/dist/cli/help-text.cjs +44 -0
- package/dist/cli/help-text.cjs.map +1 -0
- package/dist/cli/help-text.mjs +42 -0
- package/dist/cli/help-text.mjs.map +1 -0
- package/dist/cli/main.cjs +67 -0
- package/dist/cli/main.cjs.map +1 -0
- package/dist/cli/main.d.cts +2 -0
- package/dist/cli/main.d.mts +2 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.mjs +59 -0
- package/dist/cli/main.mjs.map +1 -0
- package/dist/cli/redocly-apis.cjs +69 -0
- package/dist/cli/redocly-apis.cjs.map +1 -0
- package/dist/cli/redocly-apis.mjs +66 -0
- package/dist/cli/redocly-apis.mjs.map +1 -0
- package/dist/cli/ref-limits.cjs +14 -0
- package/dist/cli/ref-limits.cjs.map +1 -0
- package/dist/cli/ref-limits.mjs +12 -0
- package/dist/cli/ref-limits.mjs.map +1 -0
- package/dist/cli/run-cli.cjs +113 -0
- package/dist/cli/run-cli.cjs.map +1 -0
- package/dist/cli/run-cli.mjs +111 -0
- package/dist/cli/run-cli.mjs.map +1 -0
- package/dist/domain/assert-never.cjs +8 -0
- package/dist/domain/assert-never.cjs.map +1 -0
- package/dist/domain/assert-never.mjs +6 -0
- package/dist/domain/assert-never.mjs.map +1 -0
- package/dist/domain/errors.cjs +52 -0
- package/dist/domain/errors.cjs.map +1 -0
- package/dist/domain/errors.mjs +48 -0
- package/dist/domain/errors.mjs.map +1 -0
- package/dist/domain/ir/constructors.cjs +93 -0
- package/dist/domain/ir/constructors.cjs.map +1 -0
- package/dist/domain/ir/constructors.mjs +74 -0
- package/dist/domain/ir/constructors.mjs.map +1 -0
- package/dist/domain/ir/identifier-text.cjs +29 -0
- package/dist/domain/ir/identifier-text.cjs.map +1 -0
- package/dist/domain/ir/identifier-text.mjs +25 -0
- package/dist/domain/ir/identifier-text.mjs.map +1 -0
- package/dist/domain/ir/newer-identifier-ranges.cjs +109 -0
- package/dist/domain/ir/newer-identifier-ranges.cjs.map +1 -0
- package/dist/domain/ir/newer-identifier-ranges.mjs +106 -0
- package/dist/domain/ir/newer-identifier-ranges.mjs.map +1 -0
- package/dist/domain/ir/normalize.cjs +32 -0
- package/dist/domain/ir/normalize.cjs.map +1 -0
- package/dist/domain/ir/normalize.mjs +29 -0
- package/dist/domain/ir/normalize.mjs.map +1 -0
- package/dist/domain/ir/property-name.cjs +19 -0
- package/dist/domain/ir/property-name.cjs.map +1 -0
- package/dist/domain/ir/property-name.mjs +16 -0
- package/dist/domain/ir/property-name.mjs.map +1 -0
- package/dist/domain/ir/raw-text-escapes.cjs +25 -0
- package/dist/domain/ir/raw-text-escapes.cjs.map +1 -0
- package/dist/domain/ir/raw-text-escapes.mjs +22 -0
- package/dist/domain/ir/raw-text-escapes.mjs.map +1 -0
- package/dist/domain/openapi/admitted-values.cjs +75 -0
- package/dist/domain/openapi/admitted-values.cjs.map +1 -0
- package/dist/domain/openapi/admitted-values.mjs +72 -0
- package/dist/domain/openapi/admitted-values.mjs.map +1 -0
- package/dist/domain/openapi/alias-expansion.cjs +50 -0
- package/dist/domain/openapi/alias-expansion.cjs.map +1 -0
- package/dist/domain/openapi/alias-expansion.mjs +45 -0
- package/dist/domain/openapi/alias-expansion.mjs.map +1 -0
- package/dist/domain/openapi/binary-content.cjs +48 -0
- package/dist/domain/openapi/binary-content.cjs.map +1 -0
- package/dist/domain/openapi/binary-content.mjs +45 -0
- package/dist/domain/openapi/binary-content.mjs.map +1 -0
- package/dist/domain/openapi/components-object.cjs +29 -0
- package/dist/domain/openapi/components-object.cjs.map +1 -0
- package/dist/domain/openapi/components-object.mjs +24 -0
- package/dist/domain/openapi/components-object.mjs.map +1 -0
- package/dist/domain/openapi/discriminated-union.cjs +68 -0
- package/dist/domain/openapi/discriminated-union.cjs.map +1 -0
- package/dist/domain/openapi/discriminated-union.mjs +62 -0
- package/dist/domain/openapi/discriminated-union.mjs.map +1 -0
- package/dist/domain/openapi/discriminator-conflicts.cjs +143 -0
- package/dist/domain/openapi/discriminator-conflicts.cjs.map +1 -0
- package/dist/domain/openapi/discriminator-conflicts.mjs +141 -0
- package/dist/domain/openapi/discriminator-conflicts.mjs.map +1 -0
- package/dist/domain/openapi/json-pointer.cjs +31 -0
- package/dist/domain/openapi/json-pointer.cjs.map +1 -0
- package/dist/domain/openapi/json-pointer.mjs +27 -0
- package/dist/domain/openapi/json-pointer.mjs.map +1 -0
- package/dist/domain/openapi/media-type-object.cjs +14 -0
- package/dist/domain/openapi/media-type-object.cjs.map +1 -0
- package/dist/domain/openapi/media-type-object.mjs +11 -0
- package/dist/domain/openapi/media-type-object.mjs.map +1 -0
- package/dist/domain/openapi/parameter-object.cjs +13 -0
- package/dist/domain/openapi/parameter-object.cjs.map +1 -0
- package/dist/domain/openapi/parameter-object.mjs +10 -0
- package/dist/domain/openapi/parameter-object.mjs.map +1 -0
- package/dist/domain/openapi/path-item-object.cjs +35 -0
- package/dist/domain/openapi/path-item-object.cjs.map +1 -0
- package/dist/domain/openapi/path-item-object.mjs +30 -0
- package/dist/domain/openapi/path-item-object.mjs.map +1 -0
- package/dist/domain/openapi/path-templates.cjs +23 -0
- package/dist/domain/openapi/path-templates.cjs.map +1 -0
- package/dist/domain/openapi/path-templates.mjs +21 -0
- package/dist/domain/openapi/path-templates.mjs.map +1 -0
- package/dist/domain/openapi/unsupported-features.cjs +87 -0
- package/dist/domain/openapi/unsupported-features.cjs.map +1 -0
- package/dist/domain/openapi/unsupported-features.mjs +84 -0
- package/dist/domain/openapi/unsupported-features.mjs.map +1 -0
- package/dist/domain/output-fixes.cjs +101 -0
- package/dist/domain/output-fixes.cjs.map +1 -0
- package/dist/domain/output-fixes.mjs +94 -0
- package/dist/domain/output-fixes.mjs.map +1 -0
- package/dist/domain/warnings.cjs +15 -0
- package/dist/domain/warnings.cjs.map +1 -0
- package/dist/domain/warnings.mjs +12 -0
- package/dist/domain/warnings.mjs.map +1 -0
- package/dist/index.cjs +98 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +841 -0
- package/dist/index.d.mts +841 -0
- package/dist/index.d.ts +841 -0
- package/dist/index.mjs +27 -0
- package/dist/index.mjs.map +1 -0
- package/dist/transform/components-object.cjs +15 -0
- package/dist/transform/components-object.cjs.map +1 -0
- package/dist/transform/components-object.mjs +11 -0
- package/dist/transform/components-object.mjs.map +1 -0
- package/dist/transform/header-object.cjs +12 -0
- package/dist/transform/header-object.cjs.map +1 -0
- package/dist/transform/header-object.mjs +10 -0
- package/dist/transform/header-object.mjs.map +1 -0
- package/dist/transform/media-type-object.cjs +12 -0
- package/dist/transform/media-type-object.cjs.map +1 -0
- package/dist/transform/media-type-object.mjs +10 -0
- package/dist/transform/media-type-object.mjs.map +1 -0
- package/dist/transform/operation-object.cjs +26 -0
- package/dist/transform/operation-object.cjs.map +1 -0
- package/dist/transform/operation-object.mjs +21 -0
- package/dist/transform/operation-object.mjs.map +1 -0
- package/dist/transform/parameter-object.cjs +12 -0
- package/dist/transform/parameter-object.cjs.map +1 -0
- package/dist/transform/parameter-object.mjs +10 -0
- package/dist/transform/parameter-object.mjs.map +1 -0
- package/dist/transform/path-item-object.cjs +12 -0
- package/dist/transform/path-item-object.cjs.map +1 -0
- package/dist/transform/path-item-object.mjs +10 -0
- package/dist/transform/path-item-object.mjs.map +1 -0
- package/dist/transform/paths-object.cjs +11 -0
- package/dist/transform/paths-object.cjs.map +1 -0
- package/dist/transform/paths-object.mjs +9 -0
- package/dist/transform/paths-object.mjs.map +1 -0
- package/dist/transform/request-body-object.cjs +12 -0
- package/dist/transform/request-body-object.cjs.map +1 -0
- package/dist/transform/request-body-object.mjs +10 -0
- package/dist/transform/request-body-object.mjs.map +1 -0
- package/dist/transform/response-object.cjs +12 -0
- package/dist/transform/response-object.cjs.map +1 -0
- package/dist/transform/response-object.mjs +10 -0
- package/dist/transform/response-object.mjs.map +1 -0
- package/dist/transform/responses-object.cjs +12 -0
- package/dist/transform/responses-object.cjs.map +1 -0
- package/dist/transform/responses-object.mjs +10 -0
- package/dist/transform/responses-object.mjs.map +1 -0
- package/dist/transform/schema-object.cjs +21 -0
- package/dist/transform/schema-object.cjs.map +1 -0
- package/dist/transform/schema-object.mjs +16 -0
- package/dist/transform/schema-object.mjs.map +1 -0
- package/package.json +115 -4
- package/src/adapters/node-file-system/node-file-system.ts +44 -0
- package/src/adapters/redocly-loader/alias-limit.ts +20 -0
- package/src/adapters/redocly-loader/allowed-hosts.ts +62 -0
- package/src/adapters/redocly-loader/bundled-ref-repair.ts +65 -0
- package/src/adapters/redocly-loader/malformed-refs.ts +61 -0
- package/src/adapters/redocly-loader/redocly-config-source.ts +78 -0
- package/src/adapters/redocly-loader/redocly-schema-loader.ts +262 -0
- package/src/adapters/redocly-loader/ref-access.ts +146 -0
- package/src/adapters/redocly-loader/ref-holders.ts +43 -0
- package/src/adapters/redocly-loader/remote-fetch.ts +104 -0
- package/src/adapters/redocly-loader/schema-load-errors.ts +124 -0
- package/src/adapters/redocly-loader/schema-source.ts +151 -0
- package/src/adapters/redocly-loader/unsupported-keys.ts +102 -0
- package/src/adapters/terminal-logger/terminal-logger.ts +98 -0
- package/src/adapters/type-ast-bridge/footer-nodes.ts +38 -0
- package/src/adapters/type-ast-bridge/ir-declarations-to-typescript.ts +100 -0
- package/src/adapters/type-ast-bridge/ir-to-typescript.ts +223 -0
- package/src/adapters/type-ast-bridge/lazy-node.ts +24 -0
- package/src/adapters/type-ast-bridge/load-typescript.ts +84 -0
- package/src/adapters/type-ast-bridge/print-typescript.ts +33 -0
- package/src/adapters/type-ast-bridge/typescript-raw-text.ts +49 -0
- package/src/adapters/type-ast-bridge/typescript-to-ir.ts +294 -0
- package/src/adapters/type-ast-bridge/typescript-types.ts +8 -0
- package/src/api/ast-to-string.ts +59 -0
- package/src/api/comment-header.ts +7 -0
- package/src/api/default-ports.ts +44 -0
- package/src/api/discriminator-conflict-warnings.ts +43 -0
- package/src/api/discriminator-enum-names.ts +26 -0
- package/src/api/discriminator-enum-parent.ts +129 -0
- package/src/api/discriminator-enum.ts +115 -0
- package/src/api/discriminator-other-owners.ts +97 -0
- package/src/api/discriminator-patch.ts +147 -0
- package/src/api/discriminator-scan.ts +260 -0
- package/src/api/document-declarations.ts +41 -0
- package/src/api/document-refs.ts +71 -0
- package/src/api/document-run.ts +177 -0
- package/src/api/enum-values-warnings.ts +21 -0
- package/src/api/footer-entry.ts +23 -0
- package/src/api/footer-sink.ts +67 -0
- package/src/api/legacy-callback-warning.ts +29 -0
- package/src/api/legacy-ts-helpers.ts +311 -0
- package/src/api/legacy-utils.ts +118 -0
- package/src/api/openapi-ts.ts +62 -0
- package/src/api/path-template-warnings.ts +27 -0
- package/src/api/schema-callbacks.ts +211 -0
- package/src/api/string-to-ast.ts +27 -0
- package/src/api/transform-context.ts +93 -0
- package/src/api/transform-schema.ts +123 -0
- package/src/api/type-helpers.ts +130 -0
- package/src/api/unsupported-feature-warnings.ts +33 -0
- package/src/application/ports/file-system.ts +12 -0
- package/src/application/ports/logger.ts +16 -0
- package/src/application/ports/redocly-config-source.ts +20 -0
- package/src/application/ports/schema-loader.ts +32 -0
- package/src/application/print/comment-writer.ts +91 -0
- package/src/application/print/declaration-printer.ts +100 -0
- package/src/application/print/literal-text.ts +62 -0
- package/src/application/print/print-nodes.ts +62 -0
- package/src/application/print/print-options.ts +11 -0
- package/src/application/print/text-writer.ts +83 -0
- package/src/application/print/type-printer.ts +287 -0
- package/src/application/stack-overflow.ts +54 -0
- package/src/application/transform/document/assignability.ts +203 -0
- package/src/application/transform/document/components.ts +189 -0
- package/src/application/transform/document/declared-types.ts +93 -0
- package/src/application/transform/document/defs-root.ts +25 -0
- package/src/application/transform/document/document-member.ts +20 -0
- package/src/application/transform/document/document.ts +215 -0
- package/src/application/transform/document/exploded-query.ts +91 -0
- package/src/application/transform/document/global-type-references.ts +78 -0
- package/src/application/transform/document/header.ts +34 -0
- package/src/application/transform/document/kept-deprecated.ts +135 -0
- package/src/application/transform/document/list-assignability.ts +87 -0
- package/src/application/transform/document/media-type.ts +78 -0
- package/src/application/transform/document/operation.ts +64 -0
- package/src/application/transform/document/parameter.ts +45 -0
- package/src/application/transform/document/parameters.ts +265 -0
- package/src/application/transform/document/path-item.ts +168 -0
- package/src/application/transform/document/path-key-overlaps.ts +201 -0
- package/src/application/transform/document/path-template-replace.ts +90 -0
- package/src/application/transform/document/paths-enum.ts +127 -0
- package/src/application/transform/document/paths.ts +273 -0
- package/src/application/transform/document/request-body.ts +50 -0
- package/src/application/transform/document/response.ts +109 -0
- package/src/application/transform/document/responses.ts +29 -0
- package/src/application/transform/document/root-type-aliases.ts +107 -0
- package/src/application/transform/document/template-key-match.ts +183 -0
- package/src/application/transform/document/type-assignability.ts +268 -0
- package/src/application/transform/document/type-key.ts +80 -0
- package/src/application/transform/document/type-resolution.ts +163 -0
- package/src/application/transform/document/webhooks.ts +22 -0
- package/src/application/transform/document-entries.ts +28 -0
- package/src/application/transform/footer/document-footer.ts +212 -0
- package/src/application/transform/footer/enum-naming.ts +210 -0
- package/src/application/transform/footer/enum-values-check.ts +171 -0
- package/src/application/transform/footer/evaluation.ts +47 -0
- package/src/application/transform/footer/shared-enum-names.ts +86 -0
- package/src/application/transform/footer/type-evaluation.ts +294 -0
- package/src/application/transform/footer/type-rules.ts +269 -0
- package/src/application/transform/helper-types.ts +92 -0
- package/src/application/transform/literal-type.ts +54 -0
- package/src/application/transform/numbered-names.ts +20 -0
- package/src/application/transform/ref-pointer/generated-location.ts +211 -0
- package/src/application/transform/ref-pointer/generated-shape.ts +275 -0
- package/src/application/transform/ref-pointer/inline-cycles.ts +56 -0
- package/src/application/transform/ref-pointer/original-index.ts +95 -0
- package/src/application/transform/ref-pointer/pointer-type.ts +92 -0
- package/src/application/transform/ref-pointer/pointer-walk.ts +96 -0
- package/src/application/transform/ref-pointer/typed-walk.ts +192 -0
- package/src/application/transform/ref-type.ts +102 -0
- package/src/application/transform/schema/access-flags.ts +63 -0
- package/src/application/transform/schema/array-type.ts +213 -0
- package/src/application/transform/schema/composition-type.ts +255 -0
- package/src/application/transform/schema/core-type.ts +119 -0
- package/src/application/transform/schema/discriminated-union.ts +58 -0
- package/src/application/transform/schema/discriminator-property.ts +33 -0
- package/src/application/transform/schema/enum-rule.ts +280 -0
- package/src/application/transform/schema/inherited-discriminator.ts +54 -0
- package/src/application/transform/schema/object-type.ts +289 -0
- package/src/application/transform/schema/presence-members.ts +96 -0
- package/src/application/transform/schema/required-variants.ts +88 -0
- package/src/application/transform/schema/schema-context.ts +136 -0
- package/src/application/transform/schema/schema-rule.ts +29 -0
- package/src/application/transform/schema/schema-transform.ts +99 -0
- package/src/application/transform/schema/unevaluated-properties.ts +105 -0
- package/src/application/transform/schema-comment.ts +196 -0
- package/src/application/transform/shared-types.ts +9 -0
- package/src/application/transform/transform-context.ts +51 -0
- package/src/application/transform/type-combinators.ts +57 -0
- package/src/cli/cli-arguments.ts +208 -0
- package/src/cli/cli-dependencies.ts +47 -0
- package/src/cli/cli-errors.ts +127 -0
- package/src/cli/cli-output.ts +67 -0
- package/src/cli/docs-links.ts +6 -0
- package/src/cli/fix-option.ts +29 -0
- package/src/cli/help-text.ts +52 -0
- package/src/cli/main.ts +73 -0
- package/src/cli/redocly-apis.ts +95 -0
- package/src/cli/ref-limits.ts +16 -0
- package/src/cli/run-cli.ts +131 -0
- package/src/domain/assert-never.ts +8 -0
- package/src/domain/errors.ts +76 -0
- package/src/domain/ir/constructors.ts +142 -0
- package/src/domain/ir/identifier-text.ts +49 -0
- package/src/domain/ir/newer-identifier-ranges.ts +109 -0
- package/src/domain/ir/nodes.ts +225 -0
- package/src/domain/ir/normalize.ts +51 -0
- package/src/domain/ir/property-name.ts +28 -0
- package/src/domain/ir/raw-text-escapes.ts +37 -0
- package/src/domain/openapi/admitted-values.ts +113 -0
- package/src/domain/openapi/alias-expansion.ts +72 -0
- package/src/domain/openapi/binary-content.ts +74 -0
- package/src/domain/openapi/components-object.ts +52 -0
- package/src/domain/openapi/discriminated-union.ts +109 -0
- package/src/domain/openapi/discriminator-conflicts.ts +251 -0
- package/src/domain/openapi/document-object.ts +12 -0
- package/src/domain/openapi/header-object.ts +9 -0
- package/src/domain/openapi/json-pointer.ts +46 -0
- package/src/domain/openapi/media-type-object.ts +26 -0
- package/src/domain/openapi/operation-object.ts +13 -0
- package/src/domain/openapi/parameter-object.ts +34 -0
- package/src/domain/openapi/path-item-object.ts +70 -0
- package/src/domain/openapi/path-templates.ts +31 -0
- package/src/domain/openapi/request-body-object.ts +7 -0
- package/src/domain/openapi/response-object.ts +14 -0
- package/src/domain/openapi/schema-object.ts +61 -0
- package/src/domain/openapi/unsupported-features.ts +139 -0
- package/src/domain/output-fixes.ts +136 -0
- package/src/domain/warnings.ts +20 -0
- package/src/index.ts +67 -0
- package/src/transform/components-object.ts +27 -0
- package/src/transform/header-object.ts +19 -0
- package/src/transform/media-type-object.ts +19 -0
- package/src/transform/operation-object.ts +36 -0
- package/src/transform/parameter-object.ts +19 -0
- package/src/transform/parameters-array.ts +19 -0
- package/src/transform/path-item-object.ts +22 -0
- package/src/transform/paths-enum.ts +8 -0
- package/src/transform/paths-object.ts +15 -0
- package/src/transform/request-body-object.ts +19 -0
- package/src/transform/response-object.ts +19 -0
- package/src/transform/responses-object.ts +19 -0
- package/src/transform/schema-object.ts +36 -0
- package/src/transform/webhooks-object.ts +15 -0
- package/src/types/generator-options.ts +278 -0
- package/src/types/openapi-common.ts +100 -0
- package/src/types/openapi-document.ts +196 -0
- package/src/types/openapi-path-item.ts +130 -0
- package/src/types/openapi-request.ts +209 -0
- package/src/types/openapi-response.ts +81 -0
- package/src/types/openapi-schema.ts +169 -0
- package/src/types/openapi-security.ts +116 -0
- package/src/types.ts +12 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { irObject, irProperty } from "../../../domain/ir/constructors.js";
|
|
2
|
+
import type {
|
|
3
|
+
IrMember,
|
|
4
|
+
IrObjectType,
|
|
5
|
+
IrPropertySignature,
|
|
6
|
+
IrType,
|
|
7
|
+
} from "../../../domain/ir/nodes.js";
|
|
8
|
+
import { toPropertyName } from "../../../domain/ir/property-name.js";
|
|
9
|
+
import {
|
|
10
|
+
type Evaluated,
|
|
11
|
+
type Evaluation,
|
|
12
|
+
MISSING,
|
|
13
|
+
OPAQUE,
|
|
14
|
+
propertyKey,
|
|
15
|
+
unionType,
|
|
16
|
+
} from "./evaluation.js";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Rules of TypeScript about intersections, `Omit` and `Extract` that the `--enum-values` check
|
|
20
|
+
* needs (ADR-027). They read the types as written, before `FlattenedDeepRequired`.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/** The part of the evaluator these rules use. */
|
|
24
|
+
export interface TypeExpansion {
|
|
25
|
+
membersOf(value: Evaluated): readonly Evaluation[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A unit value of a type: a literal, `null` or `undefined`. */
|
|
29
|
+
type Unit = string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The parts an intersection is made of, nested intersections flattened: each object type, or
|
|
33
|
+
* `null` for a part that is not one.
|
|
34
|
+
*/
|
|
35
|
+
function objectParts(
|
|
36
|
+
types: TypeExpansion,
|
|
37
|
+
value: Evaluated,
|
|
38
|
+
parts: readonly IrType[],
|
|
39
|
+
): (IrObjectType | null)[] {
|
|
40
|
+
return parts.flatMap((part) => {
|
|
41
|
+
const members = types.membersOf({ ...value, type: part });
|
|
42
|
+
const [only] = members;
|
|
43
|
+
if (members.length !== 1 || only?.kind !== "type") {
|
|
44
|
+
return [null];
|
|
45
|
+
}
|
|
46
|
+
if (only.type.kind === "intersection") {
|
|
47
|
+
return objectParts(types, only, only.type.types);
|
|
48
|
+
}
|
|
49
|
+
return [only.type.kind === "object" ? only.type : null];
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function unitOf(type: IrType): Unit | null {
|
|
54
|
+
switch (type.kind) {
|
|
55
|
+
case "stringLiteral":
|
|
56
|
+
return `s:${type.value}`;
|
|
57
|
+
case "numberLiteral":
|
|
58
|
+
return `n:${type.value}`;
|
|
59
|
+
case "booleanLiteral":
|
|
60
|
+
return `b:${type.value}`;
|
|
61
|
+
case "keyword":
|
|
62
|
+
return type.keyword === "null" || type.keyword === "undefined" ? type.keyword : null;
|
|
63
|
+
default:
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The unit values of a type made only of units, or `null` where it has other values. */
|
|
69
|
+
function unitsOf(types: TypeExpansion, value: Evaluated, type: IrType): ReadonlySet<Unit> | null {
|
|
70
|
+
const units = types.membersOf({ ...value, type }).map((member) => {
|
|
71
|
+
return member.kind === "type" ? unitOf(member.type) : null;
|
|
72
|
+
});
|
|
73
|
+
return units.includes(null) ? null : new Set(units as Unit[]);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function propertiesNamed(objects: readonly IrObjectType[], key: string): IrPropertySignature[] {
|
|
77
|
+
return objects.flatMap((object) => {
|
|
78
|
+
const members: readonly IrMember[] = object.members;
|
|
79
|
+
return members.filter(
|
|
80
|
+
(member): member is IrPropertySignature =>
|
|
81
|
+
member.kind === "property" && propertyKey(member.name) === key,
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Whether properties of the same name share no unit value, one of them required. */
|
|
87
|
+
function isNeverProperty(
|
|
88
|
+
types: TypeExpansion,
|
|
89
|
+
value: Evaluated,
|
|
90
|
+
found: IrPropertySignature[],
|
|
91
|
+
): boolean {
|
|
92
|
+
if (found.length < 2 || found.every((property) => property.isOptional)) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
const sets = found.map((property) => unitsOf(types, value, property.type));
|
|
96
|
+
if (sets.includes(null)) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
// At least two properties, so at least two sets.
|
|
100
|
+
const [first, ...rest] = sets as [ReadonlySet<Unit>, ...ReadonlySet<Unit>[]];
|
|
101
|
+
const shared = [...first].filter((unit) => rest.every((set) => set.has(unit)));
|
|
102
|
+
return shared.length === 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Whether an intersection has `null` or `undefined` next to an object: `null & { a: 1 }`. */
|
|
106
|
+
function isNullishObject(types: TypeExpansion, value: Evaluated, parts: readonly IrType[]) {
|
|
107
|
+
const singles = parts.map((part) => {
|
|
108
|
+
const members = types.membersOf({ ...value, type: part });
|
|
109
|
+
const [only] = members;
|
|
110
|
+
return members.length === 1 && only?.kind === "type" ? only.type : null;
|
|
111
|
+
});
|
|
112
|
+
const isNullish = (type: IrType | null) =>
|
|
113
|
+
type?.kind === "keyword" && (type.keyword === "null" || type.keyword === "undefined");
|
|
114
|
+
return singles.some(isNullish) && singles.some((type) => type?.kind === "object");
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Whether TypeScript reduces an intersection to `never`: `null` or `undefined` meets an object,
|
|
119
|
+
* or objects share a property with literal types that have no value in common, one of them
|
|
120
|
+
* requiring it (`{ a: "x" } & { a: "y" }`). Other properties are left alone, so the answer is
|
|
121
|
+
* sure where it is yes.
|
|
122
|
+
*/
|
|
123
|
+
export function isNeverIntersection(
|
|
124
|
+
types: TypeExpansion,
|
|
125
|
+
value: Evaluated,
|
|
126
|
+
parts: readonly IrType[],
|
|
127
|
+
): boolean {
|
|
128
|
+
if (isNullishObject(types, value, parts)) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
const objects = objectParts(types, value, parts).filter((part) => part !== null);
|
|
132
|
+
if (objects.length < 2) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
const keys = new Set(
|
|
136
|
+
objects.flatMap((object) =>
|
|
137
|
+
object.members.flatMap((member) =>
|
|
138
|
+
member.kind === "property" ? [propertyKey(member.name)] : [],
|
|
139
|
+
),
|
|
140
|
+
),
|
|
141
|
+
);
|
|
142
|
+
const valueOfKeys = { ...value, deep: false };
|
|
143
|
+
return [...keys].some((key) =>
|
|
144
|
+
isNeverProperty(types, valueOfKeys, propertiesNamed(objects, key)),
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Whether `key` reaches only an index signature of this object: it declares no such property. */
|
|
149
|
+
function isSignatureOnly(types: TypeExpansion, value: Evaluated, key: string | null): boolean {
|
|
150
|
+
const members = types.membersOf(value);
|
|
151
|
+
const [only] = members;
|
|
152
|
+
if (
|
|
153
|
+
key === null ||
|
|
154
|
+
members.length !== 1 ||
|
|
155
|
+
only?.kind !== "type" ||
|
|
156
|
+
only.type.kind !== "object"
|
|
157
|
+
) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
const { members: declared } = only.type;
|
|
161
|
+
const hasSignature = declared.some((member) => member.kind === "indexSignature");
|
|
162
|
+
return hasSignature && propertiesNamed([only.type], key).length === 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The parts of an intersection indexed by `index`, as TypeScript reads them: where one part
|
|
167
|
+
* declares the property, the index signatures of the others do not take part
|
|
168
|
+
* (`{ a: X } & { [key: string]: Y }` gives `X` for `a`).
|
|
169
|
+
*/
|
|
170
|
+
export function declaredFirst(
|
|
171
|
+
types: TypeExpansion,
|
|
172
|
+
value: Evaluated,
|
|
173
|
+
key: string | null,
|
|
174
|
+
parts: readonly { readonly type: IrType; readonly found: Evaluation }[],
|
|
175
|
+
): Evaluation[] {
|
|
176
|
+
const bySignature = parts.map(({ type }) => isSignatureOnly(types, { ...value, type }, key));
|
|
177
|
+
const isDeclared = parts.some(({ found }, at) => found.kind === "type" && !bySignature[at]);
|
|
178
|
+
return parts.filter((_, at) => !(isDeclared && bySignature[at])).map(({ found }) => found);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Whether a member of `membersOf` has `key` as a property that `{ key: unknown }` accepts: written
|
|
183
|
+
* and, outside `FlattenedDeepRequired`, required. An index signature does not count, as in
|
|
184
|
+
* TypeScript. Such a member is expanded, parts included, so it is an object, an intersection of
|
|
185
|
+
* members, or a primitive or array type, which has no such property; a type the evaluator cannot
|
|
186
|
+
* read makes `membersOf` opaque instead.
|
|
187
|
+
*/
|
|
188
|
+
function hasKey(value: Evaluated, key: string): boolean {
|
|
189
|
+
const { type } = value;
|
|
190
|
+
if (type.kind === "intersection") {
|
|
191
|
+
return type.types.some((part) => hasKey({ ...value, type: part }, key));
|
|
192
|
+
}
|
|
193
|
+
if (type.kind !== "object") {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
return propertiesNamed([type], key).some((property) => value.deep || !property.isOptional);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* `Extract<T, { key: unknown }>`: the members of `T` that have `key`. When none has it the
|
|
201
|
+
* result is `never`; it is `missing` here, as the location then types nothing.
|
|
202
|
+
*/
|
|
203
|
+
export function extracted(types: TypeExpansion, value: Evaluated, key: string): Evaluation {
|
|
204
|
+
const members = types.membersOf(value);
|
|
205
|
+
if (members.some((member) => member.kind !== "type")) {
|
|
206
|
+
return OPAQUE;
|
|
207
|
+
}
|
|
208
|
+
const kept = (members as Evaluated[]).filter((member) => hasKey(member, key));
|
|
209
|
+
if (kept.length === 0) {
|
|
210
|
+
return MISSING;
|
|
211
|
+
}
|
|
212
|
+
return { ...value, type: unionType(kept.map((member) => member.type)) };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function omittedKeys(types: TypeExpansion, value: Evaluated, keys: IrType): Set<string> | null {
|
|
216
|
+
const members = types.membersOf({ ...value, type: keys });
|
|
217
|
+
const names = members.map((member) =>
|
|
218
|
+
member.kind === "type" && member.type.kind === "stringLiteral" ? member.type.value : null,
|
|
219
|
+
);
|
|
220
|
+
return names.includes(null) ? null : new Set(names as string[]);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** Whether two members name the same property: merging them would need their intersection. */
|
|
224
|
+
function hasSharedProperty(members: readonly IrMember[]): boolean {
|
|
225
|
+
const names = members.flatMap((member) =>
|
|
226
|
+
member.kind === "property" ? [propertyKey(member.name)] : [],
|
|
227
|
+
);
|
|
228
|
+
return new Set(names).size !== names.length;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* `Omit<T, K>` for literal keys `K` over an object or an intersection of objects. A string index
|
|
233
|
+
* signature makes `keyof T` all strings, so only the index signatures are left.
|
|
234
|
+
*/
|
|
235
|
+
export function omitted(types: TypeExpansion, value: Evaluated, keys: IrType): Evaluation {
|
|
236
|
+
const names = omittedKeys(types, value, keys);
|
|
237
|
+
const objects = objectParts(types, value, [value.type]);
|
|
238
|
+
if (names === null || objects.length === 0 || objects.includes(null)) {
|
|
239
|
+
return OPAQUE;
|
|
240
|
+
}
|
|
241
|
+
const members = (objects as IrObjectType[]).flatMap((object) => object.members);
|
|
242
|
+
if (hasSharedProperty(members)) {
|
|
243
|
+
return OPAQUE;
|
|
244
|
+
}
|
|
245
|
+
const signatures = members.filter((member) => member.kind === "indexSignature");
|
|
246
|
+
const kept =
|
|
247
|
+
signatures.length > 0
|
|
248
|
+
? signatures
|
|
249
|
+
: members.filter(
|
|
250
|
+
(member) => member.kind !== "property" || !names.has(propertyKey(member.name)),
|
|
251
|
+
);
|
|
252
|
+
return { ...value, type: { kind: "object", members: kept } };
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** The `--read-write-markers` types and their one member (`READ_WRITE_MARKER_TYPES`). */
|
|
256
|
+
const READ_WRITE_MARKER_KEYS: ReadonlyMap<string, string> = new Map([
|
|
257
|
+
["$Read", "$read"],
|
|
258
|
+
["$Write", "$write"],
|
|
259
|
+
]);
|
|
260
|
+
|
|
261
|
+
/** `$Read<T>` is `{ readonly $read: T }`: an object, which holds no enum value. */
|
|
262
|
+
export function markerObject(name: string, argument: Evaluated): Evaluated | null {
|
|
263
|
+
const key = READ_WRITE_MARKER_KEYS.get(name);
|
|
264
|
+
if (key === undefined) {
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
const member = irProperty(toPropertyName(key), argument.type, { isReadonly: true });
|
|
268
|
+
return { ...argument, type: irObject([member]) };
|
|
269
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The helper type aliases the generator adds to the footer, declared once each. The text is the
|
|
3
|
+
* original's source text as the TypeScript printer printed it, so printing it as written gives
|
|
4
|
+
* the original output (ENGINEERING_PLAN 6.2 and 6.6), except for the fixes noted below.
|
|
5
|
+
*/
|
|
6
|
+
export interface HelperType {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly text: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function lines(...parts: readonly string[]): string {
|
|
12
|
+
return parts.join("\n");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const HELPER_TYPES = {
|
|
16
|
+
withRequired: {
|
|
17
|
+
name: "WithRequired",
|
|
18
|
+
text: lines("type WithRequired<T, K extends keyof T> = T & {", " [P in K]-?: T[P];", "};"),
|
|
19
|
+
},
|
|
20
|
+
// `unevaluated-properties` (roadmap R11): the value types of every member of a union, so a
|
|
21
|
+
// `$ref` to a `oneOf` schema gives the values of each variant, not only of the shared keys.
|
|
22
|
+
propertyValues: {
|
|
23
|
+
name: "PropertyValues",
|
|
24
|
+
text: "type PropertyValues<T> = T extends unknown ? T[keyof T] : never;",
|
|
25
|
+
},
|
|
26
|
+
// Task 7.4 changes the original text on purpose: `readonly unknown[]` also flattens the arrays
|
|
27
|
+
// of `--immutable` (upstream #2714, #2749), and `NonNullable` looks through nullable parents
|
|
28
|
+
// (upstream #2737). The old text did not compile for those schemas.
|
|
29
|
+
flattenedDeepRequired: {
|
|
30
|
+
name: "FlattenedDeepRequired",
|
|
31
|
+
text: lines(
|
|
32
|
+
"type FlattenedDeepRequired<T> = {",
|
|
33
|
+
" [K in keyof T]-?: FlattenedDeepRequired<T[K] extends readonly unknown[] | undefined | " +
|
|
34
|
+
"null ? Extract<T[K], readonly unknown[]>[number] : NonNullable<T[K]>>;",
|
|
35
|
+
"};",
|
|
36
|
+
),
|
|
37
|
+
},
|
|
38
|
+
// `readonly unknown[]`: a readonly array value type stays as is (upstream #2749).
|
|
39
|
+
readonlyArray: {
|
|
40
|
+
name: "ReadonlyArray",
|
|
41
|
+
text: lines(
|
|
42
|
+
"type ReadonlyArray<T> = [",
|
|
43
|
+
" Exclude<T, undefined>",
|
|
44
|
+
"] extends [",
|
|
45
|
+
" readonly unknown[]",
|
|
46
|
+
"] ? Readonly<Exclude<T, undefined>> : Readonly<Exclude<T, undefined>[]>;",
|
|
47
|
+
),
|
|
48
|
+
},
|
|
49
|
+
} as const satisfies Readonly<Record<string, HelperType>>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The `--read-write-markers` helper types, written before the root types. Task 7.6 replaces the
|
|
53
|
+
* original text on purpose (ADR-014): primitives (also branded), readonly arrays, tuples,
|
|
54
|
+
* intersected arrays and null-only properties keep their types (upstream #2615, #2620, #2632,
|
|
55
|
+
* #2717, #2765). The declarations equal `Readable` / `Writable` of openapi-typesafe-helpers
|
|
56
|
+
* (`test/api/read-write-marker-types.test.ts`); the text is what the TypeScript printer prints.
|
|
57
|
+
*/
|
|
58
|
+
export const READ_WRITE_MARKER_TYPES = lines(
|
|
59
|
+
"export type $Read<T> = {",
|
|
60
|
+
" readonly $read: T;",
|
|
61
|
+
"};",
|
|
62
|
+
"export type $Write<T> = {",
|
|
63
|
+
" readonly $write: T;",
|
|
64
|
+
"};",
|
|
65
|
+
"type ReadWritePrimitive = string | number | boolean | bigint | symbol | null | undefined;",
|
|
66
|
+
"type ReadWriteLeaf = ReadWritePrimitive | ((...args: never) => unknown);",
|
|
67
|
+
"type ReadWriteMarkedKeys<T, Marker> = {",
|
|
68
|
+
" [K in keyof T]-?: NonNullable<T[K]> extends never ? never : NonNullable<T[K]> " +
|
|
69
|
+
"extends Marker ? K : never;",
|
|
70
|
+
"}[keyof T];",
|
|
71
|
+
'type ReadWriteResolveArray<T extends readonly unknown[], Resolved extends "read" | ' +
|
|
72
|
+
'"write"> = T[number][] extends T ? T extends unknown[] ? ReadWriteResolve<T[number], ' +
|
|
73
|
+
"Resolved>[] : readonly ReadWriteResolve<T[number], Resolved>[] : {",
|
|
74
|
+
" [K in keyof T]: ReadWriteResolve<T[K], Resolved>;",
|
|
75
|
+
"};",
|
|
76
|
+
'type ReadWriteResolve<T, Resolved extends "read" | "write"> = Resolved extends "read" ? ' +
|
|
77
|
+
"Readable<T> : Writable<T>;",
|
|
78
|
+
"export type Readable<T> = T extends $Write<any> ? never : T extends $Read<infer U> ? " +
|
|
79
|
+
"Readable<U> : T extends ReadWriteLeaf ? T : T extends readonly unknown[] ? " +
|
|
80
|
+
'ReadWriteResolveArray<T, "read"> : T extends object ? {',
|
|
81
|
+
" [K in keyof T as K extends ReadWriteMarkedKeys<T, $Write<any>> ? never : K]: " +
|
|
82
|
+
"Readable<T[K]>;",
|
|
83
|
+
"} : T;",
|
|
84
|
+
"export type Writable<T> = T extends $Read<any> ? never : T extends $Write<infer U> ? " +
|
|
85
|
+
"Writable<U> : T extends ReadWriteLeaf ? T : T extends readonly unknown[] ? " +
|
|
86
|
+
'ReadWriteResolveArray<T, "write"> : T extends object ? {',
|
|
87
|
+
" [K in keyof T as K extends ReadWriteMarkedKeys<T, $Read<any>> ? never : K]: " +
|
|
88
|
+
"Writable<T[K]>;",
|
|
89
|
+
"} & {",
|
|
90
|
+
" [K in ReadWriteMarkedKeys<T, $Read<any>>]?: never;",
|
|
91
|
+
"} : T;",
|
|
92
|
+
);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
irArray,
|
|
3
|
+
irBoolean,
|
|
4
|
+
irKeyword,
|
|
5
|
+
irNumber,
|
|
6
|
+
irObject,
|
|
7
|
+
irProperty,
|
|
8
|
+
irRaw,
|
|
9
|
+
irRecord,
|
|
10
|
+
irString,
|
|
11
|
+
irTuple,
|
|
12
|
+
irTupleElement,
|
|
13
|
+
} from "../../domain/ir/constructors.js";
|
|
14
|
+
import type { IrType } from "../../domain/ir/nodes.js";
|
|
15
|
+
import { toPropertyName } from "../../domain/ir/property-name.js";
|
|
16
|
+
import { UNKNOWN_TYPE } from "./shared-types.js";
|
|
17
|
+
|
|
18
|
+
function objectLiteralType(value: object): IrType {
|
|
19
|
+
const members = Object.entries(value).map(([key, entry]) =>
|
|
20
|
+
irProperty(toPropertyName(key), literalType(entry)),
|
|
21
|
+
);
|
|
22
|
+
return members.length > 0 ? irObject(members) : irRecord(irKeyword("string"), irKeyword("never"));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function arrayLiteralType(value: readonly unknown[]): IrType {
|
|
26
|
+
return value.length === 0
|
|
27
|
+
? irArray(irKeyword("never"))
|
|
28
|
+
: irTuple(value.map((item) => irTupleElement(literalType(item))));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The literal type of a JSON value (the original `tsLiteral`): strings as JSON text, arrays as
|
|
33
|
+
* tuples (an empty one as `never[]`), objects as object types (an empty one as
|
|
34
|
+
* `Record<string, never>`), and anything else (`undefined`, functions) as `unknown`.
|
|
35
|
+
*/
|
|
36
|
+
export function literalType(value: unknown): IrType {
|
|
37
|
+
if (typeof value === "string") {
|
|
38
|
+
return irString(value, "json");
|
|
39
|
+
}
|
|
40
|
+
if (typeof value === "number") {
|
|
41
|
+
// YAML `.nan` and `.inf` have no literal type; the original prints them as `NaN`, `-Infinity`.
|
|
42
|
+
return Number.isFinite(value) ? irNumber(value) : irRaw(String(value));
|
|
43
|
+
}
|
|
44
|
+
if (typeof value === "boolean") {
|
|
45
|
+
return irBoolean(value);
|
|
46
|
+
}
|
|
47
|
+
if (value === null) {
|
|
48
|
+
return irKeyword("null");
|
|
49
|
+
}
|
|
50
|
+
if (Array.isArray(value)) {
|
|
51
|
+
return arrayLiteralType(value);
|
|
52
|
+
}
|
|
53
|
+
return typeof value === "object" ? objectLiteralType(value) : UNKNOWN_TYPE;
|
|
54
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Builds the name for the `count`-th use of `name` (2, 3…). */
|
|
2
|
+
export type NumberedName = (name: string, count: number) => string;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Names made unique, in order: the first use of a name keeps it, each repeat gets the lowest
|
|
6
|
+
* number from 2 whose name is not written anywhere in the list.
|
|
7
|
+
*/
|
|
8
|
+
export function withNumberedRepeats(names: readonly string[], numbered: NumberedName): string[] {
|
|
9
|
+
const written = new Set(names);
|
|
10
|
+
const taken = new Set<string>();
|
|
11
|
+
return names.map((name) => {
|
|
12
|
+
let unique = name;
|
|
13
|
+
for (let count = 2; taken.has(unique); count += 1) {
|
|
14
|
+
const candidate = numbered(name, count);
|
|
15
|
+
unique = written.has(candidate) ? unique : candidate;
|
|
16
|
+
}
|
|
17
|
+
taken.add(unique);
|
|
18
|
+
return unique;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { createRef } from "../../../domain/openapi/json-pointer.js";
|
|
2
|
+
import type { RefResolver } from "../schema/schema-context.js";
|
|
3
|
+
import { isJsonObject } from "./generated-shape.js";
|
|
4
|
+
import {
|
|
5
|
+
leadingSegmentsOf,
|
|
6
|
+
type RefPointer,
|
|
7
|
+
refPointerOf,
|
|
8
|
+
startsInSchema,
|
|
9
|
+
} from "./pointer-walk.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Where the generator types the node a `$ref` points at: the location path it passes down, which
|
|
13
|
+
* also names the node's `--enum` declaration and `--enum-values` array. A target written inline
|
|
14
|
+
* (ADR-026) is typed there, so it shares the generator's enum instead of declaring a second one
|
|
15
|
+
* named after the pointer: two TypeScript enums with the same members are not assignable.
|
|
16
|
+
*
|
|
17
|
+
* The path follows the generator: `properties` is skipped; `allOf/N`, `items`, `prefixItems/N`,
|
|
18
|
+
* `patternProperties/P` and `additionalProperties` type their schema at the parent's location;
|
|
19
|
+
* the `schema` of a parameter, header or media type is typed at the container's; a positional
|
|
20
|
+
* parameter is named by `in` and `name`. A `$ref` crossed on the way continues at its target's
|
|
21
|
+
* location. A node under a schema keyword the generator does not type (`definitions/A`, `not`) is
|
|
22
|
+
* typed nowhere else, so it keeps its pointer as its location.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export interface GeneratedLocation {
|
|
26
|
+
readonly path: string;
|
|
27
|
+
/** The node is an `additionalProperties` value, as `transformNested` is told. */
|
|
28
|
+
readonly isFromAdditionalProperties: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface LocationWalk {
|
|
32
|
+
readonly path: readonly string[];
|
|
33
|
+
readonly node: unknown;
|
|
34
|
+
readonly isSchema: boolean;
|
|
35
|
+
readonly isFromAdditionalProperties: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** One step: the segments it adds to the path, the node it moves to, the segments it reads. */
|
|
39
|
+
interface Step {
|
|
40
|
+
readonly path: readonly string[];
|
|
41
|
+
readonly child: unknown;
|
|
42
|
+
readonly length: 1 | 2;
|
|
43
|
+
readonly isSchema: boolean;
|
|
44
|
+
readonly isFromAdditionalProperties?: boolean;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Keywords followed by a name or position whose schema is typed at the parent's location. */
|
|
48
|
+
const PARENT_LOCATION_PAIRS: ReadonlySet<string> = new Set([
|
|
49
|
+
"allOf",
|
|
50
|
+
"prefixItems",
|
|
51
|
+
"patternProperties",
|
|
52
|
+
]);
|
|
53
|
+
/** Keywords whose schema is typed at the parent's location as a record value. */
|
|
54
|
+
const RECORD_VALUE_KEYWORDS: ReadonlySet<string> = new Set([
|
|
55
|
+
"additionalProperties",
|
|
56
|
+
"unevaluatedProperties",
|
|
57
|
+
]);
|
|
58
|
+
/** Keywords followed by a name or position that both stay in the location. */
|
|
59
|
+
const KEPT_PAIRS: ReadonlySet<string> = new Set(["anyOf", "oneOf", "$defs"]);
|
|
60
|
+
/** The other schema keywords the generator types: at the parent's location. */
|
|
61
|
+
const PARENT_LOCATION_KEYWORDS: ReadonlySet<string> = new Set(["items", ...RECORD_VALUE_KEYWORDS]);
|
|
62
|
+
const INDEX_RE = /^\d+$/;
|
|
63
|
+
|
|
64
|
+
function childOf(node: unknown, segment: string | undefined): unknown {
|
|
65
|
+
return (isJsonObject(node) || Array.isArray(node)) && segment !== undefined
|
|
66
|
+
? (node as Readonly<Record<string, unknown>>)[segment]
|
|
67
|
+
: undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function pairStep(value: unknown, next: string | undefined, path: readonly string[]): Step {
|
|
71
|
+
return { path, child: childOf(value, next), length: 2, isSchema: true };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** The step through a schema keyword; null for a keyword the generator does not type. */
|
|
75
|
+
function schemaStep(node: unknown, segment: string, next: string | undefined): Step | null {
|
|
76
|
+
const value = childOf(node, segment);
|
|
77
|
+
const named = next === undefined ? [] : [next];
|
|
78
|
+
if (segment === "properties") {
|
|
79
|
+
return pairStep(value, next, named);
|
|
80
|
+
}
|
|
81
|
+
if (PARENT_LOCATION_PAIRS.has(segment) || (segment === "items" && Array.isArray(value))) {
|
|
82
|
+
return pairStep(value, next, []);
|
|
83
|
+
}
|
|
84
|
+
if (KEPT_PAIRS.has(segment)) {
|
|
85
|
+
return pairStep(value, next, [segment, ...named]);
|
|
86
|
+
}
|
|
87
|
+
if (!PARENT_LOCATION_KEYWORDS.has(segment)) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const isRecordValue = RECORD_VALUE_KEYWORDS.has(segment);
|
|
91
|
+
return {
|
|
92
|
+
path: [],
|
|
93
|
+
child: value,
|
|
94
|
+
length: 1,
|
|
95
|
+
isSchema: true,
|
|
96
|
+
isFromAdditionalProperties: isRecordValue,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** A path item's own parameters sit under one more `parameters` segment (`pathItemType`). */
|
|
101
|
+
function isPathItem(path: readonly string[]): boolean {
|
|
102
|
+
const [root, section] = path;
|
|
103
|
+
return (
|
|
104
|
+
(path.length === 2 && (root === "paths" || root === "webhooks")) ||
|
|
105
|
+
(path.length === 3 && root === "components" && section === "pathItems")
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** `parameters/N`: the parameter is named by `in` and `name` (a `$ref` one is crossed later). */
|
|
110
|
+
function parameterStep(walk: LocationWalk, next: string): Step {
|
|
111
|
+
const entry = childOf(childOf(walk.node, "parameters"), next);
|
|
112
|
+
const where = isJsonObject(entry) ? [String(entry.in), String(entry.name)] : [];
|
|
113
|
+
const prefix = isPathItem(walk.path) ? ["parameters"] : [];
|
|
114
|
+
return { path: [...prefix, "parameters", ...where], child: entry, length: 2, isSchema: false };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function documentStep(walk: LocationWalk, segments: readonly string[], index: number): Step {
|
|
118
|
+
const segment = segments[index] as string;
|
|
119
|
+
const next = segments[index + 1];
|
|
120
|
+
const value = childOf(walk.node, segment);
|
|
121
|
+
if (segment === "schema") {
|
|
122
|
+
return { path: [], child: value, length: 1, isSchema: true };
|
|
123
|
+
}
|
|
124
|
+
if (segment === "parameters" && next !== undefined && INDEX_RE.test(next)) {
|
|
125
|
+
return parameterStep(walk, next);
|
|
126
|
+
}
|
|
127
|
+
// A header's `content` entries are typed at `headers/<name>/<media type>` (`headerType`).
|
|
128
|
+
if (segment === "content" && segments[index - 2] === "headers") {
|
|
129
|
+
const path = next === undefined ? [] : [next];
|
|
130
|
+
return { path, child: childOf(value, next), length: 2, isSchema: false };
|
|
131
|
+
}
|
|
132
|
+
return { path: [segment], child: value, length: 1, isSchema: false };
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function stepAt(walk: LocationWalk, pointer: RefPointer, index: number): Step | null {
|
|
136
|
+
const { segments } = pointer;
|
|
137
|
+
const segment = segments[index] as string;
|
|
138
|
+
if (index < leadingSegmentsOf(pointer)) {
|
|
139
|
+
const child = childOf(walk.node, segment);
|
|
140
|
+
return { path: [segment], child, length: 1, isSchema: startsInSchema(pointer) };
|
|
141
|
+
}
|
|
142
|
+
return walk.isSchema
|
|
143
|
+
? schemaStep(walk.node, segment, segments[index + 1])
|
|
144
|
+
: documentStep(walk, segments, index);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function refOf(node: unknown): string | null {
|
|
148
|
+
return isJsonObject(node) && typeof node.$ref === "string" ? node.$ref : null;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The walk at a crossed `$ref`'s target, through `$ref`s to `$ref`s; null where the target has
|
|
153
|
+
* no generated location. A cycle of `$ref`s has no node.
|
|
154
|
+
*/
|
|
155
|
+
function crossed(
|
|
156
|
+
walk: LocationWalk,
|
|
157
|
+
ref: string,
|
|
158
|
+
refs: RefResolver,
|
|
159
|
+
seen: readonly string[],
|
|
160
|
+
): LocationWalk | null {
|
|
161
|
+
if (seen.includes(ref)) {
|
|
162
|
+
return { ...walk, node: undefined };
|
|
163
|
+
}
|
|
164
|
+
const target = walkTo(ref, refs, seen);
|
|
165
|
+
const inner = refOf(target?.node);
|
|
166
|
+
return target === null || inner === null ? target : crossed(target, inner, refs, [...seen, ref]);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function walkTo(ref: string, refs: RefResolver, seen: readonly string[]): LocationWalk | null {
|
|
170
|
+
const pointer = refPointerOf(ref);
|
|
171
|
+
if (pointer === null || seen.includes(ref)) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
const root = pointer.rootSegment;
|
|
175
|
+
let walk: LocationWalk = {
|
|
176
|
+
path: [root],
|
|
177
|
+
node: refs.resolve(`#/${root}`),
|
|
178
|
+
isSchema: false,
|
|
179
|
+
isFromAdditionalProperties: false,
|
|
180
|
+
};
|
|
181
|
+
for (let index = 0; index < pointer.segments.length; ) {
|
|
182
|
+
const step = stepAt(walk, pointer, index);
|
|
183
|
+
if (step === null) {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
index += step.length;
|
|
187
|
+
walk = {
|
|
188
|
+
path: [...walk.path, ...step.path],
|
|
189
|
+
node: step.child,
|
|
190
|
+
isSchema: step.isSchema,
|
|
191
|
+
isFromAdditionalProperties: step.isFromAdditionalProperties === true,
|
|
192
|
+
};
|
|
193
|
+
const inner = refOf(walk.node);
|
|
194
|
+
const target = inner !== null && index < pointer.segments.length;
|
|
195
|
+
const next = target ? crossed(walk, inner, refs, [...seen, ref]) : walk;
|
|
196
|
+
if (next === null) {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
walk = next;
|
|
200
|
+
}
|
|
201
|
+
return walk;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** The location the generator types the node at `ref` with; see the module comment. */
|
|
205
|
+
export function generatedLocationOf(ref: string, refs: RefResolver): GeneratedLocation {
|
|
206
|
+
const walk = walkTo(ref, refs, []);
|
|
207
|
+
return {
|
|
208
|
+
path: walk === null ? ref : createRef(walk.path),
|
|
209
|
+
isFromAdditionalProperties: walk?.isFromAdditionalProperties ?? false,
|
|
210
|
+
};
|
|
211
|
+
}
|