openapi-typesafe 1.0.0-rc.3 → 1.0.0-rc.5
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 +1972 -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 +97 -14
- package/dist/adapters/node-file-system/node-file-system.cjs.map +1 -1
- package/dist/adapters/node-file-system/node-file-system.mjs +97 -14
- package/dist/adapters/node-file-system/node-file-system.mjs.map +1 -1
- package/dist/adapters/pipe-safe-writer/pipe-safe-writer.cjs +19 -0
- package/dist/adapters/pipe-safe-writer/pipe-safe-writer.cjs.map +1 -0
- package/dist/adapters/pipe-safe-writer/pipe-safe-writer.mjs +17 -0
- package/dist/adapters/pipe-safe-writer/pipe-safe-writer.mjs.map +1 -0
- package/dist/adapters/redocly-loader/bundled-mapping-copies.cjs +48 -0
- package/dist/adapters/redocly-loader/bundled-mapping-copies.cjs.map +1 -0
- package/dist/adapters/redocly-loader/bundled-mapping-copies.mjs +45 -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/component-schemas.cjs +17 -0
- package/dist/adapters/redocly-loader/component-schemas.cjs.map +1 -0
- package/dist/adapters/redocly-loader/component-schemas.mjs +14 -0
- package/dist/adapters/redocly-loader/component-schemas.mjs.map +1 -0
- 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/mapping-schema-names.cjs +22 -0
- package/dist/adapters/redocly-loader/mapping-schema-names.cjs.map +1 -0
- package/dist/adapters/redocly-loader/mapping-schema-names.mjs +20 -0
- package/dist/adapters/redocly-loader/mapping-schema-names.mjs.map +1 -0
- package/dist/adapters/redocly-loader/query-named-components.cjs +137 -0
- package/dist/adapters/redocly-loader/query-named-components.cjs.map +1 -0
- package/dist/adapters/redocly-loader/query-named-components.mjs +134 -0
- package/dist/adapters/redocly-loader/query-named-components.mjs.map +1 -0
- package/dist/adapters/redocly-loader/redocly-schema-loader.cjs +40 -29
- package/dist/adapters/redocly-loader/redocly-schema-loader.cjs.map +1 -1
- package/dist/adapters/redocly-loader/redocly-schema-loader.mjs +38 -27
- package/dist/adapters/redocly-loader/redocly-schema-loader.mjs.map +1 -1
- package/dist/adapters/redocly-loader/ref-access.cjs +45 -4
- package/dist/adapters/redocly-loader/ref-access.cjs.map +1 -1
- package/dist/adapters/redocly-loader/ref-access.mjs +45 -4
- package/dist/adapters/redocly-loader/ref-access.mjs.map +1 -1
- package/dist/adapters/redocly-loader/ref-holders.cjs +52 -10
- package/dist/adapters/redocly-loader/ref-holders.cjs.map +1 -1
- package/dist/adapters/redocly-loader/ref-holders.mjs +53 -12
- 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 +40 -9
- package/dist/adapters/redocly-loader/remote-fetch.cjs.map +1 -1
- package/dist/adapters/redocly-loader/remote-fetch.mjs +40 -9
- package/dist/adapters/redocly-loader/remote-fetch.mjs.map +1 -1
- package/dist/adapters/redocly-loader/remote-node-limit.cjs +61 -0
- package/dist/adapters/redocly-loader/remote-node-limit.cjs.map +1 -0
- package/dist/adapters/redocly-loader/remote-node-limit.mjs +58 -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 +18 -9
- package/dist/adapters/redocly-loader/schema-source.cjs.map +1 -1
- package/dist/adapters/redocly-loader/schema-source.mjs +20 -11
- 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 +10 -4
- package/dist/adapters/terminal-logger/terminal-logger.cjs.map +1 -1
- package/dist/adapters/terminal-logger/terminal-logger.mjs +10 -4
- package/dist/adapters/terminal-logger/terminal-logger.mjs.map +1 -1
- package/dist/api/default-ports.cjs +14 -2
- package/dist/api/default-ports.cjs.map +1 -1
- package/dist/api/default-ports.mjs +14 -2
- package/dist/api/default-ports.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 +5 -1
- package/dist/api/discriminator-patch.cjs.map +1 -1
- package/dist/api/discriminator-patch.mjs +5 -1
- package/dist/api/discriminator-patch.mjs.map +1 -1
- package/dist/api/discriminator-scan.cjs +15 -8
- package/dist/api/discriminator-scan.cjs.map +1 -1
- package/dist/api/discriminator-scan.mjs +15 -8
- package/dist/api/discriminator-scan.mjs.map +1 -1
- package/dist/api/document-refs.cjs +16 -1
- package/dist/api/document-refs.cjs.map +1 -1
- package/dist/api/document-refs.mjs +16 -1
- package/dist/api/document-refs.mjs.map +1 -1
- package/dist/api/document-run.cjs +6 -12
- package/dist/api/document-run.cjs.map +1 -1
- package/dist/api/document-run.mjs +6 -12
- package/dist/api/document-run.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 -6
- package/dist/api/openapi-ts.cjs.map +1 -1
- package/dist/api/openapi-ts.mjs +10 -8
- package/dist/api/openapi-ts.mjs.map +1 -1
- package/dist/api/ref-limit-options.cjs +63 -0
- package/dist/api/ref-limit-options.cjs.map +1 -0
- package/dist/api/ref-limit-options.mjs +57 -0
- package/dist/api/ref-limit-options.mjs.map +1 -0
- 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/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 +47 -10
- package/dist/api/transform-schema.cjs.map +1 -1
- package/dist/api/transform-schema.mjs +48 -11
- 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/declared-value-types.cjs +36 -0
- package/dist/application/transform/declared-value-types.cjs.map +1 -0
- package/dist/application/transform/declared-value-types.mjs +34 -0
- package/dist/application/transform/declared-value-types.mjs.map +1 -0
- package/dist/application/transform/document/components.cjs +1 -1
- package/dist/application/transform/document/components.cjs.map +1 -1
- package/dist/application/transform/document/components.mjs +2 -2
- 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 +7 -2
- package/dist/application/transform/document/document.cjs.map +1 -1
- package/dist/application/transform/document/document.mjs +6 -3
- 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/exploded-query-values.cjs +63 -0
- package/dist/application/transform/document/exploded-query-values.cjs.map +1 -0
- package/dist/application/transform/document/exploded-query-values.mjs +59 -0
- package/dist/application/transform/document/exploded-query-values.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/header.cjs +11 -3
- package/dist/application/transform/document/header.cjs.map +1 -1
- package/dist/application/transform/document/header.mjs +10 -2
- package/dist/application/transform/document/header.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 +29 -34
- package/dist/application/transform/document/parameters.cjs.map +1 -1
- package/dist/application/transform/document/parameters.mjs +29 -34
- package/dist/application/transform/document/parameters.mjs.map +1 -1
- package/dist/application/transform/document/path-item.cjs +15 -17
- package/dist/application/transform/document/path-item.cjs.map +1 -1
- package/dist/application/transform/document/path-item.mjs +15 -19
- package/dist/application/transform/document/path-item.mjs.map +1 -1
- package/dist/application/transform/document/path-template-key.cjs +84 -0
- package/dist/application/transform/document/path-template-key.cjs.map +1 -0
- package/dist/application/transform/document/path-template-key.mjs +79 -0
- package/dist/application/transform/document/path-template-key.mjs.map +1 -0
- package/dist/application/transform/document/path-template-refs.cjs +70 -0
- package/dist/application/transform/document/path-template-refs.cjs.map +1 -0
- package/dist/application/transform/document/path-template-refs.mjs +67 -0
- package/dist/application/transform/document/path-template-refs.mjs.map +1 -0
- package/dist/application/transform/document/paths-enum.cjs +8 -6
- package/dist/application/transform/document/paths-enum.cjs.map +1 -1
- package/dist/application/transform/document/paths-enum.mjs +8 -7
- package/dist/application/transform/document/paths-enum.mjs.map +1 -1
- package/dist/application/transform/document/paths.cjs +43 -67
- package/dist/application/transform/document/paths.cjs.map +1 -1
- package/dist/application/transform/document/paths.mjs +42 -68
- 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 +10 -3
- package/dist/application/transform/document/webhooks.cjs.map +1 -1
- package/dist/application/transform/document/webhooks.mjs +10 -3
- package/dist/application/transform/document/webhooks.mjs.map +1 -1
- package/dist/application/transform/footer/document-footer.cjs +16 -5
- package/dist/application/transform/footer/document-footer.cjs.map +1 -1
- package/dist/application/transform/footer/document-footer.mjs +16 -5
- 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 +3 -3
- package/dist/application/transform/helper-types.cjs.map +1 -1
- package/dist/application/transform/helper-types.mjs +3 -3
- 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 +5 -5
- package/dist/application/transform/ref-pointer/generated-location.cjs.map +1 -1
- package/dist/application/transform/ref-pointer/generated-location.mjs +3 -3
- package/dist/application/transform/ref-pointer/generated-location.mjs.map +1 -1
- package/dist/application/transform/ref-pointer/generated-shape.cjs +47 -66
- package/dist/application/transform/ref-pointer/generated-shape.cjs.map +1 -1
- package/dist/application/transform/ref-pointer/generated-shape.mjs +36 -50
- package/dist/application/transform/ref-pointer/generated-shape.mjs.map +1 -1
- package/dist/application/transform/ref-pointer/inline-cycles.cjs +2 -2
- package/dist/application/transform/ref-pointer/inline-cycles.cjs.map +1 -1
- package/dist/application/transform/ref-pointer/inline-cycles.mjs +1 -1
- package/dist/application/transform/ref-pointer/inline-cycles.mjs.map +1 -1
- package/dist/application/transform/ref-pointer/located-node.cjs +23 -0
- package/dist/application/transform/ref-pointer/located-node.cjs.map +1 -0
- package/dist/application/transform/ref-pointer/located-node.mjs +18 -0
- package/dist/application/transform/ref-pointer/located-node.mjs.map +1 -0
- package/dist/application/transform/ref-pointer/original-index.cjs +68 -13
- package/dist/application/transform/ref-pointer/original-index.cjs.map +1 -1
- package/dist/application/transform/ref-pointer/original-index.mjs +70 -15
- package/dist/application/transform/ref-pointer/original-index.mjs.map +1 -1
- package/dist/application/transform/ref-pointer/pointer-type.cjs +2 -2
- package/dist/application/transform/ref-pointer/pointer-type.cjs.map +1 -1
- package/dist/application/transform/ref-pointer/pointer-type.mjs +1 -1
- package/dist/application/transform/ref-pointer/pointer-type.mjs.map +1 -1
- package/dist/application/transform/ref-pointer/pointer-walk.cjs +54 -13
- package/dist/application/transform/ref-pointer/pointer-walk.cjs.map +1 -1
- package/dist/application/transform/ref-pointer/pointer-walk.mjs +46 -7
- package/dist/application/transform/ref-pointer/pointer-walk.mjs.map +1 -1
- package/dist/application/transform/ref-pointer/property-shape.cjs +52 -0
- package/dist/application/transform/ref-pointer/property-shape.cjs.map +1 -0
- package/dist/application/transform/ref-pointer/property-shape.mjs +45 -0
- package/dist/application/transform/ref-pointer/property-shape.mjs.map +1 -0
- package/dist/application/transform/ref-pointer/typed-walk.cjs +79 -21
- package/dist/application/transform/ref-pointer/typed-walk.cjs.map +1 -1
- package/dist/application/transform/ref-pointer/typed-walk.mjs +76 -18
- package/dist/application/transform/ref-pointer/typed-walk.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.map +1 -1
- package/dist/application/transform/schema/access-flags.mjs.map +1 -1
- package/dist/application/transform/schema/composition-type.cjs +1 -1
- package/dist/application/transform/schema/composition-type.cjs.map +1 -1
- package/dist/application/transform/schema/composition-type.mjs +2 -2
- package/dist/application/transform/schema/composition-type.mjs.map +1 -1
- package/dist/application/transform/schema/enum-rule.cjs +1 -1
- package/dist/application/transform/schema/enum-rule.cjs.map +1 -1
- package/dist/application/transform/schema/enum-rule.mjs +2 -2
- package/dist/application/transform/schema/enum-rule.mjs.map +1 -1
- package/dist/application/transform/schema/index-signature-type.cjs +21 -0
- package/dist/application/transform/schema/index-signature-type.cjs.map +1 -0
- package/dist/application/transform/schema/index-signature-type.mjs +19 -0
- package/dist/application/transform/schema/index-signature-type.mjs.map +1 -0
- package/dist/application/transform/schema/input-location.cjs +23 -0
- package/dist/application/transform/schema/input-location.cjs.map +1 -0
- package/dist/application/transform/schema/input-location.mjs +21 -0
- package/dist/application/transform/schema/input-location.mjs.map +1 -0
- package/dist/application/transform/schema/object-type.cjs +18 -8
- package/dist/application/transform/schema/object-type.cjs.map +1 -1
- package/dist/application/transform/schema/object-type.mjs +19 -9
- package/dist/application/transform/schema/object-type.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/schema-transform.cjs +6 -3
- package/dist/application/transform/schema/schema-transform.cjs.map +1 -1
- package/dist/application/transform/schema/schema-transform.mjs +6 -3
- package/dist/application/transform/schema/schema-transform.mjs.map +1 -1
- package/dist/application/transform/schema/unevaluated-properties.cjs +2 -30
- package/dist/application/transform/schema/unevaluated-properties.cjs.map +1 -1
- package/dist/application/transform/schema/unevaluated-properties.mjs +3 -31
- package/dist/application/transform/schema/unevaluated-properties.mjs.map +1 -1
- package/dist/application/transform/schema-comment.cjs +5 -1
- package/dist/application/transform/schema-comment.cjs.map +1 -1
- package/dist/application/transform/schema-comment.mjs +5 -1
- package/dist/application/transform/schema-comment.mjs.map +1 -1
- package/dist/cli/api-logger.cjs +13 -0
- package/dist/cli/api-logger.cjs.map +1 -0
- package/dist/cli/api-logger.mjs +11 -0
- package/dist/cli/api-logger.mjs.map +1 -0
- package/dist/cli/api-settings.cjs +57 -9
- package/dist/cli/api-settings.cjs.map +1 -1
- package/dist/cli/api-settings.mjs +56 -11
- 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-arguments.cjs +51 -11
- package/dist/cli/cli-arguments.cjs.map +1 -1
- package/dist/cli/cli-arguments.mjs +51 -11
- package/dist/cli/cli-arguments.mjs.map +1 -1
- package/dist/cli/cli-errors.cjs +29 -1
- package/dist/cli/cli-errors.cjs.map +1 -1
- package/dist/cli/cli-errors.mjs +29 -2
- package/dist/cli/cli-errors.mjs.map +1 -1
- package/dist/cli/cli-output.cjs +111 -4
- package/dist/cli/cli-output.cjs.map +1 -1
- package/dist/cli/cli-output.mjs +104 -5
- package/dist/cli/cli-output.mjs.map +1 -1
- package/dist/cli/main.cjs +13 -3
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.mjs +14 -4
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/redocly-apis.cjs +94 -37
- package/dist/cli/redocly-apis.cjs.map +1 -1
- package/dist/cli/redocly-apis.mjs +99 -42
- package/dist/cli/redocly-apis.mjs.map +1 -1
- package/dist/cli/ref-limits.cjs +15 -1
- package/dist/cli/ref-limits.cjs.map +1 -1
- package/dist/cli/ref-limits.mjs +15 -2
- package/dist/cli/ref-limits.mjs.map +1 -1
- package/dist/cli/run-cli.cjs +37 -14
- package/dist/cli/run-cli.cjs.map +1 -1
- package/dist/cli/run-cli.mjs +39 -16
- 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 +52 -0
- package/dist/domain/cause-secrets.cjs.map +1 -0
- package/dist/domain/cause-secrets.mjs +50 -0
- package/dist/domain/cause-secrets.mjs.map +1 -0
- package/dist/domain/errors.cjs +11 -3
- package/dist/domain/errors.cjs.map +1 -1
- package/dist/domain/errors.mjs +11 -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/location-text.cjs +9 -0
- package/dist/domain/location-text.cjs.map +1 -0
- package/dist/domain/location-text.mjs +7 -0
- package/dist/domain/location-text.mjs.map +1 -0
- 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/document-places.cjs +55 -0
- package/dist/domain/openapi/document-places.cjs.map +1 -0
- package/dist/domain/openapi/document-places.mjs +53 -0
- package/dist/domain/openapi/document-places.mjs.map +1 -0
- 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 +20 -0
- package/dist/domain/output-fixes.cjs.map +1 -1
- package/dist/domain/output-fixes.mjs +20 -0
- package/dist/domain/output-fixes.mjs.map +1 -1
- package/dist/domain/terminal-text.cjs +31 -0
- package/dist/domain/terminal-text.cjs.map +1 -0
- package/dist/domain/terminal-text.mjs +29 -0
- package/dist/domain/terminal-text.mjs.map +1 -0
- 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 +1 -0
- package/dist/domain/warnings.cjs.map +1 -1
- package/dist/domain/warnings.mjs +1 -0
- package/dist/domain/warnings.mjs.map +1 -1
- package/dist/index.d.cts +46 -20
- package/dist/index.d.mts +46 -20
- package/dist/index.d.ts +46 -20
- package/package.json +4 -5
- 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 +158 -18
- package/src/adapters/pipe-safe-writer/pipe-safe-writer.ts +29 -0
- package/src/adapters/redocly-loader/bundled-mapping-copies.ts +60 -0
- package/src/adapters/redocly-loader/bundled-ref-repair.ts +2 -2
- package/src/adapters/redocly-loader/component-schemas.ts +19 -0
- package/src/adapters/redocly-loader/loaded-documents.ts +46 -0
- package/src/adapters/redocly-loader/mapping-schema-names.ts +25 -0
- package/src/adapters/redocly-loader/query-named-components.ts +201 -0
- package/src/adapters/redocly-loader/redocly-schema-loader.ts +64 -38
- package/src/adapters/redocly-loader/ref-access.ts +51 -4
- package/src/adapters/redocly-loader/ref-holders.ts +76 -15
- package/src/adapters/redocly-loader/remote-body-limit.ts +66 -0
- package/src/adapters/redocly-loader/remote-fetch.ts +85 -13
- package/src/adapters/redocly-loader/remote-node-limit.ts +102 -0
- package/src/adapters/redocly-loader/schema-load-errors.ts +52 -13
- package/src/adapters/redocly-loader/schema-source.ts +35 -11
- package/src/adapters/redocly-loader/unsupported-keys.ts +3 -7
- package/src/adapters/terminal-logger/terminal-logger.ts +17 -6
- package/src/api/default-ports.ts +33 -4
- package/src/api/discriminator-enum-parent.ts +3 -3
- package/src/api/discriminator-other-owners.ts +5 -3
- package/src/api/discriminator-patch.ts +5 -1
- package/src/api/discriminator-scan.ts +16 -8
- package/src/api/document-refs.ts +29 -1
- package/src/api/document-run.ts +10 -19
- package/src/api/legacy-utils.ts +5 -1
- package/src/api/openapi-ts.ts +26 -8
- package/src/api/ref-limit-options.ts +76 -0
- package/src/api/run-context.ts +3 -0
- package/src/api/schema-callbacks.ts +60 -17
- package/src/api/transform-context.ts +7 -3
- package/src/api/transform-schema.ts +79 -12
- package/src/application/ports/file-system.ts +47 -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/declared-value-types.ts +42 -0
- package/src/application/transform/document/components.ts +2 -2
- 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 +8 -5
- package/src/application/transform/document/enum-names-given-back.ts +91 -0
- package/src/application/transform/document/exploded-query-values.ts +88 -0
- package/src/application/transform/document/global-type-references.ts +1 -1
- package/src/application/transform/document/header.ts +25 -5
- 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 +56 -66
- package/src/application/transform/document/path-item.ts +16 -34
- package/src/application/transform/document/path-template-key.ts +152 -0
- package/src/application/transform/document/path-template-refs.ts +106 -0
- package/src/application/transform/document/paths-enum.ts +24 -10
- package/src/application/transform/document/paths.ts +59 -125
- 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 +19 -6
- package/src/application/transform/footer/document-footer.ts +36 -9
- 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 +8 -7
- package/src/application/transform/numbered-names.ts +15 -0
- package/src/application/transform/ref-pointer/generated-location.ts +3 -3
- package/src/application/transform/ref-pointer/generated-shape.ts +67 -78
- package/src/application/transform/ref-pointer/inline-cycles.ts +1 -1
- package/src/application/transform/ref-pointer/located-node.ts +38 -0
- package/src/application/transform/ref-pointer/original-index.ts +100 -17
- package/src/application/transform/ref-pointer/pointer-type.ts +1 -1
- package/src/application/transform/ref-pointer/pointer-walk.ts +82 -8
- package/src/application/transform/ref-pointer/property-shape.ts +97 -0
- package/src/application/transform/ref-pointer/typed-walk.ts +117 -25
- package/src/application/transform/ref-type.ts +2 -1
- package/src/application/transform/schema/access-flags.ts +5 -2
- package/src/application/transform/schema/composition-type.ts +2 -2
- package/src/application/transform/schema/enum-rule.ts +6 -2
- package/src/application/transform/schema/index-signature-type.ts +31 -0
- package/src/application/transform/schema/input-location.ts +35 -0
- package/src/application/transform/schema/object-type.ts +22 -12
- package/src/application/transform/schema/ref-siblings.ts +76 -0
- package/src/application/transform/schema/schema-context.ts +3 -0
- package/src/application/transform/schema/schema-transform.ts +6 -3
- package/src/application/transform/schema/unevaluated-properties.ts +4 -44
- package/src/application/transform/schema-comment.ts +5 -1
- package/src/application/transform/transform-context.ts +5 -0
- package/src/cli/api-logger.ts +17 -0
- package/src/cli/api-settings.ts +80 -13
- package/src/cli/api-writes.ts +117 -0
- package/src/cli/cli-arguments.ts +90 -14
- package/src/cli/cli-dependencies.ts +26 -4
- package/src/cli/cli-errors.ts +42 -1
- package/src/cli/cli-output.ts +195 -15
- package/src/cli/main.ts +14 -5
- package/src/cli/redocly-apis.ts +177 -52
- package/src/cli/ref-limits.ts +21 -2
- package/src/cli/run-cli.ts +76 -15
- package/src/domain/append-all.ts +10 -0
- package/src/domain/cause-secrets.ts +86 -0
- package/src/domain/errors.ts +16 -5
- 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/location-text.ts +12 -0
- 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/document-places.ts +78 -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 +28 -2
- package/src/domain/terminal-text.ts +44 -0
- package/src/domain/url-secrets.ts +72 -0
- package/src/domain/warnings.ts +1 -0
- 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
package/dist/index.d.cts
CHANGED
|
@@ -4,6 +4,22 @@ import { Config } from '@redocly/openapi-core';
|
|
|
4
4
|
import * as TypeScript from 'typescript';
|
|
5
5
|
import colors from 'ansi-colors';
|
|
6
6
|
|
|
7
|
+
/** The debug groups of the original `DEBUG=openapi-ts:<group>` output. */
|
|
8
|
+
type DebugGroup = "redoc" | "lint" | "bundle" | "ts";
|
|
9
|
+
/**
|
|
10
|
+
* Where the generator reports progress and problems (ENGINEERING_PLAN 4.5). Whether warnings are
|
|
11
|
+
* printed (`silent`) and debug output (`DEBUG`) is decided by the adapter, when it is created.
|
|
12
|
+
*/
|
|
13
|
+
interface Logger {
|
|
14
|
+
/**
|
|
15
|
+
* A debug line, with how long the step took when it was measured. A line without a group is
|
|
16
|
+
* written whenever debug output is on.
|
|
17
|
+
*/
|
|
18
|
+
debug(message: string, group?: DebugGroup, durationMs?: number): void;
|
|
19
|
+
warn(message: string): void;
|
|
20
|
+
error(message: string): void;
|
|
21
|
+
}
|
|
22
|
+
|
|
7
23
|
/**
|
|
8
24
|
* Type IR: the closed set of immutable nodes that describes the TypeScript types and declarations
|
|
9
25
|
* the generator emits (ENGINEERING_PLAN §4.2, ADR-002). Nodes are plain readonly data with a `kind`
|
|
@@ -268,6 +284,11 @@ declare const FIX: {
|
|
|
268
284
|
readonly ARRAY_LENGTH_TUPLES: "array-length-tuples";
|
|
269
285
|
/** `--dedupe-enums` names a shared enum by all of its schemas, not by the first one. */
|
|
270
286
|
readonly DEDUPE_ENUM_NAMES: "dedupe-enum-names";
|
|
287
|
+
/**
|
|
288
|
+
* `--default-non-nullable` finds parameters and request bodies by the document's structure, not
|
|
289
|
+
* by the words `parameters` and `requestBody` anywhere in a schema's location.
|
|
290
|
+
*/
|
|
291
|
+
readonly DEFAULT_INPUT_LOCATIONS: "default-input-locations";
|
|
271
292
|
/** `required` next to an `allOf` `$ref` to a discriminator member still gives `WithRequired`. */
|
|
272
293
|
readonly DISCRIMINATOR_MEMBER_REQUIRED: "discriminator-member-required";
|
|
273
294
|
/**
|
|
@@ -280,6 +301,8 @@ declare const FIX: {
|
|
|
280
301
|
readonly EXPLODED_QUERY_OBJECTS: "exploded-query-objects";
|
|
281
302
|
/** `--enum` declares an enum that lists `null` without it, and the type adds `| null`. */
|
|
282
303
|
readonly NULLABLE_ENUMS: "nullable-enums";
|
|
304
|
+
/** A parameter or header with `content`, not `schema`, is typed by its media type's schema. */
|
|
305
|
+
readonly PARAMETER_HEADER_CONTENT: "parameter-header-content";
|
|
283
306
|
/** `--path-params-as-types` gives each `{name}` its placeholder, `{number}` included. */
|
|
284
307
|
readonly PATH_PARAM_TYPE_NAMES: "path-param-type-names";
|
|
285
308
|
/** A `prefixItems` tuple is open unless `items` or `unevaluatedItems` closes it (2020-12). */
|
|
@@ -291,6 +314,11 @@ declare const FIX: {
|
|
|
291
314
|
* points at, also where the original type compiles through an index signature.
|
|
292
315
|
*/
|
|
293
316
|
readonly REF_POINTERS: "ref-pointers";
|
|
317
|
+
/**
|
|
318
|
+
* OpenAPI 3.1 and 3.2: keywords next to a `$ref` (`required`, `properties`) apply too, so the
|
|
319
|
+
* type is the reference intersected with them. OpenAPI 3.0 ignores them, as its spec says.
|
|
320
|
+
*/
|
|
321
|
+
readonly REF_SIBLINGS: "ref-siblings";
|
|
294
322
|
/** Schemas of one root type name without the prefix each get an alias, the earlier numbered. */
|
|
295
323
|
readonly ROOT_TYPE_NUMBERING: "root-type-numbering";
|
|
296
324
|
/** `unevaluatedProperties` types the keys no other keyword declares (an index signature). */
|
|
@@ -1298,7 +1326,7 @@ interface OpenAPITSBaseOptions {
|
|
|
1298
1326
|
* still fail the run.
|
|
1299
1327
|
*/
|
|
1300
1328
|
lint?: boolean;
|
|
1301
|
-
/** (
|
|
1329
|
+
/** Hide warnings (default: false). Every line of the logger goes to stderr, never to stdout. */
|
|
1302
1330
|
silent?: boolean;
|
|
1303
1331
|
/** Accepted for compatibility with openapi-typescript; not read. */
|
|
1304
1332
|
version?: number;
|
|
@@ -1467,22 +1495,6 @@ declare const DEPRECATION_CODES: {
|
|
|
1467
1495
|
};
|
|
1468
1496
|
type DeprecationCode = (typeof DEPRECATION_CODES)[keyof typeof DEPRECATION_CODES];
|
|
1469
1497
|
|
|
1470
|
-
/** The debug groups of the original `DEBUG=openapi-ts:<group>` output. */
|
|
1471
|
-
type DebugGroup = "redoc" | "lint" | "bundle" | "ts";
|
|
1472
|
-
/**
|
|
1473
|
-
* Where the generator reports progress and problems (ENGINEERING_PLAN 4.5). Whether warnings are
|
|
1474
|
-
* printed (`silent`) and debug output (`DEBUG`) is decided by the adapter, when it is created.
|
|
1475
|
-
*/
|
|
1476
|
-
interface Logger {
|
|
1477
|
-
/**
|
|
1478
|
-
* A debug line, with how long the step took when it was measured. A line without a group is
|
|
1479
|
-
* written whenever debug output is on.
|
|
1480
|
-
*/
|
|
1481
|
-
debug(message: string, group?: DebugGroup, durationMs?: number): void;
|
|
1482
|
-
warn(message: string): void;
|
|
1483
|
-
error(message: string): void;
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
1498
|
/**
|
|
1487
1499
|
* Convert an OpenAPI schema to TypeScript declarations (IR nodes; print them with `astToString`)
|
|
1488
1500
|
* @param {string|URL|object|Readable} source OpenAPI schema source:
|
|
@@ -1519,14 +1531,20 @@ declare const ERROR_CODES: {
|
|
|
1519
1531
|
readonly ENUM_NAME_EMPTY: "ENUM_NAME_EMPTY";
|
|
1520
1532
|
readonly CALLBACK_RESULT_UNREADABLE: "CALLBACK_RESULT_UNREADABLE";
|
|
1521
1533
|
readonly OPTION_FIX_UNKNOWN: "OPTION_FIX_UNKNOWN";
|
|
1534
|
+
readonly OPTION_INVALID: "OPTION_INVALID";
|
|
1522
1535
|
readonly TYPESCRIPT_NOT_FOUND: "TYPESCRIPT_NOT_FOUND";
|
|
1523
1536
|
readonly CLI_FLAG_REMOVED: "CLI_FLAG_REMOVED";
|
|
1537
|
+
readonly CLI_FLAG_INVALID: "CLI_FLAG_INVALID";
|
|
1524
1538
|
readonly CLI_GLOB_UNSUPPORTED: "CLI_GLOB_UNSUPPORTED";
|
|
1525
1539
|
readonly CLI_CONFIG_NOT_FOUND: "CLI_CONFIG_NOT_FOUND";
|
|
1526
1540
|
readonly CLI_CONFIG_INVALID: "CLI_CONFIG_INVALID";
|
|
1527
1541
|
readonly CLI_CONFIG_OUTPUT_MISSING: "CLI_CONFIG_OUTPUT_MISSING";
|
|
1528
1542
|
readonly CLI_CHECK_OUTPUT_MISSING: "CLI_CHECK_OUTPUT_MISSING";
|
|
1529
1543
|
readonly CLI_INPUT_MISSING: "CLI_INPUT_MISSING";
|
|
1544
|
+
readonly CLI_OUTPUT_IS_INPUT: "CLI_OUTPUT_IS_INPUT";
|
|
1545
|
+
readonly CLI_OUTPUT_DUPLICATE: "CLI_OUTPUT_DUPLICATE";
|
|
1546
|
+
readonly CLI_OUTPUT_INVALID: "CLI_OUTPUT_INVALID";
|
|
1547
|
+
readonly CLI_LOCATION_INVALID: "CLI_LOCATION_INVALID";
|
|
1530
1548
|
readonly OUTPUT_STALE: "OUTPUT_STALE";
|
|
1531
1549
|
readonly OUTPUT_READ_FAILED: "OUTPUT_READ_FAILED";
|
|
1532
1550
|
readonly OUTPUT_WRITE_FAILED: "OUTPUT_WRITE_FAILED";
|
|
@@ -1541,12 +1559,15 @@ interface OpenAPITypesafeErrorInit {
|
|
|
1541
1559
|
readonly code: ErrorCode;
|
|
1542
1560
|
readonly message: string;
|
|
1543
1561
|
readonly details?: ErrorDetails;
|
|
1544
|
-
/**
|
|
1562
|
+
/**
|
|
1563
|
+
* The lower-level error this one reports, if any (kept as the standard `cause`; a copy with URL
|
|
1564
|
+
* secrets hidden when its chain names one, see cause-secrets.ts).
|
|
1565
|
+
*/
|
|
1545
1566
|
readonly cause?: unknown;
|
|
1546
1567
|
}
|
|
1547
1568
|
/**
|
|
1548
1569
|
* The base of every expected failure; check `code`, not the class or the message. The message
|
|
1549
|
-
* never
|
|
1570
|
+
* and the `cause` chain never show the user info or the query of a URL (`url-secrets.ts`).
|
|
1550
1571
|
*/
|
|
1551
1572
|
declare class OpenAPITypesafeError extends Error {
|
|
1552
1573
|
readonly code: ErrorCode;
|
|
@@ -1773,7 +1794,11 @@ declare function createDiscriminatorProperty(discriminator: DiscriminatorObject,
|
|
|
1773
1794
|
path: string;
|
|
1774
1795
|
readonly?: boolean;
|
|
1775
1796
|
}): IrPropertySignature;
|
|
1776
|
-
/**
|
|
1797
|
+
/**
|
|
1798
|
+
* Create a $ref pointer (even from other $refs). A part that contains `#/` is read as a `$ref`
|
|
1799
|
+
* and contributes its decoded segments, so it throws URIError for a malformed percent escape; any
|
|
1800
|
+
* other part is one segment. To append raw document keys, escape each one instead.
|
|
1801
|
+
*/
|
|
1777
1802
|
declare function createRef(parts: (number | string | undefined | null)[]): string;
|
|
1778
1803
|
/**
|
|
1779
1804
|
* Print debug message (cribbed from the `debug` package, but without all the bells & whistles
|
|
@@ -1831,6 +1856,7 @@ declare function transformSchema(schema: OpenAPI3, ctx: GlobalContext): IrDeclar
|
|
|
1831
1856
|
/** Every warning code. */
|
|
1832
1857
|
declare const WARNING_CODES: {
|
|
1833
1858
|
readonly CLI_INPUT_IGNORED: "CLI_INPUT_IGNORED";
|
|
1859
|
+
readonly CLI_OUTPUT_IGNORED: "CLI_OUTPUT_IGNORED";
|
|
1834
1860
|
readonly CONFIG_SETTING_UNKNOWN: "CONFIG_SETTING_UNKNOWN";
|
|
1835
1861
|
readonly DISCRIMINATOR_MAPPING_INVALID: "DISCRIMINATOR_MAPPING_INVALID";
|
|
1836
1862
|
readonly DISCRIMINATOR_VALUE_NOT_ALLOWED: "DISCRIMINATOR_VALUE_NOT_ALLOWED";
|
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,22 @@ import { Config } from '@redocly/openapi-core';
|
|
|
4
4
|
import * as TypeScript from 'typescript';
|
|
5
5
|
import colors from 'ansi-colors';
|
|
6
6
|
|
|
7
|
+
/** The debug groups of the original `DEBUG=openapi-ts:<group>` output. */
|
|
8
|
+
type DebugGroup = "redoc" | "lint" | "bundle" | "ts";
|
|
9
|
+
/**
|
|
10
|
+
* Where the generator reports progress and problems (ENGINEERING_PLAN 4.5). Whether warnings are
|
|
11
|
+
* printed (`silent`) and debug output (`DEBUG`) is decided by the adapter, when it is created.
|
|
12
|
+
*/
|
|
13
|
+
interface Logger {
|
|
14
|
+
/**
|
|
15
|
+
* A debug line, with how long the step took when it was measured. A line without a group is
|
|
16
|
+
* written whenever debug output is on.
|
|
17
|
+
*/
|
|
18
|
+
debug(message: string, group?: DebugGroup, durationMs?: number): void;
|
|
19
|
+
warn(message: string): void;
|
|
20
|
+
error(message: string): void;
|
|
21
|
+
}
|
|
22
|
+
|
|
7
23
|
/**
|
|
8
24
|
* Type IR: the closed set of immutable nodes that describes the TypeScript types and declarations
|
|
9
25
|
* the generator emits (ENGINEERING_PLAN §4.2, ADR-002). Nodes are plain readonly data with a `kind`
|
|
@@ -268,6 +284,11 @@ declare const FIX: {
|
|
|
268
284
|
readonly ARRAY_LENGTH_TUPLES: "array-length-tuples";
|
|
269
285
|
/** `--dedupe-enums` names a shared enum by all of its schemas, not by the first one. */
|
|
270
286
|
readonly DEDUPE_ENUM_NAMES: "dedupe-enum-names";
|
|
287
|
+
/**
|
|
288
|
+
* `--default-non-nullable` finds parameters and request bodies by the document's structure, not
|
|
289
|
+
* by the words `parameters` and `requestBody` anywhere in a schema's location.
|
|
290
|
+
*/
|
|
291
|
+
readonly DEFAULT_INPUT_LOCATIONS: "default-input-locations";
|
|
271
292
|
/** `required` next to an `allOf` `$ref` to a discriminator member still gives `WithRequired`. */
|
|
272
293
|
readonly DISCRIMINATOR_MEMBER_REQUIRED: "discriminator-member-required";
|
|
273
294
|
/**
|
|
@@ -280,6 +301,8 @@ declare const FIX: {
|
|
|
280
301
|
readonly EXPLODED_QUERY_OBJECTS: "exploded-query-objects";
|
|
281
302
|
/** `--enum` declares an enum that lists `null` without it, and the type adds `| null`. */
|
|
282
303
|
readonly NULLABLE_ENUMS: "nullable-enums";
|
|
304
|
+
/** A parameter or header with `content`, not `schema`, is typed by its media type's schema. */
|
|
305
|
+
readonly PARAMETER_HEADER_CONTENT: "parameter-header-content";
|
|
283
306
|
/** `--path-params-as-types` gives each `{name}` its placeholder, `{number}` included. */
|
|
284
307
|
readonly PATH_PARAM_TYPE_NAMES: "path-param-type-names";
|
|
285
308
|
/** A `prefixItems` tuple is open unless `items` or `unevaluatedItems` closes it (2020-12). */
|
|
@@ -291,6 +314,11 @@ declare const FIX: {
|
|
|
291
314
|
* points at, also where the original type compiles through an index signature.
|
|
292
315
|
*/
|
|
293
316
|
readonly REF_POINTERS: "ref-pointers";
|
|
317
|
+
/**
|
|
318
|
+
* OpenAPI 3.1 and 3.2: keywords next to a `$ref` (`required`, `properties`) apply too, so the
|
|
319
|
+
* type is the reference intersected with them. OpenAPI 3.0 ignores them, as its spec says.
|
|
320
|
+
*/
|
|
321
|
+
readonly REF_SIBLINGS: "ref-siblings";
|
|
294
322
|
/** Schemas of one root type name without the prefix each get an alias, the earlier numbered. */
|
|
295
323
|
readonly ROOT_TYPE_NUMBERING: "root-type-numbering";
|
|
296
324
|
/** `unevaluatedProperties` types the keys no other keyword declares (an index signature). */
|
|
@@ -1298,7 +1326,7 @@ interface OpenAPITSBaseOptions {
|
|
|
1298
1326
|
* still fail the run.
|
|
1299
1327
|
*/
|
|
1300
1328
|
lint?: boolean;
|
|
1301
|
-
/** (
|
|
1329
|
+
/** Hide warnings (default: false). Every line of the logger goes to stderr, never to stdout. */
|
|
1302
1330
|
silent?: boolean;
|
|
1303
1331
|
/** Accepted for compatibility with openapi-typescript; not read. */
|
|
1304
1332
|
version?: number;
|
|
@@ -1467,22 +1495,6 @@ declare const DEPRECATION_CODES: {
|
|
|
1467
1495
|
};
|
|
1468
1496
|
type DeprecationCode = (typeof DEPRECATION_CODES)[keyof typeof DEPRECATION_CODES];
|
|
1469
1497
|
|
|
1470
|
-
/** The debug groups of the original `DEBUG=openapi-ts:<group>` output. */
|
|
1471
|
-
type DebugGroup = "redoc" | "lint" | "bundle" | "ts";
|
|
1472
|
-
/**
|
|
1473
|
-
* Where the generator reports progress and problems (ENGINEERING_PLAN 4.5). Whether warnings are
|
|
1474
|
-
* printed (`silent`) and debug output (`DEBUG`) is decided by the adapter, when it is created.
|
|
1475
|
-
*/
|
|
1476
|
-
interface Logger {
|
|
1477
|
-
/**
|
|
1478
|
-
* A debug line, with how long the step took when it was measured. A line without a group is
|
|
1479
|
-
* written whenever debug output is on.
|
|
1480
|
-
*/
|
|
1481
|
-
debug(message: string, group?: DebugGroup, durationMs?: number): void;
|
|
1482
|
-
warn(message: string): void;
|
|
1483
|
-
error(message: string): void;
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
1498
|
/**
|
|
1487
1499
|
* Convert an OpenAPI schema to TypeScript declarations (IR nodes; print them with `astToString`)
|
|
1488
1500
|
* @param {string|URL|object|Readable} source OpenAPI schema source:
|
|
@@ -1519,14 +1531,20 @@ declare const ERROR_CODES: {
|
|
|
1519
1531
|
readonly ENUM_NAME_EMPTY: "ENUM_NAME_EMPTY";
|
|
1520
1532
|
readonly CALLBACK_RESULT_UNREADABLE: "CALLBACK_RESULT_UNREADABLE";
|
|
1521
1533
|
readonly OPTION_FIX_UNKNOWN: "OPTION_FIX_UNKNOWN";
|
|
1534
|
+
readonly OPTION_INVALID: "OPTION_INVALID";
|
|
1522
1535
|
readonly TYPESCRIPT_NOT_FOUND: "TYPESCRIPT_NOT_FOUND";
|
|
1523
1536
|
readonly CLI_FLAG_REMOVED: "CLI_FLAG_REMOVED";
|
|
1537
|
+
readonly CLI_FLAG_INVALID: "CLI_FLAG_INVALID";
|
|
1524
1538
|
readonly CLI_GLOB_UNSUPPORTED: "CLI_GLOB_UNSUPPORTED";
|
|
1525
1539
|
readonly CLI_CONFIG_NOT_FOUND: "CLI_CONFIG_NOT_FOUND";
|
|
1526
1540
|
readonly CLI_CONFIG_INVALID: "CLI_CONFIG_INVALID";
|
|
1527
1541
|
readonly CLI_CONFIG_OUTPUT_MISSING: "CLI_CONFIG_OUTPUT_MISSING";
|
|
1528
1542
|
readonly CLI_CHECK_OUTPUT_MISSING: "CLI_CHECK_OUTPUT_MISSING";
|
|
1529
1543
|
readonly CLI_INPUT_MISSING: "CLI_INPUT_MISSING";
|
|
1544
|
+
readonly CLI_OUTPUT_IS_INPUT: "CLI_OUTPUT_IS_INPUT";
|
|
1545
|
+
readonly CLI_OUTPUT_DUPLICATE: "CLI_OUTPUT_DUPLICATE";
|
|
1546
|
+
readonly CLI_OUTPUT_INVALID: "CLI_OUTPUT_INVALID";
|
|
1547
|
+
readonly CLI_LOCATION_INVALID: "CLI_LOCATION_INVALID";
|
|
1530
1548
|
readonly OUTPUT_STALE: "OUTPUT_STALE";
|
|
1531
1549
|
readonly OUTPUT_READ_FAILED: "OUTPUT_READ_FAILED";
|
|
1532
1550
|
readonly OUTPUT_WRITE_FAILED: "OUTPUT_WRITE_FAILED";
|
|
@@ -1541,12 +1559,15 @@ interface OpenAPITypesafeErrorInit {
|
|
|
1541
1559
|
readonly code: ErrorCode;
|
|
1542
1560
|
readonly message: string;
|
|
1543
1561
|
readonly details?: ErrorDetails;
|
|
1544
|
-
/**
|
|
1562
|
+
/**
|
|
1563
|
+
* The lower-level error this one reports, if any (kept as the standard `cause`; a copy with URL
|
|
1564
|
+
* secrets hidden when its chain names one, see cause-secrets.ts).
|
|
1565
|
+
*/
|
|
1545
1566
|
readonly cause?: unknown;
|
|
1546
1567
|
}
|
|
1547
1568
|
/**
|
|
1548
1569
|
* The base of every expected failure; check `code`, not the class or the message. The message
|
|
1549
|
-
* never
|
|
1570
|
+
* and the `cause` chain never show the user info or the query of a URL (`url-secrets.ts`).
|
|
1550
1571
|
*/
|
|
1551
1572
|
declare class OpenAPITypesafeError extends Error {
|
|
1552
1573
|
readonly code: ErrorCode;
|
|
@@ -1773,7 +1794,11 @@ declare function createDiscriminatorProperty(discriminator: DiscriminatorObject,
|
|
|
1773
1794
|
path: string;
|
|
1774
1795
|
readonly?: boolean;
|
|
1775
1796
|
}): IrPropertySignature;
|
|
1776
|
-
/**
|
|
1797
|
+
/**
|
|
1798
|
+
* Create a $ref pointer (even from other $refs). A part that contains `#/` is read as a `$ref`
|
|
1799
|
+
* and contributes its decoded segments, so it throws URIError for a malformed percent escape; any
|
|
1800
|
+
* other part is one segment. To append raw document keys, escape each one instead.
|
|
1801
|
+
*/
|
|
1777
1802
|
declare function createRef(parts: (number | string | undefined | null)[]): string;
|
|
1778
1803
|
/**
|
|
1779
1804
|
* Print debug message (cribbed from the `debug` package, but without all the bells & whistles
|
|
@@ -1831,6 +1856,7 @@ declare function transformSchema(schema: OpenAPI3, ctx: GlobalContext): IrDeclar
|
|
|
1831
1856
|
/** Every warning code. */
|
|
1832
1857
|
declare const WARNING_CODES: {
|
|
1833
1858
|
readonly CLI_INPUT_IGNORED: "CLI_INPUT_IGNORED";
|
|
1859
|
+
readonly CLI_OUTPUT_IGNORED: "CLI_OUTPUT_IGNORED";
|
|
1834
1860
|
readonly CONFIG_SETTING_UNKNOWN: "CONFIG_SETTING_UNKNOWN";
|
|
1835
1861
|
readonly DISCRIMINATOR_MAPPING_INVALID: "DISCRIMINATOR_MAPPING_INVALID";
|
|
1836
1862
|
readonly DISCRIMINATOR_VALUE_NOT_ALLOWED: "DISCRIMINATOR_VALUE_NOT_ALLOWED";
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,22 @@ import { Config } from '@redocly/openapi-core';
|
|
|
4
4
|
import * as TypeScript from 'typescript';
|
|
5
5
|
import colors from 'ansi-colors';
|
|
6
6
|
|
|
7
|
+
/** The debug groups of the original `DEBUG=openapi-ts:<group>` output. */
|
|
8
|
+
type DebugGroup = "redoc" | "lint" | "bundle" | "ts";
|
|
9
|
+
/**
|
|
10
|
+
* Where the generator reports progress and problems (ENGINEERING_PLAN 4.5). Whether warnings are
|
|
11
|
+
* printed (`silent`) and debug output (`DEBUG`) is decided by the adapter, when it is created.
|
|
12
|
+
*/
|
|
13
|
+
interface Logger {
|
|
14
|
+
/**
|
|
15
|
+
* A debug line, with how long the step took when it was measured. A line without a group is
|
|
16
|
+
* written whenever debug output is on.
|
|
17
|
+
*/
|
|
18
|
+
debug(message: string, group?: DebugGroup, durationMs?: number): void;
|
|
19
|
+
warn(message: string): void;
|
|
20
|
+
error(message: string): void;
|
|
21
|
+
}
|
|
22
|
+
|
|
7
23
|
/**
|
|
8
24
|
* Type IR: the closed set of immutable nodes that describes the TypeScript types and declarations
|
|
9
25
|
* the generator emits (ENGINEERING_PLAN §4.2, ADR-002). Nodes are plain readonly data with a `kind`
|
|
@@ -268,6 +284,11 @@ declare const FIX: {
|
|
|
268
284
|
readonly ARRAY_LENGTH_TUPLES: "array-length-tuples";
|
|
269
285
|
/** `--dedupe-enums` names a shared enum by all of its schemas, not by the first one. */
|
|
270
286
|
readonly DEDUPE_ENUM_NAMES: "dedupe-enum-names";
|
|
287
|
+
/**
|
|
288
|
+
* `--default-non-nullable` finds parameters and request bodies by the document's structure, not
|
|
289
|
+
* by the words `parameters` and `requestBody` anywhere in a schema's location.
|
|
290
|
+
*/
|
|
291
|
+
readonly DEFAULT_INPUT_LOCATIONS: "default-input-locations";
|
|
271
292
|
/** `required` next to an `allOf` `$ref` to a discriminator member still gives `WithRequired`. */
|
|
272
293
|
readonly DISCRIMINATOR_MEMBER_REQUIRED: "discriminator-member-required";
|
|
273
294
|
/**
|
|
@@ -280,6 +301,8 @@ declare const FIX: {
|
|
|
280
301
|
readonly EXPLODED_QUERY_OBJECTS: "exploded-query-objects";
|
|
281
302
|
/** `--enum` declares an enum that lists `null` without it, and the type adds `| null`. */
|
|
282
303
|
readonly NULLABLE_ENUMS: "nullable-enums";
|
|
304
|
+
/** A parameter or header with `content`, not `schema`, is typed by its media type's schema. */
|
|
305
|
+
readonly PARAMETER_HEADER_CONTENT: "parameter-header-content";
|
|
283
306
|
/** `--path-params-as-types` gives each `{name}` its placeholder, `{number}` included. */
|
|
284
307
|
readonly PATH_PARAM_TYPE_NAMES: "path-param-type-names";
|
|
285
308
|
/** A `prefixItems` tuple is open unless `items` or `unevaluatedItems` closes it (2020-12). */
|
|
@@ -291,6 +314,11 @@ declare const FIX: {
|
|
|
291
314
|
* points at, also where the original type compiles through an index signature.
|
|
292
315
|
*/
|
|
293
316
|
readonly REF_POINTERS: "ref-pointers";
|
|
317
|
+
/**
|
|
318
|
+
* OpenAPI 3.1 and 3.2: keywords next to a `$ref` (`required`, `properties`) apply too, so the
|
|
319
|
+
* type is the reference intersected with them. OpenAPI 3.0 ignores them, as its spec says.
|
|
320
|
+
*/
|
|
321
|
+
readonly REF_SIBLINGS: "ref-siblings";
|
|
294
322
|
/** Schemas of one root type name without the prefix each get an alias, the earlier numbered. */
|
|
295
323
|
readonly ROOT_TYPE_NUMBERING: "root-type-numbering";
|
|
296
324
|
/** `unevaluatedProperties` types the keys no other keyword declares (an index signature). */
|
|
@@ -1298,7 +1326,7 @@ interface OpenAPITSBaseOptions {
|
|
|
1298
1326
|
* still fail the run.
|
|
1299
1327
|
*/
|
|
1300
1328
|
lint?: boolean;
|
|
1301
|
-
/** (
|
|
1329
|
+
/** Hide warnings (default: false). Every line of the logger goes to stderr, never to stdout. */
|
|
1302
1330
|
silent?: boolean;
|
|
1303
1331
|
/** Accepted for compatibility with openapi-typescript; not read. */
|
|
1304
1332
|
version?: number;
|
|
@@ -1467,22 +1495,6 @@ declare const DEPRECATION_CODES: {
|
|
|
1467
1495
|
};
|
|
1468
1496
|
type DeprecationCode = (typeof DEPRECATION_CODES)[keyof typeof DEPRECATION_CODES];
|
|
1469
1497
|
|
|
1470
|
-
/** The debug groups of the original `DEBUG=openapi-ts:<group>` output. */
|
|
1471
|
-
type DebugGroup = "redoc" | "lint" | "bundle" | "ts";
|
|
1472
|
-
/**
|
|
1473
|
-
* Where the generator reports progress and problems (ENGINEERING_PLAN 4.5). Whether warnings are
|
|
1474
|
-
* printed (`silent`) and debug output (`DEBUG`) is decided by the adapter, when it is created.
|
|
1475
|
-
*/
|
|
1476
|
-
interface Logger {
|
|
1477
|
-
/**
|
|
1478
|
-
* A debug line, with how long the step took when it was measured. A line without a group is
|
|
1479
|
-
* written whenever debug output is on.
|
|
1480
|
-
*/
|
|
1481
|
-
debug(message: string, group?: DebugGroup, durationMs?: number): void;
|
|
1482
|
-
warn(message: string): void;
|
|
1483
|
-
error(message: string): void;
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
1498
|
/**
|
|
1487
1499
|
* Convert an OpenAPI schema to TypeScript declarations (IR nodes; print them with `astToString`)
|
|
1488
1500
|
* @param {string|URL|object|Readable} source OpenAPI schema source:
|
|
@@ -1519,14 +1531,20 @@ declare const ERROR_CODES: {
|
|
|
1519
1531
|
readonly ENUM_NAME_EMPTY: "ENUM_NAME_EMPTY";
|
|
1520
1532
|
readonly CALLBACK_RESULT_UNREADABLE: "CALLBACK_RESULT_UNREADABLE";
|
|
1521
1533
|
readonly OPTION_FIX_UNKNOWN: "OPTION_FIX_UNKNOWN";
|
|
1534
|
+
readonly OPTION_INVALID: "OPTION_INVALID";
|
|
1522
1535
|
readonly TYPESCRIPT_NOT_FOUND: "TYPESCRIPT_NOT_FOUND";
|
|
1523
1536
|
readonly CLI_FLAG_REMOVED: "CLI_FLAG_REMOVED";
|
|
1537
|
+
readonly CLI_FLAG_INVALID: "CLI_FLAG_INVALID";
|
|
1524
1538
|
readonly CLI_GLOB_UNSUPPORTED: "CLI_GLOB_UNSUPPORTED";
|
|
1525
1539
|
readonly CLI_CONFIG_NOT_FOUND: "CLI_CONFIG_NOT_FOUND";
|
|
1526
1540
|
readonly CLI_CONFIG_INVALID: "CLI_CONFIG_INVALID";
|
|
1527
1541
|
readonly CLI_CONFIG_OUTPUT_MISSING: "CLI_CONFIG_OUTPUT_MISSING";
|
|
1528
1542
|
readonly CLI_CHECK_OUTPUT_MISSING: "CLI_CHECK_OUTPUT_MISSING";
|
|
1529
1543
|
readonly CLI_INPUT_MISSING: "CLI_INPUT_MISSING";
|
|
1544
|
+
readonly CLI_OUTPUT_IS_INPUT: "CLI_OUTPUT_IS_INPUT";
|
|
1545
|
+
readonly CLI_OUTPUT_DUPLICATE: "CLI_OUTPUT_DUPLICATE";
|
|
1546
|
+
readonly CLI_OUTPUT_INVALID: "CLI_OUTPUT_INVALID";
|
|
1547
|
+
readonly CLI_LOCATION_INVALID: "CLI_LOCATION_INVALID";
|
|
1530
1548
|
readonly OUTPUT_STALE: "OUTPUT_STALE";
|
|
1531
1549
|
readonly OUTPUT_READ_FAILED: "OUTPUT_READ_FAILED";
|
|
1532
1550
|
readonly OUTPUT_WRITE_FAILED: "OUTPUT_WRITE_FAILED";
|
|
@@ -1541,12 +1559,15 @@ interface OpenAPITypesafeErrorInit {
|
|
|
1541
1559
|
readonly code: ErrorCode;
|
|
1542
1560
|
readonly message: string;
|
|
1543
1561
|
readonly details?: ErrorDetails;
|
|
1544
|
-
/**
|
|
1562
|
+
/**
|
|
1563
|
+
* The lower-level error this one reports, if any (kept as the standard `cause`; a copy with URL
|
|
1564
|
+
* secrets hidden when its chain names one, see cause-secrets.ts).
|
|
1565
|
+
*/
|
|
1545
1566
|
readonly cause?: unknown;
|
|
1546
1567
|
}
|
|
1547
1568
|
/**
|
|
1548
1569
|
* The base of every expected failure; check `code`, not the class or the message. The message
|
|
1549
|
-
* never
|
|
1570
|
+
* and the `cause` chain never show the user info or the query of a URL (`url-secrets.ts`).
|
|
1550
1571
|
*/
|
|
1551
1572
|
declare class OpenAPITypesafeError extends Error {
|
|
1552
1573
|
readonly code: ErrorCode;
|
|
@@ -1773,7 +1794,11 @@ declare function createDiscriminatorProperty(discriminator: DiscriminatorObject,
|
|
|
1773
1794
|
path: string;
|
|
1774
1795
|
readonly?: boolean;
|
|
1775
1796
|
}): IrPropertySignature;
|
|
1776
|
-
/**
|
|
1797
|
+
/**
|
|
1798
|
+
* Create a $ref pointer (even from other $refs). A part that contains `#/` is read as a `$ref`
|
|
1799
|
+
* and contributes its decoded segments, so it throws URIError for a malformed percent escape; any
|
|
1800
|
+
* other part is one segment. To append raw document keys, escape each one instead.
|
|
1801
|
+
*/
|
|
1777
1802
|
declare function createRef(parts: (number | string | undefined | null)[]): string;
|
|
1778
1803
|
/**
|
|
1779
1804
|
* Print debug message (cribbed from the `debug` package, but without all the bells & whistles
|
|
@@ -1831,6 +1856,7 @@ declare function transformSchema(schema: OpenAPI3, ctx: GlobalContext): IrDeclar
|
|
|
1831
1856
|
/** Every warning code. */
|
|
1832
1857
|
declare const WARNING_CODES: {
|
|
1833
1858
|
readonly CLI_INPUT_IGNORED: "CLI_INPUT_IGNORED";
|
|
1859
|
+
readonly CLI_OUTPUT_IGNORED: "CLI_OUTPUT_IGNORED";
|
|
1834
1860
|
readonly CONFIG_SETTING_UNKNOWN: "CONFIG_SETTING_UNKNOWN";
|
|
1835
1861
|
readonly DISCRIMINATOR_MAPPING_INVALID: "DISCRIMINATOR_MAPPING_INVALID";
|
|
1836
1862
|
readonly DISCRIMINATOR_VALUE_NOT_ALLOWED: "DISCRIMINATOR_VALUE_NOT_ALLOWED";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-typesafe",
|
|
3
3
|
"description": "Convert OpenAPI 3.0, 3.1 & 3.2 schemas to TypeScript",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.5",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Fedor Chishchin",
|
|
7
7
|
"url": "https://github.com/fedorello"
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"./*": "./*"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
|
+
"CHANGELOG.md",
|
|
38
39
|
"bin",
|
|
39
40
|
"dist",
|
|
40
41
|
"src"
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
},
|
|
62
63
|
"peerDependencies": {
|
|
63
64
|
"@typescript/typescript6": "^6.0.0",
|
|
64
|
-
"typescript": ">=5.
|
|
65
|
+
"typescript": ">=5.4.0"
|
|
65
66
|
},
|
|
66
67
|
"peerDependenciesMeta": {
|
|
67
68
|
"@typescript/typescript6": {
|
|
@@ -106,11 +107,9 @@
|
|
|
106
107
|
"lint:ts": "tsc --noEmit && tsc -p tsconfig.strict.json",
|
|
107
108
|
"test": "pnpm run test:js && pnpm run test:examples && pnpm run test:exports",
|
|
108
109
|
"test:js": "vitest run",
|
|
109
|
-
"test:exports": "
|
|
110
|
+
"test:exports": "../../scripts/check-exports.sh",
|
|
110
111
|
"test:examples": "tsc -p tsconfig.examples.json --noEmit",
|
|
111
112
|
"update:examples": "pnpm run build && pnpm run download:schemas && vite-node ./scripts/update-examples.ts",
|
|
112
|
-
"prepublish": "pnpm run build",
|
|
113
|
-
"version": "pnpm run build",
|
|
114
113
|
"lint:deps": "depcruise src --config .dependency-cruiser.cjs",
|
|
115
114
|
"test:coverage": "vitest run --coverage",
|
|
116
115
|
"lint:sizes": "vite-node scripts/size-rules/check-sizes.ts src"
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import type { ClaimedFile } from "../../application/ports/file-system.js";
|
|
4
|
+
import { creationPath, type FileNumber, type PathQueries } from "./file-identity.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Claiming an output on Node's `fs` (ADR-043, decision 1): the file is opened for appending,
|
|
8
|
+
* which creates it when it is missing (also through a symbolic link) and never truncates it.
|
|
9
|
+
* The device and file number of the open file are its identity. A claim or a write that fails
|
|
10
|
+
* removes the directories it created.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The directories that do not exist yet on the way to `directory`, deepest first: the ones a
|
|
15
|
+
* recursive `fs.mkdirSync` creates. They are listed before it runs, in the form of `directory`
|
|
16
|
+
* itself: on Windows the path that `fs.mkdirSync` returns did not match that form, so comparing
|
|
17
|
+
* with it found no new directory and a failed run left them behind.
|
|
18
|
+
*/
|
|
19
|
+
export function missingDirectories(
|
|
20
|
+
directory: string,
|
|
21
|
+
exists: (candidate: string) => boolean,
|
|
22
|
+
): string[] {
|
|
23
|
+
const missing: string[] = [];
|
|
24
|
+
for (let current = directory; !exists(current); current = path.dirname(current)) {
|
|
25
|
+
missing.push(current);
|
|
26
|
+
if (path.dirname(current) === current) {
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return missing;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The identity of an open file: its device and file number, or its stored path on a file system
|
|
35
|
+
* that reports the file number 0 (FAT, some network shares), which proves nothing.
|
|
36
|
+
*/
|
|
37
|
+
export function claimIdentity(number: FileNumber, storedPath: () => string): string {
|
|
38
|
+
return number.file === 0n ? `path:${storedPath()}` : `${number.device}:${number.file}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function identityOf(descriptor: number, filePath: string): string {
|
|
42
|
+
const status = fs.fstatSync(descriptor, { bigint: true });
|
|
43
|
+
return claimIdentity({ device: status.dev, file: status.ino }, () =>
|
|
44
|
+
fs.realpathSync.native(filePath),
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function errorCodeOf(error: unknown): unknown {
|
|
49
|
+
return error instanceof Error && "code" in error ? error.code : undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Remove the new directories, deepest first, until one holds another file. */
|
|
53
|
+
function removeDirectories(directories: readonly string[]): void {
|
|
54
|
+
for (const directory of directories) {
|
|
55
|
+
try {
|
|
56
|
+
fs.rmdirSync(directory);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
const code = errorCodeOf(error);
|
|
59
|
+
// Another output or the user put a file there since: the directory and its parents stay.
|
|
60
|
+
if (code === "ENOTEMPTY" || code === "EEXIST") {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
// Removed since: nothing to remove, but its parents may still be empty. Windows also gives
|
|
64
|
+
// ENOENT for a file put in its place, which must fail like any other path it cannot remove.
|
|
65
|
+
if (code !== "ENOENT" || fs.lstatSync(directory, { throwIfNoEntry: false }) !== undefined) {
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Create `directory` and give the directories that this created. Through a link to a missing
|
|
74
|
+
* directory it creates the link's target, as a write through the link would, so the path to
|
|
75
|
+
* create and the new directories are real paths, where links are already followed. A recursive
|
|
76
|
+
* `mkdir` that fails part of the way (a directory name too long for the file system) keeps the
|
|
77
|
+
* directories above the failing one, so the ones that exist now are removed here.
|
|
78
|
+
*/
|
|
79
|
+
function createDirectory(directory: string, queries: PathQueries): string[] {
|
|
80
|
+
const target = creationPath(directory, queries);
|
|
81
|
+
const missing = missingDirectories(target, fs.existsSync);
|
|
82
|
+
try {
|
|
83
|
+
fs.mkdirSync(target, { recursive: true });
|
|
84
|
+
} catch (error) {
|
|
85
|
+
removeDirectories(missing.filter((created) => fs.existsSync(created)));
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
return missing;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Open `filePath` for appending, which creates it, and give its identity and whether it is new. */
|
|
92
|
+
function openClaim(filePath: string): { identity: string; createdFile: string | undefined } {
|
|
93
|
+
const isCreated = !fs.existsSync(filePath);
|
|
94
|
+
const descriptor = fs.openSync(filePath, "a");
|
|
95
|
+
try {
|
|
96
|
+
const identity = identityOf(descriptor, filePath);
|
|
97
|
+
// A link to a missing file created its target: that file is what the claim removes.
|
|
98
|
+
return { identity, createdFile: isCreated ? fs.realpathSync.native(filePath) : undefined };
|
|
99
|
+
} finally {
|
|
100
|
+
fs.closeSync(descriptor);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Claim the file at `filePath`; the caller turns a failure into a typed error. A claim that fails
|
|
106
|
+
* after creating directories (a file name too long for the file system) removes them again.
|
|
107
|
+
*/
|
|
108
|
+
export function claimFileAt(filePath: string, queries: PathQueries): ClaimedFile {
|
|
109
|
+
const directories = createDirectory(path.dirname(filePath), queries);
|
|
110
|
+
let opened: ReturnType<typeof openClaim>;
|
|
111
|
+
try {
|
|
112
|
+
opened = openClaim(filePath);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
removeDirectories(directories);
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
117
|
+
const { identity, createdFile } = opened;
|
|
118
|
+
return {
|
|
119
|
+
identity,
|
|
120
|
+
release: () => {
|
|
121
|
+
if (createdFile !== undefined) {
|
|
122
|
+
fs.rmSync(createdFile, { force: true });
|
|
123
|
+
}
|
|
124
|
+
removeDirectories(directories);
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Write `contents` to `filePath`, creating its directory; a failed write removes what it made. */
|
|
130
|
+
export function writeFileAt(filePath: string, contents: string, queries: PathQueries): void {
|
|
131
|
+
const directories = createDirectory(path.dirname(filePath), queries);
|
|
132
|
+
try {
|
|
133
|
+
fs.writeFileSync(filePath, contents, "utf8");
|
|
134
|
+
} catch (error) {
|
|
135
|
+
removeDirectories(directories);
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
}
|