openapi-typesafe 1.0.0-rc.0 → 1.0.0-rc.2
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/README.md +12 -5
- package/dist/adapters/redocly-loader/configured-headers.cjs +32 -0
- package/dist/adapters/redocly-loader/configured-headers.cjs.map +1 -0
- package/dist/adapters/redocly-loader/configured-headers.mjs +30 -0
- package/dist/adapters/redocly-loader/configured-headers.mjs.map +1 -0
- package/dist/adapters/redocly-loader/redocly-config-source.cjs +21 -2
- package/dist/adapters/redocly-loader/redocly-config-source.cjs.map +1 -1
- package/dist/adapters/redocly-loader/redocly-config-source.mjs +22 -3
- package/dist/adapters/redocly-loader/redocly-config-source.mjs.map +1 -1
- package/dist/adapters/redocly-loader/redocly-schema-loader.cjs +34 -11
- package/dist/adapters/redocly-loader/redocly-schema-loader.cjs.map +1 -1
- package/dist/adapters/redocly-loader/redocly-schema-loader.mjs +33 -10
- package/dist/adapters/redocly-loader/redocly-schema-loader.mjs.map +1 -1
- package/dist/adapters/redocly-loader/ref-access.cjs +37 -4
- package/dist/adapters/redocly-loader/ref-access.cjs.map +1 -1
- package/dist/adapters/redocly-loader/ref-access.mjs +37 -4
- package/dist/adapters/redocly-loader/ref-access.mjs.map +1 -1
- package/dist/adapters/redocly-loader/ref-resolution-check.cjs +191 -0
- package/dist/adapters/redocly-loader/ref-resolution-check.cjs.map +1 -0
- package/dist/adapters/redocly-loader/ref-resolution-check.mjs +189 -0
- package/dist/adapters/redocly-loader/ref-resolution-check.mjs.map +1 -0
- package/dist/adapters/redocly-loader/ref-resolution-steps.cjs +73 -0
- package/dist/adapters/redocly-loader/ref-resolution-steps.cjs.map +1 -0
- package/dist/adapters/redocly-loader/ref-resolution-steps.mjs +60 -0
- package/dist/adapters/redocly-loader/ref-resolution-steps.mjs.map +1 -0
- package/dist/adapters/redocly-loader/remote-fetch.cjs +41 -14
- package/dist/adapters/redocly-loader/remote-fetch.cjs.map +1 -1
- package/dist/adapters/redocly-loader/remote-fetch.mjs +40 -14
- package/dist/adapters/redocly-loader/remote-fetch.mjs.map +1 -1
- package/dist/adapters/redocly-loader/schema-load-errors.cjs +23 -5
- package/dist/adapters/redocly-loader/schema-load-errors.cjs.map +1 -1
- package/dist/adapters/redocly-loader/schema-load-errors.mjs +23 -5
- package/dist/adapters/redocly-loader/schema-load-errors.mjs.map +1 -1
- package/dist/adapters/redocly-loader/unsupported-keys.cjs +9 -1
- package/dist/adapters/redocly-loader/unsupported-keys.cjs.map +1 -1
- package/dist/adapters/redocly-loader/unsupported-keys.mjs +9 -1
- package/dist/adapters/redocly-loader/unsupported-keys.mjs.map +1 -1
- package/dist/adapters/terminal-logger/terminal-logger.cjs +6 -4
- package/dist/adapters/terminal-logger/terminal-logger.cjs.map +1 -1
- package/dist/adapters/terminal-logger/terminal-logger.mjs +6 -4
- package/dist/adapters/terminal-logger/terminal-logger.mjs.map +1 -1
- package/dist/adapters/type-ast-bridge/ir-to-typescript.cjs +5 -1
- package/dist/adapters/type-ast-bridge/ir-to-typescript.cjs.map +1 -1
- package/dist/adapters/type-ast-bridge/ir-to-typescript.mjs +5 -1
- package/dist/adapters/type-ast-bridge/ir-to-typescript.mjs.map +1 -1
- package/dist/adapters/type-ast-bridge/print-typescript.cjs.map +1 -1
- package/dist/adapters/type-ast-bridge/print-typescript.mjs.map +1 -1
- package/dist/adapters/type-ast-bridge/typescript-to-ir.cjs +15 -9
- package/dist/adapters/type-ast-bridge/typescript-to-ir.cjs.map +1 -1
- package/dist/adapters/type-ast-bridge/typescript-to-ir.mjs +15 -9
- package/dist/adapters/type-ast-bridge/typescript-to-ir.mjs.map +1 -1
- package/dist/api/default-ports.cjs +9 -0
- package/dist/api/default-ports.cjs.map +1 -1
- package/dist/api/default-ports.mjs +8 -1
- package/dist/api/default-ports.mjs.map +1 -1
- 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 +25 -0
- package/dist/api/discriminator-enum.cjs.map +1 -1
- package/dist/api/discriminator-enum.mjs +25 -1
- package/dist/api/discriminator-enum.mjs.map +1 -1
- 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 +92 -0
- package/dist/api/discriminator-patch.cjs.map +1 -0
- package/dist/api/discriminator-patch.mjs +86 -0
- package/dist/api/discriminator-patch.mjs.map +1 -0
- package/dist/api/discriminator-scan.cjs +50 -65
- package/dist/api/discriminator-scan.cjs.map +1 -1
- package/dist/api/discriminator-scan.mjs +44 -59
- package/dist/api/discriminator-scan.mjs.map +1 -1
- package/dist/api/document-refs.cjs +15 -12
- package/dist/api/document-refs.cjs.map +1 -1
- package/dist/api/document-refs.mjs +15 -12
- package/dist/api/document-refs.mjs.map +1 -1
- package/dist/api/document-run.cjs +21 -4
- package/dist/api/document-run.cjs.map +1 -1
- package/dist/api/document-run.mjs +22 -5
- package/dist/api/document-run.mjs.map +1 -1
- 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-sink.cjs +25 -2
- package/dist/api/footer-sink.cjs.map +1 -1
- package/dist/api/footer-sink.mjs +25 -2
- package/dist/api/footer-sink.mjs.map +1 -1
- package/dist/api/legacy-callback-warning.cjs +4 -1
- package/dist/api/legacy-callback-warning.cjs.map +1 -1
- package/dist/api/legacy-callback-warning.mjs +4 -1
- package/dist/api/legacy-callback-warning.mjs.map +1 -1
- package/dist/api/legacy-ts-helpers.cjs.map +1 -1
- package/dist/api/legacy-ts-helpers.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 +2 -1
- package/dist/api/openapi-ts.cjs.map +1 -1
- package/dist/api/openapi-ts.mjs +3 -2
- package/dist/api/openapi-ts.mjs.map +1 -1
- 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/transform-context.cjs +4 -2
- package/dist/api/transform-context.cjs.map +1 -1
- package/dist/api/transform-context.mjs +4 -2
- package/dist/api/transform-context.mjs.map +1 -1
- package/dist/api/transform-schema.cjs +52 -3
- package/dist/api/transform-schema.cjs.map +1 -1
- package/dist/api/transform-schema.mjs +53 -4
- package/dist/api/transform-schema.mjs.map +1 -1
- package/dist/api/unsupported-feature-warnings.cjs +6 -1
- package/dist/api/unsupported-feature-warnings.cjs.map +1 -1
- package/dist/api/unsupported-feature-warnings.mjs +6 -1
- package/dist/api/unsupported-feature-warnings.mjs.map +1 -1
- package/dist/application/print/type-printer.cjs +7 -1
- package/dist/application/print/type-printer.cjs.map +1 -1
- package/dist/application/print/type-printer.mjs +7 -1
- package/dist/application/print/type-printer.mjs.map +1 -1
- 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 +2 -2
- package/dist/application/transform/document/components.cjs.map +1 -1
- package/dist/application/transform/document/components.mjs +4 -4
- package/dist/application/transform/document/components.mjs.map +1 -1
- package/dist/application/transform/document/declared-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/document.cjs +32 -9
- package/dist/application/transform/document/document.cjs.map +1 -1
- package/dist/application/transform/document/document.mjs +34 -11
- package/dist/application/transform/document/document.mjs.map +1 -1
- 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/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/parameters.cjs +41 -9
- package/dist/application/transform/document/parameters.cjs.map +1 -1
- package/dist/application/transform/document/parameters.mjs +42 -10
- package/dist/application/transform/document/parameters.mjs.map +1 -1
- package/dist/application/transform/document/path-key-overlaps.cjs +83 -33
- package/dist/application/transform/document/path-key-overlaps.cjs.map +1 -1
- package/dist/application/transform/document/path-key-overlaps.mjs +83 -33
- package/dist/application/transform/document/path-key-overlaps.mjs.map +1 -1
- 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.cjs +55 -29
- package/dist/application/transform/document/paths.cjs.map +1 -1
- package/dist/application/transform/document/paths.mjs +54 -30
- package/dist/application/transform/document/paths.mjs.map +1 -1
- package/dist/application/transform/document/root-type-aliases.cjs +15 -14
- package/dist/application/transform/document/root-type-aliases.cjs.map +1 -1
- package/dist/application/transform/document/root-type-aliases.mjs +15 -13
- package/dist/application/transform/document/root-type-aliases.mjs.map +1 -1
- 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/footer/document-footer.cjs +66 -4
- package/dist/application/transform/footer/document-footer.cjs.map +1 -1
- package/dist/application/transform/footer/document-footer.mjs +67 -5
- package/dist/application/transform/footer/document-footer.mjs.map +1 -1
- package/dist/application/transform/footer/enum-naming.cjs +17 -0
- package/dist/application/transform/footer/enum-naming.cjs.map +1 -1
- package/dist/application/transform/footer/enum-naming.mjs +17 -1
- package/dist/application/transform/footer/enum-naming.mjs.map +1 -1
- 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 +42 -0
- package/dist/application/transform/footer/evaluation.cjs.map +1 -0
- package/dist/application/transform/footer/evaluation.mjs +33 -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 +138 -0
- package/dist/application/transform/footer/type-evaluation.cjs.map +1 -0
- package/dist/application/transform/footer/type-evaluation.mjs +136 -0
- package/dist/application/transform/footer/type-evaluation.mjs.map +1 -0
- package/dist/application/transform/footer/type-indexing.cjs +107 -0
- package/dist/application/transform/footer/type-indexing.cjs.map +1 -0
- package/dist/application/transform/footer/type-indexing.mjs +105 -0
- package/dist/application/transform/footer/type-indexing.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/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 +7 -2
- package/dist/application/transform/ref-type.cjs.map +1 -1
- package/dist/application/transform/ref-type.mjs +3 -2
- package/dist/application/transform/ref-type.mjs.map +1 -1
- 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 +32 -1
- package/dist/application/transform/schema/array-type.cjs.map +1 -1
- package/dist/application/transform/schema/array-type.mjs +33 -2
- package/dist/application/transform/schema/array-type.mjs.map +1 -1
- package/dist/application/transform/schema/composition-type.cjs +50 -15
- package/dist/application/transform/schema/composition-type.cjs.map +1 -1
- package/dist/application/transform/schema/composition-type.mjs +50 -15
- package/dist/application/transform/schema/composition-type.mjs.map +1 -1
- package/dist/application/transform/schema/core-type.cjs +3 -1
- package/dist/application/transform/schema/core-type.cjs.map +1 -1
- package/dist/application/transform/schema/core-type.mjs +3 -1
- package/dist/application/transform/schema/core-type.mjs.map +1 -1
- 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 +3 -2
- package/dist/application/transform/schema/discriminator-property.cjs.map +1 -1
- package/dist/application/transform/schema/discriminator-property.mjs +3 -2
- package/dist/application/transform/schema/discriminator-property.mjs.map +1 -1
- package/dist/application/transform/schema/enum-rule.cjs +66 -10
- package/dist/application/transform/schema/enum-rule.cjs.map +1 -1
- package/dist/application/transform/schema/enum-rule.mjs +67 -12
- package/dist/application/transform/schema/enum-rule.mjs.map +1 -1
- 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 +38 -25
- package/dist/application/transform/schema/object-type.cjs.map +1 -1
- package/dist/application/transform/schema/object-type.mjs +39 -27
- package/dist/application/transform/schema/object-type.mjs.map +1 -1
- 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 +2 -2
- package/dist/application/transform/schema/schema-transform.cjs.map +1 -1
- package/dist/application/transform/schema/schema-transform.mjs +2 -2
- package/dist/application/transform/schema/schema-transform.mjs.map +1 -1
- package/dist/application/transform/schema-comment.cjs +51 -5
- package/dist/application/transform/schema-comment.cjs.map +1 -1
- package/dist/application/transform/schema-comment.mjs +50 -6
- package/dist/application/transform/schema-comment.mjs.map +1 -1
- package/dist/application/transform/type-combinators.mjs +1 -1
- package/dist/cli/api-settings.cjs +78 -0
- package/dist/cli/api-settings.cjs.map +1 -0
- package/dist/cli/api-settings.mjs +73 -0
- package/dist/cli/api-settings.mjs.map +1 -0
- package/dist/cli/cli-arguments.cjs +12 -3
- package/dist/cli/cli-arguments.cjs.map +1 -1
- package/dist/cli/cli-arguments.mjs +12 -4
- package/dist/cli/cli-arguments.mjs.map +1 -1
- package/dist/cli/cli-errors.cjs +3 -2
- package/dist/cli/cli-errors.cjs.map +1 -1
- package/dist/cli/cli-errors.mjs +3 -2
- package/dist/cli/cli-errors.mjs.map +1 -1
- package/dist/cli/cli-output.cjs +8 -3
- package/dist/cli/cli-output.cjs.map +1 -1
- package/dist/cli/cli-output.mjs +9 -4
- package/dist/cli/cli-output.mjs.map +1 -1
- package/dist/cli/help-text.cjs +3 -3
- package/dist/cli/help-text.cjs.map +1 -1
- package/dist/cli/help-text.mjs +3 -3
- package/dist/cli/help-text.mjs.map +1 -1
- package/dist/cli/main.cjs +5 -0
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.mjs +5 -0
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/redocly-apis.cjs +15 -7
- package/dist/cli/redocly-apis.cjs.map +1 -1
- package/dist/cli/redocly-apis.mjs +15 -7
- package/dist/cli/redocly-apis.mjs.map +1 -1
- package/dist/cli/ref-limits.cjs +1 -1
- package/dist/cli/ref-limits.cjs.map +1 -1
- package/dist/cli/ref-limits.mjs +2 -2
- package/dist/cli/ref-limits.mjs.map +1 -1
- package/dist/cli/run-cli.cjs +20 -3
- package/dist/cli/run-cli.cjs.map +1 -1
- package/dist/cli/run-cli.mjs +21 -4
- package/dist/cli/run-cli.mjs.map +1 -1
- package/dist/domain/errors.cjs +6 -1
- package/dist/domain/errors.cjs.map +1 -1
- package/dist/domain/errors.mjs +6 -1
- package/dist/domain/errors.mjs.map +1 -1
- package/dist/domain/ir/constructors.cjs +7 -1
- package/dist/domain/ir/constructors.cjs.map +1 -1
- package/dist/domain/ir/constructors.mjs +6 -2
- package/dist/domain/ir/constructors.mjs.map +1 -1
- 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/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/parameter-object.cjs.map +1 -1
- package/dist/domain/openapi/parameter-object.mjs.map +1 -1
- 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/output-fixes.cjs +36 -1
- package/dist/domain/output-fixes.cjs.map +1 -1
- package/dist/domain/output-fixes.mjs +36 -1
- package/dist/domain/output-fixes.mjs.map +1 -1
- package/dist/domain/url-credentials.cjs +10 -0
- package/dist/domain/url-credentials.cjs.map +1 -0
- package/dist/domain/url-credentials.mjs +8 -0
- package/dist/domain/url-credentials.mjs.map +1 -0
- package/dist/domain/warnings.cjs +23 -0
- package/dist/domain/warnings.cjs.map +1 -0
- package/dist/domain/warnings.mjs +20 -0
- package/dist/domain/warnings.mjs.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1182 -46
- package/dist/index.d.mts +1182 -46
- package/dist/index.d.ts +1182 -46
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/dist/transform/components-object.cjs +2 -1
- package/dist/transform/components-object.cjs.map +1 -1
- package/dist/transform/components-object.mjs +2 -1
- package/dist/transform/components-object.mjs.map +1 -1
- package/dist/transform/path-item-object.cjs.map +1 -1
- package/dist/transform/path-item-object.mjs.map +1 -1
- package/package.json +6 -5
- package/src/adapters/redocly-loader/configured-headers.ts +65 -0
- package/src/adapters/redocly-loader/redocly-config-source.ts +41 -6
- package/src/adapters/redocly-loader/redocly-schema-loader.ts +44 -13
- package/src/adapters/redocly-loader/ref-access.ts +60 -5
- package/src/adapters/redocly-loader/ref-resolution-check.ts +257 -0
- package/src/adapters/redocly-loader/ref-resolution-steps.ts +113 -0
- package/src/adapters/redocly-loader/remote-fetch.ts +77 -21
- package/src/adapters/redocly-loader/schema-load-errors.ts +33 -11
- package/src/adapters/redocly-loader/unsupported-keys.ts +17 -2
- package/src/adapters/terminal-logger/terminal-logger.ts +9 -5
- package/src/adapters/type-ast-bridge/ir-to-typescript.ts +5 -1
- package/src/adapters/type-ast-bridge/print-typescript.ts +3 -1
- package/src/adapters/type-ast-bridge/typescript-to-ir.ts +26 -12
- package/src/adapters/type-ast-bridge/typescript-types.ts +57 -5
- package/src/api/default-ports.ts +16 -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 +39 -0
- package/src/api/discriminator-other-owners.ts +97 -0
- package/src/api/discriminator-patch.ts +152 -0
- package/src/api/discriminator-scan.ts +78 -90
- package/src/api/document-refs.ts +19 -15
- package/src/api/document-run.ts +32 -11
- package/src/api/enum-values-warnings.ts +21 -0
- package/src/api/footer-sink.ts +34 -2
- package/src/api/legacy-callback-warning.ts +7 -3
- package/src/api/legacy-ts-helpers.ts +7 -5
- package/src/api/legacy-utils.ts +1 -1
- package/src/api/openapi-ts.ts +2 -0
- package/src/api/path-template-warnings.ts +27 -0
- package/src/api/run-context.ts +34 -0
- package/src/api/transform-context.ts +17 -9
- package/src/api/transform-schema.ts +90 -5
- package/src/api/unsupported-feature-warnings.ts +8 -1
- package/src/application/ports/redocly-config-source.ts +5 -1
- package/src/application/print/type-printer.ts +8 -1
- package/src/application/transform/document/assignability.ts +203 -0
- package/src/application/transform/document/components.ts +6 -6
- package/src/application/transform/document/declared-types.ts +93 -0
- package/src/application/transform/document/document.ts +71 -13
- 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/list-assignability.ts +87 -0
- package/src/application/transform/document/parameters.ts +78 -12
- package/src/application/transform/document/path-key-overlaps.ts +148 -59
- package/src/application/transform/document/path-template-replace.ts +90 -0
- package/src/application/transform/document/paths.ts +101 -38
- package/src/application/transform/document/root-type-aliases.ts +29 -28
- 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/footer/document-footer.ts +91 -6
- package/src/application/transform/footer/enum-naming.ts +29 -0
- package/src/application/transform/footer/enum-values-check.ts +171 -0
- package/src/application/transform/footer/evaluation.ts +57 -0
- package/src/application/transform/footer/shared-enum-names.ts +86 -0
- package/src/application/transform/footer/type-evaluation.ts +167 -0
- package/src/application/transform/footer/type-indexing.ts +152 -0
- package/src/application/transform/footer/type-rules.ts +269 -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 +11 -6
- package/src/application/transform/schema/access-flags.ts +63 -0
- package/src/application/transform/schema/array-type.ts +66 -5
- package/src/application/transform/schema/composition-type.ts +96 -24
- package/src/application/transform/schema/core-type.ts +8 -4
- package/src/application/transform/schema/discriminated-union.ts +58 -0
- package/src/application/transform/schema/discriminator-property.ts +8 -3
- package/src/application/transform/schema/enum-rule.ts +136 -13
- package/src/application/transform/schema/inherited-discriminator.ts +54 -0
- package/src/application/transform/schema/object-type.ts +51 -33
- package/src/application/transform/schema/required-variants.ts +88 -0
- package/src/application/transform/schema/schema-context.ts +26 -0
- package/src/application/transform/schema/schema-transform.ts +2 -2
- package/src/application/transform/schema-comment.ts +84 -4
- package/src/cli/api-settings.ts +109 -0
- package/src/cli/cli-arguments.ts +18 -5
- package/src/cli/cli-dependencies.ts +5 -0
- package/src/cli/cli-errors.ts +4 -2
- package/src/cli/cli-output.ts +18 -4
- package/src/cli/help-text.ts +4 -4
- package/src/cli/main.ts +6 -0
- package/src/cli/redocly-apis.ts +21 -11
- package/src/cli/ref-limits.ts +2 -2
- package/src/cli/run-cli.ts +25 -4
- package/src/domain/errors.ts +10 -2
- package/src/domain/ir/constructors.ts +9 -1
- package/src/domain/ir/nodes.ts +11 -7
- package/src/domain/openapi/admitted-values.ts +113 -0
- package/src/domain/openapi/discriminated-union.ts +109 -0
- package/src/domain/openapi/discriminator-conflicts.ts +251 -0
- package/src/domain/openapi/parameter-object.ts +4 -0
- package/src/domain/openapi/path-templates.ts +32 -0
- package/src/domain/openapi/schema-object.ts +2 -0
- package/src/domain/output-fixes.ts +43 -2
- package/src/domain/url-credentials.ts +18 -0
- package/src/domain/warnings.ts +28 -0
- package/src/index.ts +1 -0
- package/src/transform/components-object.ts +3 -1
- package/src/transform/path-item-object.ts +6 -2
- package/src/types/generator-options.ts +12 -21
- package/src/types/openapi-common.ts +1 -0
- package/src/types/openapi-request.ts +3 -0
- package/src/types/openapi-schema.ts +2 -0
- package/src/types/openapi-security.ts +1 -0
- package/dist/application/transform/document/path-item-conflicts.cjs +0 -51
- package/dist/application/transform/document/path-item-conflicts.cjs.map +0 -1
- package/dist/application/transform/document/path-item-conflicts.mjs +0 -49
- package/dist/application/transform/document/path-item-conflicts.mjs.map +0 -1
- package/src/application/transform/document/path-item-conflicts.ts +0 -79
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
import { PathLike } from 'node:fs';
|
|
2
2
|
import { Readable } from 'node:stream';
|
|
3
3
|
import { Config } from '@redocly/openapi-core';
|
|
4
|
-
import
|
|
4
|
+
import * as TypeScript from 'typescript';
|
|
5
5
|
import colors from 'ansi-colors';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Type IR: the closed set of immutable nodes that describes the TypeScript types and declarations
|
|
9
|
+
* the generator emits (ENGINEERING_PLAN §4.2, ADR-002). Nodes are plain readonly data with a `kind`
|
|
10
|
+
* discriminator; every consumer in this package dispatches with an exhaustive `switch`, so a new
|
|
11
|
+
* kind breaks the build wherever it must be handled. For users the set is open: a minor release
|
|
12
|
+
* may add a kind (ADR-034), so code outside the package must keep a node of an unknown kind as it
|
|
13
|
+
* is, and a `switch` over `kind` needs a `default` branch.
|
|
14
|
+
*
|
|
15
|
+
* Utility types (`Omit`, `Record`, `WithRequired`, `Extract`) are `reference` nodes with type
|
|
16
|
+
* arguments, built by named constructors: the printer has nothing special to do for them.
|
|
17
|
+
*/
|
|
18
|
+
/** Keyword types. `null` is a keyword here; TypeScript models it as a literal type. */
|
|
7
19
|
type IrKeyword = "string" | "number" | "boolean" | "null" | "undefined" | "unknown" | "never";
|
|
20
|
+
/**
|
|
21
|
+
* How a string literal is written.
|
|
22
|
+
* - `json`: `JSON.stringify` text, non-ASCII kept as is. The original writes literal types this way
|
|
23
|
+
* to keep UTF-8 readable (TypeScript issue 36174).
|
|
24
|
+
* - `escaped`: TypeScript printer escaping, non-ASCII as `\uXXXX`. The original writes
|
|
25
|
+
* indexed-access keys and quoted property names this way.
|
|
26
|
+
*/
|
|
8
27
|
type IrStringEncoding = "json" | "escaped";
|
|
9
28
|
interface IrKeywordType {
|
|
10
29
|
readonly kind: "keyword";
|
|
@@ -13,8 +32,10 @@ interface IrKeywordType {
|
|
|
13
32
|
interface IrStringLiteralType {
|
|
14
33
|
readonly kind: "stringLiteral";
|
|
15
34
|
readonly value: string;
|
|
16
|
-
|
|
35
|
+
/** How the printer writes the value; unset is `json`. A detail of the printer. */
|
|
36
|
+
readonly encoding?: IrStringEncoding;
|
|
17
37
|
}
|
|
38
|
+
/** Finite number; a negative value prints with a leading minus sign. */
|
|
18
39
|
interface IrNumberLiteralType {
|
|
19
40
|
readonly kind: "numberLiteral";
|
|
20
41
|
readonly value: number;
|
|
@@ -23,6 +44,7 @@ interface IrBooleanLiteralType {
|
|
|
23
44
|
readonly kind: "booleanLiteral";
|
|
24
45
|
readonly value: boolean;
|
|
25
46
|
}
|
|
47
|
+
/** A named type, optionally with type arguments: `components`, `Record<string, never>`. */
|
|
26
48
|
interface IrReferenceType {
|
|
27
49
|
readonly kind: "reference";
|
|
28
50
|
readonly name: string;
|
|
@@ -32,9 +54,11 @@ interface IrArrayType {
|
|
|
32
54
|
readonly kind: "array";
|
|
33
55
|
readonly element: IrType;
|
|
34
56
|
}
|
|
57
|
+
/** A tuple element; `isRest` prints `...T`, `isOptional` prints `T?` (never both). */
|
|
35
58
|
interface IrTupleElement {
|
|
36
59
|
readonly type: IrType;
|
|
37
60
|
readonly isRest: boolean;
|
|
61
|
+
readonly isOptional: boolean;
|
|
38
62
|
}
|
|
39
63
|
interface IrTupleType {
|
|
40
64
|
readonly kind: "tuple";
|
|
@@ -52,28 +76,48 @@ interface IrObjectType {
|
|
|
52
76
|
readonly kind: "object";
|
|
53
77
|
readonly members: readonly IrMember[];
|
|
54
78
|
}
|
|
79
|
+
/** `object[index]`, for example `components["schemas"]`. */
|
|
55
80
|
interface IrIndexedAccessType {
|
|
56
81
|
readonly kind: "indexedAccess";
|
|
57
82
|
readonly object: IrType;
|
|
58
83
|
readonly index: IrType;
|
|
59
84
|
}
|
|
85
|
+
/** `readonly T` (the only type operator the generator emits). */
|
|
60
86
|
interface IrReadonlyType {
|
|
61
87
|
readonly kind: "readonly";
|
|
62
88
|
readonly type: IrType;
|
|
63
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Text printed as is. Escape hatch for types that come from outside the IR, for example output of
|
|
92
|
+
* legacy `ts.Node` callbacks converted by the type-AST bridge (ENGINEERING_PLAN 6.3). The text is
|
|
93
|
+
* written as if it started at column 0: each line after the first gets the indentation of the
|
|
94
|
+
* position where the type is printed. Known limit: this also indents the continuation lines of a
|
|
95
|
+
* template literal that spans lines, which TypeScript keeps verbatim (ADR-004).
|
|
96
|
+
*/
|
|
64
97
|
interface IrRawType {
|
|
65
98
|
readonly kind: "raw";
|
|
66
99
|
readonly text: string;
|
|
100
|
+
/**
|
|
101
|
+
* @internal The TypeScript node the bridge printed the text from. The reverse bridge (the
|
|
102
|
+
* deprecated `ts.Node` callbacks, ADR-004) hands it back unchanged. Set by the generator only:
|
|
103
|
+
* read it as opaque, never set it, and expect it to go away in 2.0.
|
|
104
|
+
*/
|
|
67
105
|
readonly origin?: unknown;
|
|
68
106
|
}
|
|
69
107
|
type IrType = IrKeywordType | IrStringLiteralType | IrNumberLiteralType | IrBooleanLiteralType | IrReferenceType | IrArrayType | IrTupleType | IrUnionType | IrIntersectionType | IrObjectType | IrIndexedAccessType | IrReadonlyType | IrRawType;
|
|
70
|
-
|
|
108
|
+
/** A comment printed on its own line before a node; a node may have several, printed in order. */
|
|
109
|
+
type IrComment =
|
|
110
|
+
/** `/*text*\/`: `text` is the comment body, for example `* @description Hello `. */
|
|
111
|
+
{
|
|
71
112
|
readonly kind: "block";
|
|
72
113
|
readonly text: string;
|
|
73
|
-
}
|
|
114
|
+
}
|
|
115
|
+
/** `//text`. */
|
|
116
|
+
| {
|
|
74
117
|
readonly kind: "line";
|
|
75
118
|
readonly text: string;
|
|
76
119
|
};
|
|
120
|
+
/** Property key: identifier, quoted string, or number, as decided by `toPropertyName`. */
|
|
77
121
|
type IrPropertyName = {
|
|
78
122
|
readonly kind: "identifier";
|
|
79
123
|
readonly text: string;
|
|
@@ -92,6 +136,7 @@ interface IrPropertySignature {
|
|
|
92
136
|
readonly isReadonly: boolean;
|
|
93
137
|
readonly comments: readonly IrComment[];
|
|
94
138
|
}
|
|
139
|
+
/** `[parameterName: parameterType]: type`. */
|
|
95
140
|
interface IrIndexSignature {
|
|
96
141
|
readonly kind: "indexSignature";
|
|
97
142
|
readonly parameterName: string;
|
|
@@ -115,6 +160,7 @@ interface IrTypeAliasDeclaration {
|
|
|
115
160
|
readonly type: IrType;
|
|
116
161
|
readonly comments: readonly IrComment[];
|
|
117
162
|
}
|
|
163
|
+
/** `name` is printed as given (already sanitized or quoted by the enum naming rules). */
|
|
118
164
|
interface IrEnumMember {
|
|
119
165
|
readonly name: string;
|
|
120
166
|
readonly value: string | number;
|
|
@@ -127,6 +173,7 @@ interface IrEnumDeclaration {
|
|
|
127
173
|
readonly members: readonly IrEnumMember[];
|
|
128
174
|
readonly comments: readonly IrComment[];
|
|
129
175
|
}
|
|
176
|
+
/** `const name: type = [values];` (the `--enum-values` and `--make-paths-enum` arrays). */
|
|
130
177
|
interface IrConstArrayDeclaration {
|
|
131
178
|
readonly kind: "constArray";
|
|
132
179
|
readonly name: string;
|
|
@@ -135,89 +182,233 @@ interface IrConstArrayDeclaration {
|
|
|
135
182
|
readonly values: readonly (string | number)[];
|
|
136
183
|
readonly comments: readonly IrComment[];
|
|
137
184
|
}
|
|
185
|
+
/** A declaration printed as is: footer helpers and injected code. */
|
|
138
186
|
interface IrRawDeclaration {
|
|
139
187
|
readonly kind: "rawDeclaration";
|
|
140
188
|
readonly text: string;
|
|
189
|
+
/** The type name the text declares, when known (helper types), so the footer can find it. */
|
|
141
190
|
readonly name?: string;
|
|
142
191
|
}
|
|
143
192
|
type IrDeclaration = IrInterfaceDeclaration | IrTypeAliasDeclaration | IrEnumDeclaration | IrConstArrayDeclaration | IrRawDeclaration;
|
|
144
193
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
194
|
+
/**
|
|
195
|
+
* The TypeScript compiler's node types for code outside the bridge and for the public
|
|
196
|
+
* declarations (ADR-004, decision 4; ADR-032). Type-only: importing it never loads TypeScript.
|
|
197
|
+
*
|
|
198
|
+
* Each type is read from the compiler API of the `typescript` package the consumer has installed
|
|
199
|
+
* (`factory`, `createPrinter`), not named as `ts.Node`. TypeScript 5.x and 6.x have that API, so
|
|
200
|
+
* the types are the compiler's own. TypeScript 7's `typescript` package exports only `version`;
|
|
201
|
+
* `ts.Node` there is error TS2694 in a consumer that checks declarations (`skipLibCheck: false`).
|
|
202
|
+
*/
|
|
203
|
+
type Api = typeof TypeScript;
|
|
204
|
+
type Factory = Api extends {
|
|
205
|
+
readonly factory: infer F;
|
|
206
|
+
} ? F : undefined;
|
|
207
|
+
/**
|
|
208
|
+
* A compiler type when the installed `typescript` has no compiler API (TypeScript 7). It is `any`
|
|
209
|
+
* because that is what these types already were for such a consumer with `skipLibCheck: true`
|
|
210
|
+
* (an unresolved type in a declaration file is `any`), so callbacks that build or read nodes of
|
|
211
|
+
* `@typescript/typescript6` keep compiling (ADR-032). The cost, as before: a union with a node
|
|
212
|
+
* type, such as the result of `transform`, accepts any value there.
|
|
213
|
+
*/
|
|
214
|
+
type WithoutCompilerApi = any;
|
|
215
|
+
/** The node type that `factory[Name]` returns, or `WithoutCompilerApi`. */
|
|
216
|
+
type Created<Name extends string> = Factory extends {
|
|
217
|
+
readonly [Key in Name]: (...args: never[]) => infer Result;
|
|
218
|
+
} ? Result : WithoutCompilerApi;
|
|
219
|
+
type ModifierList = Created<"createModifiersFromModifierFlags">;
|
|
220
|
+
/** The compiler node types the package names; see the module comment. */
|
|
221
|
+
declare namespace ts {
|
|
222
|
+
type Node = Api extends {
|
|
223
|
+
isTypeNode(node: infer N): boolean;
|
|
224
|
+
} ? N : WithoutCompilerApi;
|
|
225
|
+
type TypeNode = Factory extends {
|
|
226
|
+
createArrayTypeNode(elementType: infer T): unknown;
|
|
227
|
+
} ? T : WithoutCompilerApi;
|
|
228
|
+
type QuestionToken = Factory extends {
|
|
229
|
+
createPropertySignature(modifiers: never, name: never, token: infer Q, type: never): unknown;
|
|
230
|
+
} ? NonNullable<Q> : WithoutCompilerApi;
|
|
231
|
+
type Modifier = ModifierList extends readonly (infer M)[] | undefined ? M : WithoutCompilerApi;
|
|
232
|
+
type PrinterOptions = Api extends {
|
|
233
|
+
createPrinter(options?: infer O, ...rest: never[]): unknown;
|
|
234
|
+
} ? NonNullable<O> : WithoutCompilerApi;
|
|
235
|
+
type PropertySignature = Created<"createPropertySignature">;
|
|
236
|
+
type LiteralTypeNode = Created<"createLiteralTypeNode">;
|
|
237
|
+
type TypeLiteralNode = Created<"createTypeLiteralNode">;
|
|
238
|
+
type InterfaceDeclaration = Created<"createInterfaceDeclaration">;
|
|
239
|
+
type EnumDeclaration = Created<"createEnumDeclaration">;
|
|
240
|
+
type EnumMember = Created<"createEnumMember">;
|
|
241
|
+
type VariableStatement = Created<"createVariableStatement">;
|
|
242
|
+
type Identifier = Created<"createIdentifier">;
|
|
243
|
+
type NumericLiteral = Created<"createNumericLiteral">;
|
|
244
|
+
type StringLiteral = Created<"createStringLiteral">;
|
|
152
245
|
}
|
|
153
246
|
|
|
247
|
+
/** A footer entry: a declaration in IR, or a TypeScript node added by user code. */
|
|
248
|
+
type FooterEntry = IrDeclaration | ts.Node;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Opt-in fixes of the output of valid schemas (ADR-021). Each one changes only the cases it names;
|
|
252
|
+
* without any, the output is the same as openapi-typescript 7.13 gives. In 2.0 they become the
|
|
253
|
+
* default.
|
|
254
|
+
*/
|
|
154
255
|
declare const OutputFix: {
|
|
256
|
+
/** An `allOf` `$ref` to a discriminated union is the union, without `Omit` or a schema name. */
|
|
257
|
+
readonly ALLOF_DISCRIMINATED_UNION: "allof-discriminated-union";
|
|
258
|
+
/** An `allOf` member with only `required` makes those properties of the others required. */
|
|
155
259
|
readonly ALLOF_REQUIRED: "allof-required";
|
|
260
|
+
/** The JSDoc of a schema lists the descriptions of its `anyOf` and `oneOf` members. */
|
|
261
|
+
readonly ANYOF_ONEOF_DESCRIPTIONS: "anyof-oneof-descriptions";
|
|
262
|
+
/** `anyOf` / `oneOf` variants with only `required` make those keys of the parent required. */
|
|
263
|
+
readonly ANYOF_ONEOF_REQUIRED: "anyof-oneof-required";
|
|
264
|
+
/** `anyOf` next to object keywords or `allOf` is intersected with them, not added to a union. */
|
|
156
265
|
readonly ANYOF_PROPERTIES: "anyof-properties";
|
|
266
|
+
/** `--array-length` tuples have `min` to `max` items, nest right and follow `--immutable`. */
|
|
157
267
|
readonly ARRAY_LENGTH_TUPLES: "array-length-tuples";
|
|
268
|
+
/** `--dedupe-enums` names a shared enum by all of its schemas, not by the first one. */
|
|
269
|
+
readonly DEDUPE_ENUM_NAMES: "dedupe-enum-names";
|
|
270
|
+
/** `required` next to an `allOf` `$ref` to a discriminator member still gives `WithRequired`. */
|
|
271
|
+
readonly DISCRIMINATOR_MEMBER_REQUIRED: "discriminator-member-required";
|
|
272
|
+
/**
|
|
273
|
+
* The value a discriminator member gets: one enum of every discriminator's values, a mapping
|
|
274
|
+
* before the schema name, a schema's own mapping before an inherited one, none where the member
|
|
275
|
+
* declares it, and with `--enum` a member of the owner's enum.
|
|
276
|
+
*/
|
|
158
277
|
readonly DISCRIMINATOR_VALUES: "discriminator-values";
|
|
278
|
+
/** An exploded object query parameter's properties are keys of `query`, as they are sent. */
|
|
279
|
+
readonly EXPLODED_QUERY_OBJECTS: "exploded-query-objects";
|
|
280
|
+
/** `--enum` declares an enum that lists `null` without it, and the type adds `| null`. */
|
|
281
|
+
readonly NULLABLE_ENUMS: "nullable-enums";
|
|
282
|
+
/** `--path-params-as-types` gives each `{name}` its placeholder, `{number}` included. */
|
|
283
|
+
readonly PATH_PARAM_TYPE_NAMES: "path-param-type-names";
|
|
284
|
+
/** A `prefixItems` tuple is open unless `items` or `unevaluatedItems` closes it (2020-12). */
|
|
285
|
+
readonly PREFIX_ITEMS: "prefix-items";
|
|
286
|
+
/** `readOnly` and `writeOnly` of the schema a `$ref` names, or of `allOf` members, count. */
|
|
287
|
+
readonly READ_WRITE_REFS: "read-write-refs";
|
|
288
|
+
/**
|
|
289
|
+
* A `$ref` into schema keywords (`content/<type>/schema`, `items`, `allOf/0`) gets the type it
|
|
290
|
+
* points at, also where the original type compiles through an index signature.
|
|
291
|
+
*/
|
|
292
|
+
readonly REF_POINTERS: "ref-pointers";
|
|
293
|
+
/** Schemas of one root type name without the prefix each get an alias, the earlier numbered. */
|
|
159
294
|
readonly ROOT_TYPE_NUMBERING: "root-type-numbering";
|
|
295
|
+
/** `unevaluatedProperties` types the keys no other keyword declares (an index signature). */
|
|
160
296
|
readonly UNEVALUATED_PROPERTIES: "unevaluated-properties";
|
|
161
297
|
};
|
|
162
298
|
type OutputFix = (typeof OutputFix)[keyof typeof OutputFix];
|
|
299
|
+
/** Every fix of this version, in the order the docs list them. */
|
|
163
300
|
declare const OUTPUT_FIXES: readonly OutputFix[];
|
|
301
|
+
/** The name that turns on every fix of the installed version. */
|
|
164
302
|
declare const ALL_OUTPUT_FIXES = "all";
|
|
303
|
+
/** A name the `fix` option accepts: one fix, or `all`. */
|
|
165
304
|
type OutputFixName = OutputFix | typeof ALL_OUTPUT_FIXES;
|
|
166
305
|
|
|
167
|
-
interface EnumMemberMetadata {
|
|
168
|
-
readonly name: string | undefined;
|
|
169
|
-
readonly description: string | undefined;
|
|
170
|
-
}
|
|
171
|
-
interface EnumDeclarationRequest {
|
|
172
|
-
readonly name: string;
|
|
173
|
-
readonly values: readonly (string | number)[];
|
|
174
|
-
readonly metadata: readonly EnumMemberMetadata[];
|
|
175
|
-
}
|
|
176
|
-
interface EnumValuesRequest {
|
|
177
|
-
readonly name: string;
|
|
178
|
-
readonly type: IrType;
|
|
179
|
-
readonly values: readonly (string | number)[];
|
|
180
|
-
}
|
|
181
|
-
interface FooterDeclarations {
|
|
182
|
-
addEnum(request: EnumDeclarationRequest): string;
|
|
183
|
-
addEnumValues(request: EnumValuesRequest): void;
|
|
184
|
-
requireWithRequired(): void;
|
|
185
|
-
requirePropertyValues(): void;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
interface DocumentFooter extends FooterDeclarations {
|
|
189
|
-
addOperation(build: () => IrPropertySignature): void;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
306
|
interface Extensable {
|
|
193
307
|
[key: `x-${string}`]: any;
|
|
194
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* [4.8.5] Server Object
|
|
311
|
+
* An object representing a Server.
|
|
312
|
+
*/
|
|
195
313
|
interface ServerObject extends Extensable {
|
|
314
|
+
/**
|
|
315
|
+
* REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to
|
|
316
|
+
* indicate that the host location is relative to the location where the OpenAPI document is being
|
|
317
|
+
* served. Variable substitutions will be made when a variable is named in {brackets}.
|
|
318
|
+
*/
|
|
196
319
|
url: string;
|
|
320
|
+
/**
|
|
321
|
+
* An optional string describing the host designated by the URL. CommonMark syntax MAY be used for
|
|
322
|
+
* rich text representation.
|
|
323
|
+
*/
|
|
197
324
|
description: string;
|
|
325
|
+
/**
|
|
326
|
+
* A map between a variable name and its value. The value is used for substitution in the server’s
|
|
327
|
+
* URL template.
|
|
328
|
+
*/
|
|
198
329
|
variables: {
|
|
199
330
|
[name: string]: ServerVariableObject;
|
|
200
331
|
};
|
|
201
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* [4.8.6] Server Variable Object
|
|
335
|
+
* An object representing a Server Variable for server URL template substitution.
|
|
336
|
+
*/
|
|
202
337
|
interface ServerVariableObject extends Extensable {
|
|
338
|
+
/**
|
|
339
|
+
* An enumeration of string values to be used if the substitution options are from a limited set.
|
|
340
|
+
* The array MUST NOT be empty.
|
|
341
|
+
*/
|
|
203
342
|
enum?: string[];
|
|
343
|
+
/**
|
|
344
|
+
* REQUIRED. The default value to use for substitution, which SHALL be sent if an alternate value
|
|
345
|
+
* is not supplied. Note this behavior is different than the Schema Object’s treatment of default
|
|
346
|
+
* values, because in those cases parameter values are optional. If the enum is defined, the value
|
|
347
|
+
* MUST exist in the enum’s values.
|
|
348
|
+
*/
|
|
204
349
|
default: string;
|
|
350
|
+
/**
|
|
351
|
+
* An optional description for the server variable. CommonMark syntax MAY be used for rich text
|
|
352
|
+
* representation.
|
|
353
|
+
*/
|
|
205
354
|
description?: string;
|
|
206
355
|
}
|
|
356
|
+
/**
|
|
357
|
+
* [4.8.11] External Documentation Object
|
|
358
|
+
* Allows referencing an external resource for extended documentation.
|
|
359
|
+
*/
|
|
207
360
|
interface ExternalDocumentationObject extends Extensable {
|
|
361
|
+
/**
|
|
362
|
+
* A description of the target documentation. CommonMark syntax MAY be used for rich text
|
|
363
|
+
* representation.
|
|
364
|
+
*/
|
|
208
365
|
description?: string;
|
|
366
|
+
/** REQUIRED. The URL for the target documentation. This MUST be in the form of a URL. */
|
|
209
367
|
url: string;
|
|
210
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* [4.8.23] Reference Object
|
|
371
|
+
* A simple object to allow referencing other components in the OpenAPI document, internally and
|
|
372
|
+
* externally. The $ref string value contains a URI [RFC3986], which identifies the location of the
|
|
373
|
+
* value being referenced. See the rules for resolving Relative References.
|
|
374
|
+
*/
|
|
211
375
|
interface ReferenceObject extends Extensable {
|
|
376
|
+
/** REQUIRED. The reference identifier. This MUST be in the form of a URI. */
|
|
212
377
|
$ref: string;
|
|
378
|
+
/**
|
|
379
|
+
* A short summary which by default SHOULD override that of the referenced component. If the
|
|
380
|
+
* referenced object-type does not allow a summary field, then this field has no effect.
|
|
381
|
+
*/
|
|
213
382
|
summary?: string;
|
|
383
|
+
/**
|
|
384
|
+
* A description which by default SHOULD override that of the referenced component. CommonMark
|
|
385
|
+
* syntax MAY be used for rich text representation. If the referenced object-type does not allow a
|
|
386
|
+
* description field, then this field has no effect.
|
|
387
|
+
*/
|
|
214
388
|
description?: string;
|
|
215
389
|
}
|
|
216
390
|
|
|
391
|
+
/**
|
|
392
|
+
* [4.8.24] Schema Object
|
|
393
|
+
* The Schema Object allows the definition of input and output data types. These types can be
|
|
394
|
+
* objects, but also primitives and arrays. This object is a superset of the JSON Schema
|
|
395
|
+
* Specification Draft 2020-12.
|
|
396
|
+
*/
|
|
217
397
|
type SchemaObject = {
|
|
398
|
+
/**
|
|
399
|
+
* The Schema Object allows the definition of input and output data types. These types can be
|
|
400
|
+
* objects, but also primitives and arrays. This object is a superset of the JSON Schema
|
|
401
|
+
* Specification Draft 2020-12.
|
|
402
|
+
*/
|
|
218
403
|
discriminator?: DiscriminatorObject;
|
|
404
|
+
/**
|
|
405
|
+
* MAY be used only on properties schemas. It has no effect on root schemas. Adds additional
|
|
406
|
+
* metadata to describe the XML representation of this property.
|
|
407
|
+
*/
|
|
219
408
|
xml?: XMLObject;
|
|
409
|
+
/** Additional external documentation for this schema. */
|
|
220
410
|
externalDocs?: ExternalDocumentationObject;
|
|
411
|
+
/** @deprecated */
|
|
221
412
|
example?: any;
|
|
222
413
|
title?: string;
|
|
223
414
|
description?: string;
|
|
@@ -226,12 +417,19 @@ type SchemaObject = {
|
|
|
226
417
|
readOnly?: boolean;
|
|
227
418
|
writeOnly?: boolean;
|
|
228
419
|
enum?: unknown[];
|
|
420
|
+
/**
|
|
421
|
+
* Use of this keyword is functionally equivalent to an "enum" (Section 6.1.2) with a single
|
|
422
|
+
* value.
|
|
423
|
+
*/
|
|
229
424
|
const?: unknown;
|
|
230
425
|
default?: unknown;
|
|
231
426
|
format?: string;
|
|
427
|
+
/** Media type of the string contents (OpenAPI 3.1, JSON Schema 2020-12), e.g. `image/png`. */
|
|
232
428
|
contentMediaType?: string;
|
|
429
|
+
/** How the string's contents are encoded (OpenAPI 3.1, JSON Schema 2020-12), e.g. `base64`. */
|
|
233
430
|
contentEncoding?: string;
|
|
234
431
|
additionalProperties?: boolean | Record<string, never> | SchemaObject | ReferenceObject;
|
|
432
|
+
/** @deprecated in 3.1 (still valid for 3.0) */
|
|
235
433
|
nullable?: boolean;
|
|
236
434
|
oneOf?: (SchemaObject | ReferenceObject)[];
|
|
237
435
|
allOf?: (SchemaObject | ReferenceObject)[];
|
|
@@ -288,298 +486,922 @@ interface ObjectSubtype {
|
|
|
288
486
|
enum?: (SchemaObject | ReferenceObject)[];
|
|
289
487
|
$defs?: $defs;
|
|
290
488
|
}
|
|
489
|
+
/**
|
|
490
|
+
* [4.8.25] Discriminator Object
|
|
491
|
+
* When request bodies or response payloads may be one of a number of different schemas, a
|
|
492
|
+
* discriminator object can be used to aid in serialization, deserialization, and validation. The
|
|
493
|
+
* discriminator is a specific object in a schema which is used to inform the consumer of the
|
|
494
|
+
* document of an alternative schema based on the value associated with it.
|
|
495
|
+
*/
|
|
291
496
|
interface DiscriminatorObject {
|
|
497
|
+
/**
|
|
498
|
+
* The name of the property in the payload that will hold the discriminator value. Required
|
|
499
|
+
* before OpenAPI 3.2; typed as required so existing readers keep a `string`.
|
|
500
|
+
*/
|
|
292
501
|
propertyName: string;
|
|
502
|
+
/** An object to hold mappings between payload values and schema names or references. */
|
|
293
503
|
mapping?: Record<string, string>;
|
|
504
|
+
/** The schema for payloads without the property or with an unmapped value (OpenAPI 3.2). */
|
|
294
505
|
defaultMapping?: string;
|
|
506
|
+
/** If this exists, then a discriminator type should be added to objects matching this path */
|
|
295
507
|
oneOf?: string[];
|
|
296
508
|
}
|
|
509
|
+
/**
|
|
510
|
+
* [4.8.26] XML Object
|
|
511
|
+
* A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML
|
|
512
|
+
* element names are not inferred (for singular/plural forms) and the `name` property SHOULD be used
|
|
513
|
+
* to add that information. See examples for expected behavior.
|
|
514
|
+
*/
|
|
297
515
|
interface XMLObject extends Extensable {
|
|
516
|
+
/**
|
|
517
|
+
* Replaces the name of the element/attribute used for the described schema property. When defined
|
|
518
|
+
* within `items`, it will affect the name of the individual XML elements within the list. When
|
|
519
|
+
* defined alongside `type` being `array` (outside the `items`), it will affect the wrapping
|
|
520
|
+
* element and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored.
|
|
521
|
+
*/
|
|
298
522
|
name?: string;
|
|
523
|
+
/** The URI of the namespace definition. This MUST be in the form of an absolute URI. */
|
|
299
524
|
namespace?: string;
|
|
525
|
+
/** The prefix to be used for the name. */
|
|
300
526
|
prefix?: string;
|
|
527
|
+
/**
|
|
528
|
+
* Declares whether the property definition translates to an attribute instead of an element.
|
|
529
|
+
* Default value is `false`.
|
|
530
|
+
*/
|
|
301
531
|
attribute?: boolean;
|
|
532
|
+
/**
|
|
533
|
+
* MAY be used only for an array definition. Signifies whether the array is wrapped (for example,
|
|
534
|
+
* `<books><book/><book/></books>`) or unwrapped (`<book/><book/>`). Default value is `false`. The
|
|
535
|
+
* definition takes effect only when defined alongside `type` being `array` (outside the `items`).
|
|
536
|
+
*/
|
|
302
537
|
wrapped?: boolean;
|
|
303
538
|
}
|
|
539
|
+
/** The `$defs` of a Schema Object: named subschemas. */
|
|
304
540
|
type $defs = Record<string, SchemaObject>;
|
|
305
541
|
|
|
542
|
+
/**
|
|
543
|
+
* [4.8.12] Parameter Object
|
|
544
|
+
* Describes a single operation parameter.
|
|
545
|
+
* A unique parameter is defined by a combination of a name and location.
|
|
546
|
+
*/
|
|
306
547
|
interface ParameterObject extends Extensable {
|
|
548
|
+
/**
|
|
549
|
+
* REQUIRED. The name of the parameter. Parameter names are case sensitive.
|
|
550
|
+
*
|
|
551
|
+
* - If `in` is `"path"`, the `name` field MUST correspond to a template expression occurring
|
|
552
|
+
* within the path field in the Paths Object. See Path Templating for further information.
|
|
553
|
+
* - If `in` is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or
|
|
554
|
+
* `"Authorization"`, the parameter definition SHALL be ignored.
|
|
555
|
+
* - For all other cases, the `name` corresponds to the parameter name used by the `in` property.
|
|
556
|
+
*/
|
|
307
557
|
name: string;
|
|
558
|
+
/**
|
|
559
|
+
* REQUIRED. The location of the parameter. Possible values are "query", "header", "path",
|
|
560
|
+
* "cookie", or "querystring" (OpenAPI 3.2: the whole query string, described by `content`).
|
|
561
|
+
*/
|
|
308
562
|
in: "query" | "header" | "path" | "cookie" | "querystring";
|
|
563
|
+
/**
|
|
564
|
+
* A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY
|
|
565
|
+
* be used for rich text representation.
|
|
566
|
+
*/
|
|
309
567
|
description?: string;
|
|
568
|
+
/**
|
|
569
|
+
* Determines whether this parameter is mandatory. If the parameter location is "path", this
|
|
570
|
+
* property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and
|
|
571
|
+
* its default value is false.
|
|
572
|
+
*/
|
|
310
573
|
required?: boolean;
|
|
574
|
+
/**
|
|
575
|
+
* Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value
|
|
576
|
+
* is false.
|
|
577
|
+
*/
|
|
311
578
|
deprecated?: boolean;
|
|
579
|
+
/**
|
|
580
|
+
* Sets the ability to pass empty-valued parameters. This is valid only for query parameters and
|
|
581
|
+
* allows sending a parameter with an empty value. Default value is false. If style is used, and
|
|
582
|
+
* if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored. Use
|
|
583
|
+
* of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.
|
|
584
|
+
*/
|
|
312
585
|
allowEmptyValue?: boolean;
|
|
586
|
+
/**
|
|
587
|
+
* Describes how the parameter value will be serialized depending on the type of the parameter
|
|
588
|
+
* value. Default values (based on value of in): for query - form; for path - simple; for header -
|
|
589
|
+
* simple; for cookie - form.
|
|
590
|
+
*/
|
|
313
591
|
style?: string;
|
|
592
|
+
/**
|
|
593
|
+
* When this is true, parameter values of type `array` or `object` generate separate parameters
|
|
594
|
+
* for each value of the array or key-value pair of the map. For other types of parameters this
|
|
595
|
+
* property has no effect. When `style` is `form`, the default value is `true`. For all other
|
|
596
|
+
* styles, the default value is `false`.
|
|
597
|
+
*/
|
|
314
598
|
explode?: boolean;
|
|
599
|
+
/**
|
|
600
|
+
* Determines whether the parameter value SHOULD allow reserved characters, as defined by
|
|
601
|
+
* [RFC3986] `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only
|
|
602
|
+
* applies to parameters with an `in` value of `query`. The default value is `false`.
|
|
603
|
+
*/
|
|
315
604
|
allowReserved?: boolean;
|
|
605
|
+
/** The schema defining the type used for the parameter. */
|
|
316
606
|
schema?: SchemaObject;
|
|
607
|
+
/** Example of the parameter’s potential value. */
|
|
317
608
|
example?: any;
|
|
609
|
+
/** Examples of the parameter’s potential value. */
|
|
318
610
|
examples?: {
|
|
319
611
|
[name: string]: ExampleObject | ReferenceObject;
|
|
320
612
|
};
|
|
613
|
+
/** A map containing the representations for the parameter. */
|
|
321
614
|
content?: {
|
|
322
615
|
[contentType: string]: MediaTypeObject | ReferenceObject;
|
|
323
616
|
};
|
|
324
617
|
}
|
|
618
|
+
/**
|
|
619
|
+
* [4.8.13] Request Body Object
|
|
620
|
+
* Describes a single request body.
|
|
621
|
+
*/
|
|
325
622
|
interface RequestBodyObject extends Extensable {
|
|
623
|
+
/**
|
|
624
|
+
* A brief description of the request body. This could contain examples of use. CommonMark syntax
|
|
625
|
+
* MAY be used for rich text representation.
|
|
626
|
+
*/
|
|
326
627
|
description?: string;
|
|
628
|
+
/**
|
|
629
|
+
* REQUIRED. The content of the request body. The key is a media type or media type range and the
|
|
630
|
+
* value describes it. For requests that match multiple keys, only the most specific key is
|
|
631
|
+
* applicable. e.g. text/plain overrides text
|
|
632
|
+
*/
|
|
327
633
|
content: {
|
|
328
634
|
[contentType: string]: MediaTypeObject | ReferenceObject;
|
|
329
635
|
};
|
|
636
|
+
/** Determines if the request body is required in the request. Defaults to false. */
|
|
330
637
|
required?: boolean;
|
|
331
638
|
}
|
|
639
|
+
/**
|
|
640
|
+
* [4.8.14] Media Type Object
|
|
641
|
+
*/
|
|
332
642
|
interface MediaTypeObject extends Extensable {
|
|
643
|
+
/** The schema defining the content of the request, response, or parameter. */
|
|
333
644
|
schema?: SchemaObject | ReferenceObject;
|
|
645
|
+
/**
|
|
646
|
+
* The schema of each item of a sequential media type such as `application/jsonl` or
|
|
647
|
+
* `text/event-stream` (OpenAPI 3.2).
|
|
648
|
+
*/
|
|
334
649
|
itemSchema?: SchemaObject | ReferenceObject;
|
|
650
|
+
/**
|
|
651
|
+
* Example of the media type. The example object SHOULD be in the correct format as specified by
|
|
652
|
+
* the media type. The example field is mutually exclusive of the examples field. Furthermore, if
|
|
653
|
+
* referencing a schema which contains an example, the example value SHALL override the example
|
|
654
|
+
* provided by the schema.
|
|
655
|
+
*/
|
|
335
656
|
example?: any;
|
|
657
|
+
/**
|
|
658
|
+
* Examples of the media type. Each example object SHOULD match the media type and specified
|
|
659
|
+
* schema if present. The examples field is mutually exclusive of the example field. Furthermore,
|
|
660
|
+
* if referencing a schema which contains an example, the examples value SHALL override the
|
|
661
|
+
* example provided by the schema.
|
|
662
|
+
*/
|
|
336
663
|
examples?: {
|
|
337
664
|
[name: string]: ExampleObject | ReferenceObject;
|
|
338
665
|
};
|
|
666
|
+
/**
|
|
667
|
+
* A map between a property name and its encoding information. The key, being the property name,
|
|
668
|
+
* MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody
|
|
669
|
+
* objects when the media type is multipart or application/x-www-form-urlencoded.
|
|
670
|
+
*/
|
|
339
671
|
encoding?: {
|
|
340
672
|
[propertyName: string]: EncodingObject;
|
|
341
673
|
};
|
|
342
674
|
}
|
|
675
|
+
/**
|
|
676
|
+
* [4.8.15] Encoding Object
|
|
677
|
+
* A single encoding definition applied to a single schema property.
|
|
678
|
+
*/
|
|
343
679
|
interface EncodingObject extends Extensable {
|
|
680
|
+
/**
|
|
681
|
+
* The Content-Type for encoding a specific property. Default value depends on the property type:
|
|
682
|
+
* for object - application/json; for array – the default is defined based on the inner type; for
|
|
683
|
+
* all other cases the default is application/octet-stream. The value can be a specific media type
|
|
684
|
+
* (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the
|
|
685
|
+
* two types.
|
|
686
|
+
*/
|
|
344
687
|
contentType?: string;
|
|
688
|
+
/**
|
|
689
|
+
* A map allowing additional information to be provided as headers, for example
|
|
690
|
+
* Content-Disposition. Content-Type is described separately and SHALL be ignored in this section.
|
|
691
|
+
* This property SHALL be ignored if the request body media type is not a multipart.
|
|
692
|
+
*/
|
|
345
693
|
headers?: {
|
|
346
694
|
[name: string]: HeaderObject | ReferenceObject;
|
|
347
695
|
};
|
|
696
|
+
/**
|
|
697
|
+
* Describes how a specific property value will be serialized depending on its type. See Parameter
|
|
698
|
+
* Object for details on the style property. The behavior follows the same values as query
|
|
699
|
+
* parameters, including default values. This property SHALL be ignored if the request body media
|
|
700
|
+
* type is not application/x-www-form-urlencoded or multipart/form-data. If a value is explicitly
|
|
701
|
+
* defined, then the value of contentType (implicit or explicit) SHALL be ignored.
|
|
702
|
+
*/
|
|
348
703
|
style?: string;
|
|
704
|
+
/**
|
|
705
|
+
* When this is true, property values of type array or object generate separate parameters for
|
|
706
|
+
* each value of the array, or key-value-pair of the map. For other types of properties this
|
|
707
|
+
* property has no effect. When style is form, the default value is true. For all other styles,
|
|
708
|
+
* the default value is false. This property SHALL be ignored if the request body media type is
|
|
709
|
+
* not application/x-www-form-urlencoded or multipart/form-data. If a value is explicitly defined,
|
|
710
|
+
* then the value of contentType (implicit or explicit) SHALL be ignored.
|
|
711
|
+
*/
|
|
349
712
|
explode?: string;
|
|
713
|
+
/**
|
|
714
|
+
* Determines whether the parameter value SHOULD allow reserved characters, as defined by
|
|
715
|
+
* [RFC3986] :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is
|
|
716
|
+
* false. This property SHALL be ignored if the request body media type is not
|
|
717
|
+
* application/x-www-form-urlencoded or multipart/form-data. If a value is explicitly defined,
|
|
718
|
+
* then the value of contentType (implicit or explicit) SHALL be ignored.
|
|
719
|
+
*/
|
|
350
720
|
allowReserved?: string;
|
|
351
721
|
}
|
|
722
|
+
/**
|
|
723
|
+
* [4.8.19[ Example Object
|
|
724
|
+
*/
|
|
352
725
|
interface ExampleObject extends Extensable {
|
|
726
|
+
/** Short description for the example. */
|
|
353
727
|
summary?: string;
|
|
728
|
+
/**
|
|
729
|
+
* Long description for the example. CommonMark syntax MAY be used for rich text representation.
|
|
730
|
+
*/
|
|
354
731
|
description?: string;
|
|
732
|
+
/**
|
|
733
|
+
* Embedded literal example. The value field and externalValue field are mutually exclusive. To
|
|
734
|
+
* represent examples of media types that cannot naturally represented in JSON or YAML, use a
|
|
735
|
+
* string value to contain the example, escaping where necessary.
|
|
736
|
+
*/
|
|
355
737
|
value?: any;
|
|
738
|
+
/**
|
|
739
|
+
* A URI that points to the literal example. This provides the capability to reference examples
|
|
740
|
+
* that cannot easily be included in JSON or YAML documents. The value field and externalValue
|
|
741
|
+
* field are mutually exclusive. See the rules for resolving Relative References.
|
|
742
|
+
*/
|
|
356
743
|
externalValue?: string;
|
|
357
744
|
}
|
|
745
|
+
/**
|
|
746
|
+
* [4.8.21] Header Object
|
|
747
|
+
* The Header Object follows the structure of the Parameter Object with the following changes:
|
|
748
|
+
*
|
|
749
|
+
* 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map.
|
|
750
|
+
* 2. `in` MUST NOT be specified, it is implicitly in `header`.
|
|
751
|
+
* 3. All traits that are affected by the location MUST be applicable to a location of `heade`r (for
|
|
752
|
+
* example, `style`).
|
|
753
|
+
*/
|
|
358
754
|
type HeaderObject = Omit<ParameterObject, "name" | "in">;
|
|
359
755
|
|
|
756
|
+
/**
|
|
757
|
+
* [4.8.16] Responses Object
|
|
758
|
+
* A container for the expected responses of an operation. The container maps a HTTP response code
|
|
759
|
+
* to the expected response.
|
|
760
|
+
*/
|
|
360
761
|
type ResponsesObject = {
|
|
361
762
|
[responseCode: string]: ResponseObject | ReferenceObject;
|
|
362
763
|
} & {
|
|
764
|
+
/**
|
|
765
|
+
* The documentation of responses other than the ones declared for specific HTTP response codes.
|
|
766
|
+
* Use this field to cover undeclared responses.
|
|
767
|
+
*/
|
|
363
768
|
default?: ResponseObject | ReferenceObject;
|
|
364
769
|
};
|
|
770
|
+
/**
|
|
771
|
+
* [4.8.17] Response Object
|
|
772
|
+
* Describes a single response from an API Operation, including design-time, static links to
|
|
773
|
+
* operations based on the response.
|
|
774
|
+
*/
|
|
365
775
|
interface ResponseObject extends Extensable {
|
|
776
|
+
/**
|
|
777
|
+
* REQUIRED. A description of the response. CommonMark syntax MAY be used for rich text
|
|
778
|
+
* representation.
|
|
779
|
+
*/
|
|
366
780
|
description: string;
|
|
781
|
+
/**
|
|
782
|
+
* Maps a header name to its definition. [RFC7230] states header names are case insensitive. If a
|
|
783
|
+
* response header is defined with the name "Content-Type", it SHALL be ignored.
|
|
784
|
+
*/
|
|
367
785
|
headers?: {
|
|
368
786
|
[name: string]: HeaderObject | ReferenceObject;
|
|
369
787
|
};
|
|
788
|
+
/**
|
|
789
|
+
* A map containing descriptions of potential response payloads. The key is a media type or media
|
|
790
|
+
* type range and the value describes it. For responses that match multiple keys, only the most
|
|
791
|
+
* specific key is applicable. e.g. text/plain overrides text
|
|
792
|
+
*/
|
|
370
793
|
content?: {
|
|
371
794
|
[contentType: string]: MediaTypeObject;
|
|
372
795
|
};
|
|
796
|
+
/**
|
|
797
|
+
* A map of operations links that can be followed from the response. The key of the map is a short
|
|
798
|
+
* name for the link, following the naming constraints of the names for Component Objects.
|
|
799
|
+
*/
|
|
373
800
|
links?: {
|
|
374
801
|
[name: string]: LinkObject | ReferenceObject;
|
|
375
802
|
};
|
|
376
803
|
}
|
|
804
|
+
/**
|
|
805
|
+
* [4.8.20] Link Object
|
|
806
|
+
* The Link object represents a possible design-time link for a response. The presence of a link
|
|
807
|
+
* does not guarantee the caller’s ability to successfully invoke it, rather it provides a known
|
|
808
|
+
* relationship and traversal mechanism between responses and other operations.
|
|
809
|
+
*/
|
|
377
810
|
interface LinkObject extends Extensable {
|
|
811
|
+
/**
|
|
812
|
+
* A relative or absolute URI reference to an OAS operation. This field is mutually exclusive of
|
|
813
|
+
* the operationId field, and MUST point to an Operation Object. Relative operationRef values MAY
|
|
814
|
+
* be used to locate an existing Operation Object in the OpenAPI definition. See the rules for
|
|
815
|
+
* resolving Relative References.
|
|
816
|
+
*/
|
|
378
817
|
operationRef?: string;
|
|
818
|
+
/**
|
|
819
|
+
* The name of an existing, resolvable OAS operation, as defined with a unique operationId. This
|
|
820
|
+
* field is mutually exclusive of the operationRef field.
|
|
821
|
+
*/
|
|
379
822
|
operationId?: string;
|
|
823
|
+
/**
|
|
824
|
+
* A map representing parameters to pass to an operation as specified with operationId or
|
|
825
|
+
* identified via operationRef. The key is the parameter name to be used, whereas the value can be
|
|
826
|
+
* a constant or an expression to be evaluated and passed to the linked operation. The parameter
|
|
827
|
+
* name can be qualified using the parameter location [{in}.]{name} for operations that use the
|
|
828
|
+
* same parameter name in different locations (e.g. path.id).
|
|
829
|
+
*/
|
|
380
830
|
parameters?: {
|
|
381
831
|
[name: string]: `$${string}`;
|
|
382
832
|
};
|
|
833
|
+
/** A literal value or {expression} to use as a request body when calling the target operation. */
|
|
383
834
|
requestBody?: `$${string}`;
|
|
835
|
+
/** A description of the link. CommonMark syntax MAY be used for rich text representation. */
|
|
384
836
|
description?: string;
|
|
837
|
+
/** A server object to be used by the target operation. */
|
|
385
838
|
server?: ServerObject;
|
|
386
839
|
}
|
|
387
840
|
|
|
841
|
+
/**
|
|
842
|
+
* [4.8.27] Security Scheme Object
|
|
843
|
+
* Defines a security scheme that can be used by the operations.
|
|
844
|
+
*/
|
|
388
845
|
type SecuritySchemeObject = {
|
|
846
|
+
/**
|
|
847
|
+
* A description for security scheme. CommonMark syntax MAY be used for rich text representation.
|
|
848
|
+
*/
|
|
389
849
|
description?: string;
|
|
390
850
|
[key: `x-${string}`]: any;
|
|
391
851
|
} & ({
|
|
852
|
+
/** REQUIRED. The type of the security scheme. */
|
|
392
853
|
type: "apiKey";
|
|
854
|
+
/** REQUIRED. The name of the header, query or cookie parameter to be used. */
|
|
393
855
|
name: string;
|
|
856
|
+
/** REQUIRED. The location of the API key. */
|
|
394
857
|
in: "query" | "header" | "cookie";
|
|
395
858
|
} | {
|
|
859
|
+
/** REQUIRED. The type of the security scheme. */
|
|
396
860
|
type: "http";
|
|
861
|
+
/**
|
|
862
|
+
* REQUIRED. The name of the HTTP Authorization scheme to be used in the Authorization header
|
|
863
|
+
* as defined in [RFC7235]. The values used SHOULD be registered in the IANA Authentication
|
|
864
|
+
* Scheme registry.
|
|
865
|
+
*/
|
|
397
866
|
scheme: string;
|
|
867
|
+
/**
|
|
868
|
+
* A hint to the client to identify how the bearer token is formatted. Bearer tokens are
|
|
869
|
+
* usually generated by an authorization server, so this information is primarily for
|
|
870
|
+
* documentation purposes.
|
|
871
|
+
*/
|
|
398
872
|
bearer?: string;
|
|
399
873
|
} | {
|
|
874
|
+
/** REQUIRED. The type of the security scheme. */
|
|
400
875
|
type: "mutualTLS";
|
|
401
876
|
} | {
|
|
877
|
+
/** REQUIRED. Tye type of the security scheme. */
|
|
402
878
|
type: "oauth2";
|
|
879
|
+
/** REQUIRED. An object containing configuration information for the flow types supported. */
|
|
403
880
|
flows: OAuthFlowsObject;
|
|
404
881
|
} | {
|
|
882
|
+
/** REQUIRED. Tye type of the security scheme. */
|
|
405
883
|
type: "openIdConnect";
|
|
884
|
+
/**
|
|
885
|
+
* REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the
|
|
886
|
+
* form of a URL. The OpenID Connect standard requires the use of TLS.
|
|
887
|
+
*/
|
|
406
888
|
openIdConnectUrl: string;
|
|
407
889
|
});
|
|
890
|
+
/**
|
|
891
|
+
* [4.8.26] OAuth Flows Object
|
|
892
|
+
* Allows configuration of the supported OAuth Flows.
|
|
893
|
+
*/
|
|
408
894
|
interface OAuthFlowsObject extends Extensable {
|
|
895
|
+
/** Configuration for the OAuth Implicit flow */
|
|
409
896
|
implicit?: OAuthFlowObject;
|
|
897
|
+
/** Configuration for the OAuth Resource Owner Password flow */
|
|
410
898
|
password?: OAuthFlowObject;
|
|
899
|
+
/**
|
|
900
|
+
* Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI
|
|
901
|
+
* 2.0.
|
|
902
|
+
*/
|
|
411
903
|
clientCredentials?: OAuthFlowObject;
|
|
904
|
+
/**
|
|
905
|
+
* Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI
|
|
906
|
+
* 2.0.
|
|
907
|
+
*/
|
|
412
908
|
authorizationCode?: OAuthFlowObject;
|
|
413
909
|
}
|
|
910
|
+
/**
|
|
911
|
+
* [4.8.29] OAuth Flow Object
|
|
912
|
+
* Configuration details for a supported OAuth Flow
|
|
913
|
+
*/
|
|
414
914
|
interface OAuthFlowObject extends Extensable {
|
|
915
|
+
/**
|
|
916
|
+
* REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL.
|
|
917
|
+
* The OAuth2 standard requires the use of TLS.
|
|
918
|
+
*/
|
|
415
919
|
authorizationUrl: string;
|
|
920
|
+
/**
|
|
921
|
+
* REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2
|
|
922
|
+
* standard requires the use of TLS.
|
|
923
|
+
*/
|
|
416
924
|
tokenUrl: string;
|
|
925
|
+
/**
|
|
926
|
+
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2
|
|
927
|
+
* standard requires the use of TLS.
|
|
928
|
+
*/
|
|
417
929
|
refreshUrl: string;
|
|
930
|
+
/**
|
|
931
|
+
* REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and
|
|
932
|
+
* a short description for it. The map MAY be empty.
|
|
933
|
+
*/
|
|
418
934
|
scopes: {
|
|
419
935
|
[name: string]: string;
|
|
420
936
|
};
|
|
421
937
|
}
|
|
938
|
+
/**
|
|
939
|
+
* [4.8.30] Security Requirements Object
|
|
940
|
+
* Lists the required security schemes to execute this operation. The name used for each property
|
|
941
|
+
* MUST correspond to a security scheme declared in the Security Schemes under the Components
|
|
942
|
+
* Object.
|
|
943
|
+
*/
|
|
422
944
|
type SecurityRequirementObject = {
|
|
423
945
|
[P in keyof ComponentsObject["securitySchemes"]]?: string[];
|
|
424
946
|
};
|
|
425
947
|
|
|
948
|
+
/**
|
|
949
|
+
* [4.8.9] Path Item Object
|
|
950
|
+
* Describes the operations available on a single path. A Path Item MAY be empty, due to ACL
|
|
951
|
+
* constraints. The path itself is still exposed to the documentation viewer but they will not know
|
|
952
|
+
* which operations and parameters are available.
|
|
953
|
+
*/
|
|
426
954
|
interface PathItemObject extends Extensable {
|
|
955
|
+
/** A definition of a GET operation on this path. */
|
|
427
956
|
get?: OperationObject | ReferenceObject;
|
|
957
|
+
/** A definition of a PUT operation on this path. */
|
|
428
958
|
put?: OperationObject | ReferenceObject;
|
|
959
|
+
/** A definition of a POST operation on this path. */
|
|
429
960
|
post?: OperationObject | ReferenceObject;
|
|
961
|
+
/** A definition of a DELETE operation on this path. */
|
|
430
962
|
delete?: OperationObject | ReferenceObject;
|
|
963
|
+
/** A definition of a OPTIONS operation on this path. */
|
|
431
964
|
options?: OperationObject | ReferenceObject;
|
|
965
|
+
/** A definition of a HEAD operation on this path. */
|
|
432
966
|
head?: OperationObject | ReferenceObject;
|
|
967
|
+
/** A definition of a PATCH operation on this path. */
|
|
433
968
|
patch?: OperationObject | ReferenceObject;
|
|
969
|
+
/** A definition of a TRACE operation on this path. */
|
|
434
970
|
trace?: OperationObject | ReferenceObject;
|
|
971
|
+
/** A definition of a QUERY operation on this path (OpenAPI 3.2). */
|
|
435
972
|
query?: OperationObject | ReferenceObject;
|
|
973
|
+
/**
|
|
974
|
+
* Operations for other HTTP methods, keyed by the method name exactly as it is sent
|
|
975
|
+
* (OpenAPI 3.2). The fixed methods above must not appear here.
|
|
976
|
+
*/
|
|
436
977
|
additionalOperations?: Record<string, OperationObject | ReferenceObject>;
|
|
978
|
+
/** An alternative server array to service all operations in this path. */
|
|
437
979
|
servers?: ServerObject[];
|
|
980
|
+
/**
|
|
981
|
+
* A list of parameters that are applicable for all the operations described under this path.
|
|
982
|
+
* These parameters can be overridden at the operation level, but cannot be removed there. The
|
|
983
|
+
* list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of
|
|
984
|
+
* a name and location. The list can use the Reference Object to link to parameters that are
|
|
985
|
+
* defined at the OpenAPI Object’s components/parameters.
|
|
986
|
+
*/
|
|
438
987
|
parameters?: (ParameterObject | ReferenceObject)[];
|
|
439
988
|
}
|
|
989
|
+
/**
|
|
990
|
+
* [4.8.10] Operation Object
|
|
991
|
+
* Describes a single API operation on a path.
|
|
992
|
+
*/
|
|
440
993
|
interface OperationObject extends Extensable {
|
|
994
|
+
/**
|
|
995
|
+
* A list of tags for API documentation control. Tags can be used for logical grouping of
|
|
996
|
+
* operations by resources or any other qualifier.
|
|
997
|
+
*/
|
|
441
998
|
tags?: string[];
|
|
999
|
+
/** A short summary of what the operation does. */
|
|
442
1000
|
summary?: string;
|
|
1001
|
+
/**
|
|
1002
|
+
* A verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text
|
|
1003
|
+
* representation.
|
|
1004
|
+
*/
|
|
443
1005
|
description?: string;
|
|
1006
|
+
/** Additional external documentation for this operation. */
|
|
444
1007
|
externalDocs?: ExternalDocumentationObject;
|
|
1008
|
+
/**
|
|
1009
|
+
* Unique string used to identify the operation. The id MUST be unique among all operations
|
|
1010
|
+
* described in the API. The operationId value is case-sensitive. Tools and libraries MAY use the
|
|
1011
|
+
* operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common
|
|
1012
|
+
* programming naming conventions.
|
|
1013
|
+
*/
|
|
445
1014
|
operationId?: string;
|
|
1015
|
+
/**
|
|
1016
|
+
* A list of parameters that are applicable for this operation. If a parameter is already defined
|
|
1017
|
+
* at the Path Item, the new definition will override it but can never remove it. The list MUST
|
|
1018
|
+
* NOT include duplicated parameters. A unique parameter is defined by a combination of a name and
|
|
1019
|
+
* location. The list can use the Reference Object to link to parameters that are defined at the
|
|
1020
|
+
* OpenAPI Object’s components/parameters.
|
|
1021
|
+
*/
|
|
446
1022
|
parameters?: (ParameterObject | ReferenceObject)[];
|
|
1023
|
+
/**
|
|
1024
|
+
* The request body applicable for this operation. The requestBody is fully supported in HTTP
|
|
1025
|
+
* methods where the HTTP 1.1 specification [RFC7231] has explicitly defined semantics for request
|
|
1026
|
+
* bodies. In other cases where the HTTP spec is vague (such as GET, HEAD and DELETE), requestBody
|
|
1027
|
+
* is permitted but does not have well-defined semantics and SHOULD be avoided if possible.
|
|
1028
|
+
*/
|
|
447
1029
|
requestBody?: RequestBodyObject | ReferenceObject;
|
|
1030
|
+
/** The list of possible responses as they are returned from executing this operation. */
|
|
448
1031
|
responses?: ResponsesObject;
|
|
1032
|
+
/**
|
|
1033
|
+
* A map of possible out-of band callbacks related to the parent operation. The key is a unique
|
|
1034
|
+
* identifier for the Callback Object. Each value in the map is a Callback Object that describes a
|
|
1035
|
+
* request that may be initiated by the API provider and the expected responses.
|
|
1036
|
+
*/
|
|
449
1037
|
callbacks?: Record<string, CallbackObject | ReferenceObject>;
|
|
1038
|
+
/**
|
|
1039
|
+
* Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared
|
|
1040
|
+
* operation. Default value is false.
|
|
1041
|
+
*/
|
|
450
1042
|
deprecated?: boolean;
|
|
1043
|
+
/**
|
|
1044
|
+
* A declaration of which security mechanisms can be used for this operation. The list of values
|
|
1045
|
+
* includes alternative security requirement objects that can be used. Only one of the security
|
|
1046
|
+
* requirement objects need to be satisfied to authorize a request. To make security optional, an
|
|
1047
|
+
* empty security requirement ({}) can be included in the array. This definition overrides any
|
|
1048
|
+
* declared top-level security. To remove a top-level security declaration, an empty array can be
|
|
1049
|
+
* used.
|
|
1050
|
+
*/
|
|
451
1051
|
security?: SecurityRequirementObject[];
|
|
1052
|
+
/**
|
|
1053
|
+
* An alternative server array to service this operation. If an alternative server object is
|
|
1054
|
+
* specified at the Path Item Object or Root level, it will be overridden by this value.
|
|
1055
|
+
*/
|
|
452
1056
|
servers?: ServerObject[];
|
|
453
1057
|
}
|
|
1058
|
+
/**
|
|
1059
|
+
* [4.8.18] Callback Object
|
|
1060
|
+
* A map of possible out-of band callbacks related to the parent operation. Each value in the map is
|
|
1061
|
+
* a Path Item Object that describes a set of requests that may be initiated by the API provider and
|
|
1062
|
+
* the expected responses. The key value used to identify the path item object is an expression,
|
|
1063
|
+
* evaluated at runtime, that identifies a URL to use for the callback operation.
|
|
1064
|
+
*/
|
|
454
1065
|
type CallbackObject = Record<string, PathItemObject>;
|
|
455
1066
|
|
|
1067
|
+
/**
|
|
1068
|
+
* [4.8] Schema
|
|
1069
|
+
* @see https://spec.openapis.org/oas/v3.1.0#schema
|
|
1070
|
+
*/
|
|
456
1071
|
interface OpenAPI3 extends Extensable {
|
|
1072
|
+
/**
|
|
1073
|
+
* REQUIRED. This string MUST be the version number of the OpenAPI Specification that the OpenAPI
|
|
1074
|
+
* document uses. The openapi field SHOULD be used by tooling to interpret the OpenAPI document.
|
|
1075
|
+
* This is not related to the API info.version string.
|
|
1076
|
+
*/
|
|
457
1077
|
openapi: string;
|
|
1078
|
+
/** REQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required. */
|
|
458
1079
|
info: InfoObject;
|
|
1080
|
+
/**
|
|
1081
|
+
* The default value for the $schema keyword within Schema Objects contained within this OAS
|
|
1082
|
+
* document. This MUST be in the form of a URI.
|
|
1083
|
+
*/
|
|
459
1084
|
jsonSchemaDialect?: string;
|
|
1085
|
+
/**
|
|
1086
|
+
* An array of Server Objects, which provide connectivity information to a target server. If the
|
|
1087
|
+
* servers property is not provided, or is an empty array, the default value would be a Server
|
|
1088
|
+
* Object with a url value of /.
|
|
1089
|
+
*/
|
|
460
1090
|
servers?: ServerObject[];
|
|
1091
|
+
/** The available paths and operations for the API. */
|
|
461
1092
|
paths?: PathsObject;
|
|
1093
|
+
/**
|
|
1094
|
+
* The incoming webhooks that MAY be received as part of this API and that the API consumer MAY
|
|
1095
|
+
* choose to implement. Closely related to the callbacks feature, this section describes requests
|
|
1096
|
+
* initiated other than by an API call, for example by an out of band registration. The key name
|
|
1097
|
+
* is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object
|
|
1098
|
+
* describes a request that may be initiated by the API provider and the expected responses. An
|
|
1099
|
+
* example is available.
|
|
1100
|
+
*/
|
|
462
1101
|
webhooks?: {
|
|
463
1102
|
[id: string]: PathItemObject | ReferenceObject;
|
|
464
1103
|
};
|
|
1104
|
+
/** An element to hold various schemas for the document. */
|
|
465
1105
|
components?: ComponentsObject;
|
|
1106
|
+
/**
|
|
1107
|
+
* A declaration of which security mechanisms can be used across the API. The list of values
|
|
1108
|
+
* includes alternative security requirement objects that can be used. Only one of the security
|
|
1109
|
+
* requirement objects need to be satisfied to authorize a request. Individual operations can
|
|
1110
|
+
* override this definition. To make security optional, an empty security requirement ({}) can be
|
|
1111
|
+
* included in the array.
|
|
1112
|
+
*/
|
|
466
1113
|
security?: SecurityRequirementObject[];
|
|
1114
|
+
/**
|
|
1115
|
+
* A list of tags used by the document with additional metadata. The order of the tags can be used
|
|
1116
|
+
* to reflect on their order by the parsing tools. Not all tags that are used by the Operation
|
|
1117
|
+
* Object must be declared. The tags that are not declared MAY be organized randomly or based on
|
|
1118
|
+
* the tools’ logic. Each tag name in the list MUST be unique.
|
|
1119
|
+
*/
|
|
467
1120
|
tags?: TagObject[];
|
|
1121
|
+
/** Additional external documentation. */
|
|
468
1122
|
externalDocs?: ExternalDocumentationObject;
|
|
469
1123
|
$defs?: $defs;
|
|
470
1124
|
}
|
|
1125
|
+
/**
|
|
1126
|
+
* [4.8.2] Info Object
|
|
1127
|
+
* The object provides metadata about the API.
|
|
1128
|
+
*/
|
|
471
1129
|
interface InfoObject extends Extensable {
|
|
1130
|
+
/** REQUIRED. The title of the API. */
|
|
472
1131
|
title: string;
|
|
1132
|
+
/** A short summary of the API. */
|
|
473
1133
|
summary?: string;
|
|
1134
|
+
/** A description of the API. CommonMark syntax MAY be used for rich text representation. */
|
|
474
1135
|
description?: string;
|
|
1136
|
+
/** A URL to the Terms of Service for the API. This MUST be in the form of a URL. */
|
|
475
1137
|
termsOfService?: string;
|
|
1138
|
+
/** The contact information for the exposed API. */
|
|
476
1139
|
contact?: ContactObject;
|
|
1140
|
+
/** The license information for the exposed API. */
|
|
477
1141
|
license?: LicenseObject;
|
|
1142
|
+
/**
|
|
1143
|
+
* REQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification
|
|
1144
|
+
* version or the API implementation version).
|
|
1145
|
+
*/
|
|
478
1146
|
version: string;
|
|
479
1147
|
}
|
|
1148
|
+
/**
|
|
1149
|
+
* [4.8.3] Contact Object
|
|
1150
|
+
* Contact information for the exposed API.
|
|
1151
|
+
*/
|
|
480
1152
|
interface ContactObject extends Extensable {
|
|
1153
|
+
/** The identifying name of the contact person/organization. */
|
|
481
1154
|
name?: string;
|
|
1155
|
+
/** The URL pointing to the contact information. This MUST be in the form of a URL. */
|
|
482
1156
|
url?: string;
|
|
1157
|
+
/**
|
|
1158
|
+
* The email address of the contact person/organization. This MUST be in the form of an email
|
|
1159
|
+
* address.
|
|
1160
|
+
*/
|
|
483
1161
|
email?: string;
|
|
484
1162
|
}
|
|
1163
|
+
/**
|
|
1164
|
+
* [4.8.4] License object
|
|
1165
|
+
* License information for the exposed API.
|
|
1166
|
+
*/
|
|
485
1167
|
interface LicenseObject extends Extensable {
|
|
1168
|
+
/** REQUIRED. The license name used for the API. */
|
|
486
1169
|
name: string;
|
|
1170
|
+
/**
|
|
1171
|
+
* An SPDX license expression for the API. The identifier field is mutually exclusive of the url
|
|
1172
|
+
* field.
|
|
1173
|
+
*/
|
|
487
1174
|
identifier: string;
|
|
1175
|
+
/**
|
|
1176
|
+
* A URL to the license used for the API. This MUST be in the form of a URL. The url field is
|
|
1177
|
+
* mutually exclusive of the identifier field.
|
|
1178
|
+
*/
|
|
488
1179
|
url: string;
|
|
489
1180
|
}
|
|
1181
|
+
/**
|
|
1182
|
+
* [4.8.7] Components Object
|
|
1183
|
+
* Holds a set of reusable objects for different aspects of the OAS.
|
|
1184
|
+
*/
|
|
490
1185
|
interface ComponentsObject extends Extensable {
|
|
1186
|
+
/** An object to hold reusable Schema Objects.*/
|
|
491
1187
|
schemas?: Record<string, SchemaObject>;
|
|
1188
|
+
/** An object to hold reusable Response Objects. */
|
|
492
1189
|
responses?: Record<string, ResponseObject | ReferenceObject>;
|
|
1190
|
+
/** An object to hold reusable Parameter Objects. */
|
|
493
1191
|
parameters?: Record<string, ParameterObject | ReferenceObject>;
|
|
1192
|
+
/** An object to hold reusable Example Objects. */
|
|
494
1193
|
examples?: Record<string, ExampleObject | ReferenceObject>;
|
|
1194
|
+
/** An object to hold reusable Request Body Objects. */
|
|
495
1195
|
requestBodies?: Record<string, RequestBodyObject | ReferenceObject>;
|
|
1196
|
+
/** An object to hold reusable Header Objects. */
|
|
496
1197
|
headers?: Record<string, HeaderObject | ReferenceObject>;
|
|
1198
|
+
/** An object to hold reusable Security Scheme Objects. */
|
|
497
1199
|
securitySchemes?: Record<string, SecuritySchemeObject | ReferenceObject>;
|
|
1200
|
+
/** An object to hold reusable Link Objects. */
|
|
498
1201
|
links?: Record<string, LinkObject | ReferenceObject>;
|
|
1202
|
+
/** An object to hold reusable Callback Objects. */
|
|
499
1203
|
callbacks?: Record<string, CallbackObject | ReferenceObject>;
|
|
1204
|
+
/** An object to hold reusable Path Item Objects. */
|
|
500
1205
|
pathItems?: Record<string, PathItemObject | ReferenceObject>;
|
|
1206
|
+
/** An object to hold reusable Media Type Objects (OpenAPI 3.2). */
|
|
501
1207
|
mediaTypes?: Record<string, MediaTypeObject | ReferenceObject>;
|
|
502
1208
|
}
|
|
1209
|
+
/**
|
|
1210
|
+
* [4.8.8] Paths Object
|
|
1211
|
+
* Holds the relative paths to the individual endpoints and their operations. The path is appended
|
|
1212
|
+
* to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due
|
|
1213
|
+
* to Access Control List (ACL) constraints.
|
|
1214
|
+
*/
|
|
503
1215
|
interface PathsObject {
|
|
504
1216
|
[pathname: string]: PathItemObject | ReferenceObject;
|
|
505
1217
|
}
|
|
1218
|
+
/**
|
|
1219
|
+
* [x.x.x] Webhooks Object
|
|
1220
|
+
* Holds the webhooks definitions, indexed by their names. A webhook is defined by a Path Item
|
|
1221
|
+
* Object; the only difference is that the request is initiated by the API provider.
|
|
1222
|
+
*/
|
|
506
1223
|
interface WebhooksObject {
|
|
507
1224
|
[name: string]: PathItemObject;
|
|
508
1225
|
}
|
|
1226
|
+
/**
|
|
1227
|
+
* [4.8.22] Tag Object
|
|
1228
|
+
* Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a
|
|
1229
|
+
* Tag Object per tag defined in the Operation Object instances.
|
|
1230
|
+
*/
|
|
509
1231
|
interface TagObject extends Extensable {
|
|
1232
|
+
/** REQUIRED. The name of the tag. */
|
|
510
1233
|
name: string;
|
|
1234
|
+
/** A description for the tag. CommonMark syntax MAY be used for rich text representation. */
|
|
511
1235
|
description?: string;
|
|
1236
|
+
/** Additional external documentation for this tag. */
|
|
512
1237
|
externalDocs?: ExternalDocumentationObject;
|
|
513
1238
|
}
|
|
514
1239
|
|
|
515
1240
|
interface TransformObject {
|
|
1241
|
+
/** The type: an IR type (from the helpers), or a TypeScript node (read by the bridge). */
|
|
516
1242
|
schema: IrType | ts.TypeNode;
|
|
517
1243
|
questionToken: boolean;
|
|
518
1244
|
}
|
|
1245
|
+
/**
|
|
1246
|
+
* Every source type `openapiTS` accepts: YAML or JSON text, a URL, a parsed document, bytes or a
|
|
1247
|
+
* stream.
|
|
1248
|
+
*/
|
|
519
1249
|
type SchemaSource = string | URL | OpenAPI3 | Buffer | Readable;
|
|
1250
|
+
/** The generator options other than the schema callbacks. */
|
|
520
1251
|
interface OpenAPITSBaseOptions {
|
|
1252
|
+
/** Treat all objects as if they have `additionalProperties: true` by default (default: false) */
|
|
521
1253
|
additionalProperties?: boolean;
|
|
1254
|
+
/** Alphabetize all keys? (default: false) */
|
|
522
1255
|
alphabetize?: boolean;
|
|
1256
|
+
/** (optional) Generate tuples using array minItems / maxItems */
|
|
523
1257
|
arrayLength?: boolean;
|
|
1258
|
+
/**
|
|
1259
|
+
* Type raw binary strings as `Blob` instead of `string` (default: false): `format: binary`
|
|
1260
|
+
* (OpenAPI 3.0), or a `contentMediaType` that is not text and has no `contentEncoding` (3.1).
|
|
1261
|
+
* `Blob` is a global type of the DOM lib and `@types/node`.
|
|
1262
|
+
*/
|
|
524
1263
|
binaryAsBlob?: boolean;
|
|
1264
|
+
/**
|
|
1265
|
+
* Allow schema objects with no specified properties to have additional properties if not
|
|
1266
|
+
* expressly forbidden? (default: false)
|
|
1267
|
+
*/
|
|
525
1268
|
emptyObjectsUnknown?: boolean;
|
|
1269
|
+
/** Provide current working directory (cwd) which helps resolve relative remote schemas */
|
|
526
1270
|
cwd?: PathLike;
|
|
1271
|
+
/**
|
|
1272
|
+
* Load local `$ref` files only from this directory and below it; a relative path resolves
|
|
1273
|
+
* against `cwd`. Default: no limit. Threat model R1, ADR-017.
|
|
1274
|
+
*/
|
|
527
1275
|
localRefRoot?: string | URL;
|
|
1276
|
+
/**
|
|
1277
|
+
* Load remote `$ref` documents only from these hosts (`name` or `name:port`); `[]` loads none.
|
|
1278
|
+
* Redirects are checked too. Default: any host. Threat model R2, ADR-017.
|
|
1279
|
+
*/
|
|
528
1280
|
remoteRefHosts?: readonly string[];
|
|
1281
|
+
/** Should schema objects with a default value not be considered optional? */
|
|
529
1282
|
defaultNonNullable?: boolean;
|
|
1283
|
+
/** Exclude deprecated fields from types? (default: false) */
|
|
530
1284
|
excludeDeprecated?: boolean;
|
|
1285
|
+
/**
|
|
1286
|
+
* Opt-in fixes of the output of valid schemas (default: none), ADR-021. `"all"` turns on every
|
|
1287
|
+
* fix of the installed version, so a minor update can change the output; list the names to keep
|
|
1288
|
+
* it stable. An unknown name fails with `OPTION_FIX_UNKNOWN`.
|
|
1289
|
+
* @see https://github.com/openapi-typesafe/openapi-typesafe/blob/main/docs/cli.md#fix
|
|
1290
|
+
*/
|
|
531
1291
|
fix?: readonly OutputFixName[];
|
|
1292
|
+
/** Add readonly properties and readonly arrays? (default: false) */
|
|
532
1293
|
immutable?: boolean;
|
|
1294
|
+
/**
|
|
1295
|
+
* Lint the document with the Redocly config before generating (default: true). Bundling errors
|
|
1296
|
+
* still fail the run.
|
|
1297
|
+
*/
|
|
533
1298
|
lint?: boolean;
|
|
1299
|
+
/** (optional) Should logging be suppressed? (necessary for STDOUT) */
|
|
534
1300
|
silent?: boolean;
|
|
1301
|
+
/** Accepted for compatibility with openapi-typescript; not read. */
|
|
535
1302
|
version?: number;
|
|
1303
|
+
/** (optional) Export type instead of interface */
|
|
536
1304
|
exportType?: boolean;
|
|
1305
|
+
/** Export true TypeScript enums instead of unions */
|
|
537
1306
|
enum?: boolean;
|
|
1307
|
+
/** Export union values as arrays */
|
|
538
1308
|
enumValues?: boolean;
|
|
1309
|
+
/** Only generate TS Enums when `x-enum-*` metadata is available */
|
|
539
1310
|
conditionalEnums?: boolean;
|
|
1311
|
+
/** Dedupe enum values */
|
|
540
1312
|
dedupeEnums?: boolean;
|
|
1313
|
+
/** (optional) Substitute path parameter names with their respective types */
|
|
541
1314
|
pathParamsAsTypes?: boolean;
|
|
1315
|
+
/**
|
|
1316
|
+
* Treat all objects as if they have \`required\` set to all properties by default (default:
|
|
1317
|
+
* false)
|
|
1318
|
+
*/
|
|
542
1319
|
propertiesRequiredByDefault?: boolean;
|
|
1320
|
+
/** (optional) Generate schema types at root level */
|
|
543
1321
|
rootTypes?: boolean;
|
|
1322
|
+
/** (optional) Do not add Schema prefix to types at root level */
|
|
544
1323
|
rootTypesNoSchemaPrefix?: boolean;
|
|
1324
|
+
/** (optional) Keep casing of root types */
|
|
545
1325
|
rootTypesKeepCasing?: boolean;
|
|
1326
|
+
/**
|
|
1327
|
+
* Configure Redocly for validation, schema fetching, and bundling
|
|
1328
|
+
* @see https://redocly.com/docs/cli/configuration/
|
|
1329
|
+
*/
|
|
546
1330
|
redocly?: Config;
|
|
1331
|
+
/** Inject arbitrary TypeScript types into the start of the file */
|
|
547
1332
|
inject?: string;
|
|
1333
|
+
/** Generate ApiPaths enum */
|
|
548
1334
|
makePathsEnum?: boolean;
|
|
1335
|
+
/** Generate path params based on path even if they are not defined in the open api schema */
|
|
549
1336
|
generatePathParams?: boolean;
|
|
1337
|
+
/** Generate $Read/$Write markers for readOnly/writeOnly properties (default: false) */
|
|
550
1338
|
readWriteMarkers?: boolean;
|
|
551
1339
|
}
|
|
1340
|
+
/**
|
|
1341
|
+
* The schema callbacks of the original API: they receive TypeScript nodes (ADR-004, decisions 5
|
|
1342
|
+
* and 6). Results may be IR (from the helpers) or TypeScript nodes, read by the bridge.
|
|
1343
|
+
*/
|
|
552
1344
|
interface LegacyCallbackOptions {
|
|
1345
|
+
/** Unset or false: the callbacks below receive TypeScript nodes. */
|
|
553
1346
|
irCallbacks?: false;
|
|
1347
|
+
/** Manually transform certain Schema Objects with a custom TypeScript type */
|
|
554
1348
|
transform?: (schemaObject: SchemaObject, options: TransformNodeOptions) => IrType | ts.TypeNode | TransformObject | undefined;
|
|
1349
|
+
/**
|
|
1350
|
+
* Modify TypeScript types built from Schema Objects (receives a TypeScript node)
|
|
1351
|
+
* @deprecated Use `irCallbacks: true` (ADR-004, decision 6); the TypeScript form is removed in
|
|
1352
|
+
* 2.0.
|
|
1353
|
+
*/
|
|
555
1354
|
postTransform?: (type: ts.TypeNode, options: TransformNodeOptions) => IrType | ts.TypeNode | undefined;
|
|
1355
|
+
/**
|
|
1356
|
+
* Modify property signatures for Schema Object properties (receives a TypeScript node)
|
|
1357
|
+
* @deprecated Use `irCallbacks: true` (ADR-004, decision 6); the TypeScript form is removed in
|
|
1358
|
+
* 2.0.
|
|
1359
|
+
*/
|
|
556
1360
|
transformProperty?: (property: ts.PropertySignature, schemaObject: SchemaObject, options: TransformNodeOptions) => IrPropertySignature | ts.PropertySignature | undefined;
|
|
557
1361
|
}
|
|
1362
|
+
/**
|
|
1363
|
+
* The schema callbacks that have a deprecated TypeScript-node form (ADR-004, decisions 5 and 6).
|
|
1364
|
+
*/
|
|
558
1365
|
type LegacyCallbackName = "transform" | "postTransform" | "transformProperty";
|
|
1366
|
+
/** A type an IR callback returns: an IR type, or TypeScript type text printed as written. */
|
|
559
1367
|
type IrCallbackType = IrType | string;
|
|
1368
|
+
/** What an IR `transform` callback returns to make the property optional. */
|
|
560
1369
|
interface IrTransformObject {
|
|
561
1370
|
schema: IrCallbackType;
|
|
562
1371
|
questionToken: boolean;
|
|
563
1372
|
}
|
|
1373
|
+
/** Replace the generated type of a Schema Object; `undefined` keeps the generated type. */
|
|
564
1374
|
type IrTransform = (schemaObject: SchemaObject, options: TransformNodeOptions) => IrCallbackType | IrTransformObject | undefined;
|
|
1375
|
+
/** Modify the generated type of a Schema Object; `undefined` keeps it. */
|
|
565
1376
|
type IrPostTransform = (type: IrType, options: TransformNodeOptions) => IrCallbackType | undefined;
|
|
1377
|
+
/** Modify the generated property of a Schema Object property; `undefined` keeps it. */
|
|
566
1378
|
type IrTransformProperty = (property: IrPropertySignature, schemaObject: SchemaObject, options: TransformNodeOptions) => IrPropertySignature | undefined;
|
|
1379
|
+
/** The schema callbacks on IR (ENGINEERING_PLAN 6.3): they receive and return IR nodes. */
|
|
567
1380
|
interface IrCallbackOptions {
|
|
568
1381
|
irCallbacks: true;
|
|
569
1382
|
transform?: IrTransform;
|
|
570
1383
|
postTransform?: IrPostTransform;
|
|
571
1384
|
transformProperty?: IrTransformProperty;
|
|
572
1385
|
}
|
|
1386
|
+
/** The options of the original API: callbacks on TypeScript nodes. */
|
|
573
1387
|
interface OpenAPITSOptions extends OpenAPITSBaseOptions, LegacyCallbackOptions {
|
|
574
1388
|
}
|
|
1389
|
+
/** The options with `irCallbacks: true`: callbacks on IR nodes. */
|
|
575
1390
|
interface OpenAPITSIrOptions extends OpenAPITSBaseOptions, IrCallbackOptions {
|
|
576
1391
|
}
|
|
1392
|
+
/** Either form of the generator options. */
|
|
577
1393
|
type GeneratorOptions = OpenAPITSOptions | OpenAPITSIrOptions;
|
|
1394
|
+
/**
|
|
1395
|
+
* Context passed to all submodules, and to the callbacks as `options.ctx`. To call an exported
|
|
1396
|
+
* transformer outside a run, build one with the fields of openapi-typescript's context; the
|
|
1397
|
+
* fields openapi-typesafe added are optional.
|
|
1398
|
+
*/
|
|
578
1399
|
interface GlobalContext {
|
|
579
1400
|
additionalProperties: boolean;
|
|
580
1401
|
alphabetize: boolean;
|
|
581
1402
|
arrayLength: boolean;
|
|
582
|
-
|
|
1403
|
+
/** `format: binary` and `contentMediaType` strings become `Blob` (default: false). */
|
|
1404
|
+
binaryAsBlob?: boolean;
|
|
583
1405
|
defaultNonNullable: boolean;
|
|
584
1406
|
discriminators: {
|
|
585
1407
|
objects: Record<string, DiscriminatorObject>;
|
|
@@ -592,14 +1414,20 @@ interface GlobalContext {
|
|
|
592
1414
|
dedupeEnums: boolean;
|
|
593
1415
|
excludeDeprecated: boolean;
|
|
594
1416
|
exportType: boolean;
|
|
1417
|
+
/** The opt-in output fixes of this run, `all` expanded (ADR-021). Unset: none. */
|
|
595
1418
|
fix?: readonly OutputFix[];
|
|
596
1419
|
immutable: boolean;
|
|
1420
|
+
/**
|
|
1421
|
+
* Declarations written after the main types, in order. The generator adds IR declarations;
|
|
1422
|
+
* callbacks may add IR declarations or TypeScript nodes.
|
|
1423
|
+
*/
|
|
597
1424
|
injectFooter: FooterEntry[];
|
|
598
|
-
runFooter?: DocumentFooter;
|
|
599
|
-
legacyCallbackWarnings?: Set<LegacyCallbackName>;
|
|
600
|
-
logger?: Logger;
|
|
601
1425
|
pathParamsAsTypes: boolean;
|
|
602
|
-
|
|
1426
|
+
/**
|
|
1427
|
+
* Whether the callbacks below take IR (`OpenAPITSIrOptions`) or TypeScript nodes
|
|
1428
|
+
* (default: false, TypeScript nodes).
|
|
1429
|
+
*/
|
|
1430
|
+
irCallbacks?: boolean;
|
|
603
1431
|
postTransform: GeneratorOptions["postTransform"];
|
|
604
1432
|
propertiesRequiredByDefault: boolean;
|
|
605
1433
|
rootTypes: boolean;
|
|
@@ -609,20 +1437,53 @@ interface GlobalContext {
|
|
|
609
1437
|
silent: boolean;
|
|
610
1438
|
transform: GeneratorOptions["transform"];
|
|
611
1439
|
transformProperty: GeneratorOptions["transformProperty"];
|
|
1440
|
+
/** retrieve a node by $ref */
|
|
612
1441
|
resolve<T>($ref: string): T | undefined;
|
|
613
1442
|
inject?: string;
|
|
614
1443
|
makePathsEnum: boolean;
|
|
615
1444
|
generatePathParams: boolean;
|
|
616
1445
|
readWriteMarkers: boolean;
|
|
617
1446
|
}
|
|
1447
|
+
/** generic options for most internal transform* functions */
|
|
618
1448
|
interface TransformNodeOptions {
|
|
619
1449
|
path?: string;
|
|
620
1450
|
schema?: SchemaObject | ReferenceObject;
|
|
621
1451
|
ctx: GlobalContext;
|
|
622
1452
|
}
|
|
623
1453
|
|
|
1454
|
+
/** The debug groups of the original `DEBUG=openapi-ts:<group>` output. */
|
|
1455
|
+
type DebugGroup = "redoc" | "lint" | "bundle" | "ts";
|
|
1456
|
+
/**
|
|
1457
|
+
* Where the generator reports progress and problems (ENGINEERING_PLAN 4.5). Whether warnings are
|
|
1458
|
+
* printed (`silent`) and debug output (`DEBUG`) is decided by the adapter, when it is created.
|
|
1459
|
+
*/
|
|
1460
|
+
interface Logger {
|
|
1461
|
+
/**
|
|
1462
|
+
* A debug line, with how long the step took when it was measured. A line without a group is
|
|
1463
|
+
* written whenever debug output is on.
|
|
1464
|
+
*/
|
|
1465
|
+
debug(message: string, group?: DebugGroup, durationMs?: number): void;
|
|
1466
|
+
warn(message: string): void;
|
|
1467
|
+
error(message: string): void;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
/**
|
|
1471
|
+
* Convert an OpenAPI schema to TypeScript declarations (IR nodes; print them with `astToString`)
|
|
1472
|
+
* @param {string|URL|object|Readable} source OpenAPI schema source:
|
|
1473
|
+
* - YAML: string
|
|
1474
|
+
* - JSON: parsed object
|
|
1475
|
+
* - URL: URL to a YAML or JSON file (local or remote)
|
|
1476
|
+
* - Readable: Readable stream of YAML or JSON
|
|
1477
|
+
*/
|
|
624
1478
|
declare function openapiTS(source: SchemaSource, options?: GeneratorOptions): Promise<IrDeclaration[]>;
|
|
625
1479
|
|
|
1480
|
+
/**
|
|
1481
|
+
* Typed errors (ENGINEERING_PLAN 4.6, ADR-011). Every expected failure of the generator and the CLI
|
|
1482
|
+
* is an `OpenAPITypesafeError` with a stable machine-readable `code` and structured `details`. The
|
|
1483
|
+
* `message` is English text for people; programs and the CLI decide by `code`. A bug (a broken
|
|
1484
|
+
* invariant) is a plain `Error`, not one of these.
|
|
1485
|
+
*/
|
|
1486
|
+
/** Every error code. The set is closed: a new code must be handled by the CLI exit-code table. */
|
|
626
1487
|
declare const ERROR_CODES: {
|
|
627
1488
|
readonly SCHEMA_SOURCE_EMPTY: "SCHEMA_SOURCE_EMPTY";
|
|
628
1489
|
readonly SCHEMA_SOURCE_INVALID: "SCHEMA_SOURCE_INVALID";
|
|
@@ -643,46 +1504,93 @@ declare const ERROR_CODES: {
|
|
|
643
1504
|
readonly CLI_FLAG_REMOVED: "CLI_FLAG_REMOVED";
|
|
644
1505
|
readonly CLI_GLOB_UNSUPPORTED: "CLI_GLOB_UNSUPPORTED";
|
|
645
1506
|
readonly CLI_CONFIG_NOT_FOUND: "CLI_CONFIG_NOT_FOUND";
|
|
1507
|
+
readonly CLI_CONFIG_INVALID: "CLI_CONFIG_INVALID";
|
|
646
1508
|
readonly CLI_CONFIG_OUTPUT_MISSING: "CLI_CONFIG_OUTPUT_MISSING";
|
|
647
1509
|
readonly CLI_CHECK_OUTPUT_MISSING: "CLI_CHECK_OUTPUT_MISSING";
|
|
1510
|
+
readonly CLI_INPUT_MISSING: "CLI_INPUT_MISSING";
|
|
648
1511
|
readonly OUTPUT_STALE: "OUTPUT_STALE";
|
|
649
1512
|
readonly OUTPUT_READ_FAILED: "OUTPUT_READ_FAILED";
|
|
650
1513
|
readonly OUTPUT_WRITE_FAILED: "OUTPUT_WRITE_FAILED";
|
|
651
1514
|
};
|
|
652
1515
|
type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
|
|
1516
|
+
/** Structured, JSON-serializable facts about a failure, for programs and logs. */
|
|
653
1517
|
type ErrorDetails = Readonly<Record<string, unknown>>;
|
|
654
1518
|
interface OpenAPITypesafeErrorInit {
|
|
655
1519
|
readonly code: ErrorCode;
|
|
656
1520
|
readonly message: string;
|
|
657
1521
|
readonly details?: ErrorDetails;
|
|
1522
|
+
/** The lower-level error this one reports, if any (kept as the standard `cause`). */
|
|
658
1523
|
readonly cause?: unknown;
|
|
659
1524
|
}
|
|
1525
|
+
/**
|
|
1526
|
+
* The base of every expected failure; check `code`, not the class or the message. The message
|
|
1527
|
+
* never shows the user info of a URL (`url-credentials.ts`).
|
|
1528
|
+
*/
|
|
660
1529
|
declare class OpenAPITypesafeError extends Error {
|
|
661
1530
|
readonly code: ErrorCode;
|
|
662
1531
|
readonly details: ErrorDetails;
|
|
663
1532
|
constructor(init: OpenAPITypesafeErrorInit);
|
|
664
1533
|
}
|
|
1534
|
+
/** Whether a thrown value is one of our typed errors (also across bundled copies of the class). */
|
|
665
1535
|
declare function isOpenAPITypesafeError(value: unknown): value is OpenAPITypesafeError;
|
|
666
1536
|
|
|
1537
|
+
/** Options of `astToString` for the TypeScript printer, as in the original. */
|
|
667
1538
|
interface AstToStringOptions {
|
|
668
1539
|
fileName?: string;
|
|
669
1540
|
sourceText?: string;
|
|
1541
|
+
/** The installed compiler's printer options (ADR-032: named without `ts.PrinterOptions`). */
|
|
670
1542
|
formatOptions?: ts.PrinterOptions;
|
|
671
1543
|
}
|
|
672
1544
|
|
|
1545
|
+
/** Anything the IR printer can print at the top level of a file. */
|
|
673
1546
|
type IrPrintable = IrDeclaration | IrMember | IrType;
|
|
674
1547
|
|
|
1548
|
+
/** What `astToString` prints: IR (from `openapiTS` and the transformers) or TypeScript nodes. */
|
|
675
1549
|
type AstToStringInput = IrPrintable | ts.Node | readonly (IrPrintable | ts.Node)[];
|
|
1550
|
+
/**
|
|
1551
|
+
* Print declarations, members or types as a TypeScript file body. IR is printed by our printer;
|
|
1552
|
+
* with TypeScript nodes in the input, or with TypeScript printer options, everything goes
|
|
1553
|
+
* through the TypeScript printer as before (ADR-004, decision 1).
|
|
1554
|
+
*/
|
|
676
1555
|
declare function astToString(ast: AstToStringInput, options?: AstToStringOptions): string;
|
|
677
1556
|
|
|
1557
|
+
/** The header of every generated file; the CLI writes it before the declarations. */
|
|
678
1558
|
declare const COMMENT_HEADER = "/**\n * This file was auto-generated by openapi-typesafe.\n * Do not make direct changes to the file.\n */\n\n";
|
|
679
1559
|
|
|
1560
|
+
/**
|
|
1561
|
+
* The `discriminator-values` fix (#1700). With `--enum`, the enum the scan adds to a member
|
|
1562
|
+
* (`petType: "Cat"`) is declared as an enum of its own (`CatPetType`), which is not assignable to
|
|
1563
|
+
* the parent's enum (`PetType`). The parent's enum is found here, so the member's property can be
|
|
1564
|
+
* typed with its members (`PetType.Cat`).
|
|
1565
|
+
*/
|
|
1566
|
+
/** The parent's enum schema and the location it is typed at, which gives the enum its name. */
|
|
1567
|
+
interface EnumParent {
|
|
1568
|
+
readonly schema: SchemaObject;
|
|
1569
|
+
readonly path: string;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
/** The discriminators of a bundled document, after patching the mapped schemas in place. */
|
|
680
1573
|
interface DiscriminatorScan {
|
|
681
1574
|
objects: Record<string, DiscriminatorObject>;
|
|
682
1575
|
refsHandled: string[];
|
|
683
|
-
|
|
1576
|
+
/** With `discriminator-values`: the owner's enum of each enum the scan added. */
|
|
1577
|
+
enumParents: ReadonlyMap<object, EnumParent>;
|
|
1578
|
+
/** With `discriminator-values`: the properties of the other discriminators a schema inherits. */
|
|
1579
|
+
otherProperties: Readonly<Record<string, readonly string[]>>;
|
|
1580
|
+
}
|
|
1581
|
+
/**
|
|
1582
|
+
* Return a key–value map of discriminator objects found in a schema. Warnings go to `logger`;
|
|
1583
|
+
* without one, to the default terminal logger, as the original did.
|
|
1584
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1585
|
+
*/
|
|
684
1586
|
declare function scanDiscriminators(schema: OpenAPI3, options: GeneratorOptions, logger?: Logger): DiscriminatorScan;
|
|
685
1587
|
|
|
1588
|
+
/**
|
|
1589
|
+
* The public type helpers (ENGINEERING_PLAN 6.2, ADR-004 decision 2). Same names and call
|
|
1590
|
+
* signatures as the original helpers; they return IR types. A `ts.TypeNode` argument (from user
|
|
1591
|
+
* code built with `ts.factory`) is read into IR by the bridge.
|
|
1592
|
+
*/
|
|
1593
|
+
/** A helper argument: an IR type, or a TypeScript type node from user code. */
|
|
686
1594
|
type TypeInput = IrType | ts.TypeNode;
|
|
687
1595
|
declare const BOOLEAN: IrType;
|
|
688
1596
|
declare const FALSE: IrType;
|
|
@@ -692,24 +1600,54 @@ declare const NUMBER: IrType;
|
|
|
692
1600
|
declare const STRING: IrType;
|
|
693
1601
|
declare const TRUE: IrType;
|
|
694
1602
|
declare const UNDEFINED: IrType;
|
|
1603
|
+
/** The shared `unknown` type; the transformers compare with it by identity, as the original did. */
|
|
695
1604
|
declare const UNKNOWN: IrType;
|
|
1605
|
+
/** `A | B`: `never` for no types, the type itself for one; repeated primitives are removed. */
|
|
696
1606
|
declare function tsUnion(types: readonly TypeInput[]): IrType;
|
|
1607
|
+
/** `A & B`, with the same rules as `tsUnion`. */
|
|
697
1608
|
declare function tsIntersection(types: readonly TypeInput[]): IrType;
|
|
1609
|
+
/** `A | null`, without removing repeated types. */
|
|
698
1610
|
declare function tsNullable(types: readonly TypeInput[]): IrType;
|
|
1611
|
+
/** `Omit<T, "a" | "b">`. */
|
|
699
1612
|
declare function tsOmit(type: TypeInput, keys: readonly string[]): IrType;
|
|
1613
|
+
/** `Record<K, V>`. */
|
|
700
1614
|
declare function tsRecord(key: TypeInput, value: TypeInput): IrType;
|
|
1615
|
+
/**
|
|
1616
|
+
* The literal type of a JSON value: strings, numbers, booleans and `null` as literals, arrays as
|
|
1617
|
+
* tuples (an empty one as `never[]`), objects as object types; anything else is `unknown`.
|
|
1618
|
+
*/
|
|
701
1619
|
declare function tsLiteral(value: unknown): IrType;
|
|
1620
|
+
/**
|
|
1621
|
+
* `WithRequired<T, "a" | "b">`, or the type itself for no keys. Adds the `WithRequired` helper
|
|
1622
|
+
* type to the footer once.
|
|
1623
|
+
*/
|
|
702
1624
|
declare function tsWithRequired(type: TypeInput, keys: readonly string[], injectFooter: FooterEntry[]): IrType;
|
|
703
1625
|
interface OapiRefOptions {
|
|
1626
|
+
/** Whether to wrap with FlattenedDeepRequired<> (default: false) */
|
|
704
1627
|
deep?: boolean;
|
|
1628
|
+
/** Array of property names to wrap with Extract<> when accessing */
|
|
705
1629
|
extractProperties?: string[];
|
|
706
1630
|
}
|
|
1631
|
+
/**
|
|
1632
|
+
* The generated type a JSON Pointer refers to, as an indexed access: `#/components/schemas/Foo`
|
|
1633
|
+
* → `components["schemas"]["Foo"]`. Object `properties` are skipped, and a referenced parameter
|
|
1634
|
+
* is indexed by its location (`resolved`).
|
|
1635
|
+
*/
|
|
707
1636
|
declare function oapiRef(path: string, resolved?: ParameterObject | ReferenceObject, options?: OapiRefOptions): IrType;
|
|
708
1637
|
|
|
1638
|
+
/**
|
|
1639
|
+
* The original's helpers that build TypeScript compiler nodes, kept for 1.x and deprecated
|
|
1640
|
+
* (ADR-004, decision 9). They load TypeScript on first use through the bridge; the generator
|
|
1641
|
+
* itself does not use them.
|
|
1642
|
+
*/
|
|
709
1643
|
declare const JS_PROPERTY_INDEX_RE: RegExp;
|
|
710
1644
|
declare const JS_ENUM_INVALID_CHARS_RE: RegExp;
|
|
711
1645
|
declare const JS_PROPERTY_INDEX_INVALID_CHARS_RE: RegExp;
|
|
712
1646
|
declare const SPECIAL_CHARACTER_MAP: Record<string, string>;
|
|
1647
|
+
/**
|
|
1648
|
+
* The `?` token. Created on first use, so importing the package needs no TypeScript.
|
|
1649
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1650
|
+
*/
|
|
713
1651
|
declare const QUESTION_TOKEN: ts.QuestionToken;
|
|
714
1652
|
interface AnnotatedSchemaObject {
|
|
715
1653
|
const?: unknown;
|
|
@@ -725,9 +1663,23 @@ interface AnnotatedSchemaObject {
|
|
|
725
1663
|
title?: string;
|
|
726
1664
|
type?: string | string[];
|
|
727
1665
|
}
|
|
1666
|
+
/**
|
|
1667
|
+
* Add the schema's JSDoc comment to a TypeScript property signature.
|
|
1668
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1669
|
+
*/
|
|
728
1670
|
declare function addJSDocComment(schemaObject: AnnotatedSchemaObject, node: ts.PropertySignature): void;
|
|
1671
|
+
/**
|
|
1672
|
+
* Deduplicate simple primitive types from an array of nodes
|
|
1673
|
+
* Note: won’t deduplicate complex types like objects
|
|
1674
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1675
|
+
*/
|
|
729
1676
|
declare function tsDedupe(types: TypeInput[]): ts.TypeNode[];
|
|
1677
|
+
/** @deprecated The generator keeps its own enum registry per run; kept for 1.x (ADR-004). */
|
|
730
1678
|
declare const enumCache: Map<string, ts.EnumDeclaration>;
|
|
1679
|
+
/**
|
|
1680
|
+
* Create a TS enum (with sanitized name and members)
|
|
1681
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1682
|
+
*/
|
|
731
1683
|
declare function tsEnum(name: string, members: (string | number)[], metadata?: {
|
|
732
1684
|
name?: string;
|
|
733
1685
|
description?: string | null;
|
|
@@ -735,78 +1687,262 @@ declare function tsEnum(name: string, members: (string | number)[], metadata?: {
|
|
|
735
1687
|
export?: boolean;
|
|
736
1688
|
shouldCache?: boolean;
|
|
737
1689
|
}): ts.EnumDeclaration;
|
|
1690
|
+
/**
|
|
1691
|
+
* Create an exported TS array literal expression
|
|
1692
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1693
|
+
*/
|
|
738
1694
|
declare function tsArrayLiteralExpression(name: string, elementType: TypeInput, values: (string | number)[], options?: {
|
|
739
1695
|
export?: boolean;
|
|
740
1696
|
readonly?: boolean;
|
|
741
1697
|
injectFooter?: FooterEntry[];
|
|
742
1698
|
}): ts.VariableStatement;
|
|
1699
|
+
/**
|
|
1700
|
+
* Sanitize TS enum member expression
|
|
1701
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1702
|
+
*/
|
|
743
1703
|
declare function tsEnumMember(value: string | number, metadata?: {
|
|
744
1704
|
name?: string;
|
|
745
1705
|
description?: string | null;
|
|
746
1706
|
}): ts.EnumMember;
|
|
1707
|
+
/**
|
|
1708
|
+
* Is this a primitive type (string, number, boolean, null, undefined)?
|
|
1709
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1710
|
+
*/
|
|
747
1711
|
declare function tsIsPrimitive(input: TypeInput): boolean;
|
|
1712
|
+
/**
|
|
1713
|
+
* Modifiers (readonly)
|
|
1714
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1715
|
+
*/
|
|
748
1716
|
declare function tsModifiers(modifiers: {
|
|
749
1717
|
readonly?: boolean;
|
|
750
1718
|
export?: boolean;
|
|
751
1719
|
}): ts.Modifier[];
|
|
1720
|
+
/**
|
|
1721
|
+
* Create a valid property index
|
|
1722
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1723
|
+
*/
|
|
752
1724
|
declare function tsPropertyIndex(index: string | number): ts.Identifier | ts.NumericLiteral | ts.StringLiteral;
|
|
1725
|
+
/**
|
|
1726
|
+
* Enhanced ReadonlyArray.
|
|
1727
|
+
* eg: type Foo = ReadonlyArray<T>; type Bar = ReadonlyArray<T[]>
|
|
1728
|
+
* Foo and Bar are both of type `readonly T[]`
|
|
1729
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1730
|
+
*/
|
|
753
1731
|
declare function tsReadonlyArray(type: TypeInput, injectFooter?: FooterEntry[]): ts.TypeNode;
|
|
754
1732
|
|
|
1733
|
+
/** `$ref` resolution and the document walk that the generator's pre-pass uses. */
|
|
755
1734
|
interface ResolveRefOptions {
|
|
756
1735
|
silent: boolean;
|
|
757
1736
|
visited?: string[];
|
|
1737
|
+
/** @internal Where warnings go; the default terminal logger (respecting `silent`) if absent. */
|
|
758
1738
|
logger?: Logger;
|
|
759
1739
|
}
|
|
760
1740
|
|
|
1741
|
+
/**
|
|
1742
|
+
* The shared ansi-colors instance.
|
|
1743
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9). Use a color library directly.
|
|
1744
|
+
*/
|
|
761
1745
|
declare const c: typeof colors;
|
|
1746
|
+
/**
|
|
1747
|
+
* The discriminator property of a schema at `path`, typed as its discriminator value. Returns IR
|
|
1748
|
+
* (task 6.2), like the exported transformers.
|
|
1749
|
+
*/
|
|
762
1750
|
declare function createDiscriminatorProperty(discriminator: DiscriminatorObject, { path, readonly }: {
|
|
763
1751
|
path: string;
|
|
764
1752
|
readonly?: boolean;
|
|
765
1753
|
}): IrPropertySignature;
|
|
1754
|
+
/** Create a $ref pointer (even from other $refs) */
|
|
766
1755
|
declare function createRef(parts: (number | string | undefined | null)[]): string;
|
|
1756
|
+
/**
|
|
1757
|
+
* Print debug message (cribbed from the `debug` package, but without all the bells & whistles
|
|
1758
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1759
|
+
*/
|
|
767
1760
|
declare function debug(msg: string, group?: string, time?: number): void;
|
|
1761
|
+
/**
|
|
1762
|
+
* Print error message
|
|
1763
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1764
|
+
*/
|
|
768
1765
|
declare function error(msg: string): void;
|
|
1766
|
+
/** Format a performance log in a friendly format */
|
|
769
1767
|
declare function formatTime(t: number): string;
|
|
1768
|
+
/** Call Object.entries() and optionally sort */
|
|
770
1769
|
declare function getEntries<T>(obj: ArrayLike<T> | Record<string, T>, options?: {
|
|
771
1770
|
alphabetize?: boolean;
|
|
772
1771
|
excludeDeprecated?: boolean;
|
|
773
1772
|
}): [string, T][];
|
|
774
1773
|
|
|
775
|
-
|
|
1774
|
+
/**
|
|
1775
|
+
* resolve a $ref in a schema
|
|
1776
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1777
|
+
*/
|
|
1778
|
+
declare function resolveRef<T>(schema: unknown, $ref: string, options: ResolveRefOptions): T | undefined;
|
|
1779
|
+
/**
|
|
1780
|
+
* Walk through any JSON-serializable (i.e. non-circular) object
|
|
1781
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1782
|
+
*/
|
|
776
1783
|
declare function walk(obj: unknown, cb: (value: Record<string, unknown>, path: (string | number)[]) => void, path?: (string | number)[]): void;
|
|
1784
|
+
/**
|
|
1785
|
+
* Print warning message
|
|
1786
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 9).
|
|
1787
|
+
*/
|
|
777
1788
|
declare function warn(msg: string, silent?: boolean): void;
|
|
778
1789
|
|
|
1790
|
+
/** Node's deprecation code for `stringToAST`, so users can filter or trace the warning. */
|
|
779
1791
|
declare const STRING_TO_AST_DEPRECATION_CODE = "OPENAPI_TYPESAFE_DEP_STRING_TO_AST";
|
|
1792
|
+
/**
|
|
1793
|
+
* Convert an arbitrary string to TS (assuming it’s valid). Parses with the TypeScript bridge, so
|
|
1794
|
+
* it needs TypeScript 6 or earlier (or `@typescript/typescript6`). Node's `util.deprecate` warns
|
|
1795
|
+
* on the first call only.
|
|
1796
|
+
* @deprecated Kept for 1.x; removed in 2.0 (ADR-004, decision 7). Use type text in IR callbacks.
|
|
1797
|
+
*/
|
|
780
1798
|
declare const stringToAST: (source: string) => unknown[];
|
|
781
1799
|
|
|
1800
|
+
/**
|
|
1801
|
+
* The whole document as IR declarations (ENGINEERING_PLAN 6.1–6.2); `openapiTS` returns the same
|
|
1802
|
+
* for a loaded document.
|
|
1803
|
+
*/
|
|
782
1804
|
declare function transformSchema(schema: OpenAPI3, ctx: GlobalContext): IrDeclaration[];
|
|
783
1805
|
|
|
1806
|
+
/**
|
|
1807
|
+
* Typed warnings. A warning does not stop the run: the output is written and the CLI exits with 0.
|
|
1808
|
+
* Each one ends with a stable machine-readable code in parentheses, as the CLI prints errors
|
|
1809
|
+
* (`message (CODE)`), so a script or a person can search for it.
|
|
1810
|
+
*/
|
|
1811
|
+
/** Every warning code. */
|
|
1812
|
+
declare const WARNING_CODES: {
|
|
1813
|
+
readonly CLI_INPUT_IGNORED: "CLI_INPUT_IGNORED";
|
|
1814
|
+
readonly CONFIG_SETTING_UNKNOWN: "CONFIG_SETTING_UNKNOWN";
|
|
1815
|
+
readonly DISCRIMINATOR_MAPPING_INVALID: "DISCRIMINATOR_MAPPING_INVALID";
|
|
1816
|
+
readonly DISCRIMINATOR_VALUE_NOT_ALLOWED: "DISCRIMINATOR_VALUE_NOT_ALLOWED";
|
|
1817
|
+
readonly ENUM_VALUES_EXCLUDED: "ENUM_VALUES_EXCLUDED";
|
|
1818
|
+
readonly FIX_NEEDS_OPTION: "FIX_NEEDS_OPTION";
|
|
1819
|
+
readonly LEGACY_CALLBACK_DEPRECATED: "LEGACY_CALLBACK_DEPRECATED";
|
|
1820
|
+
readonly LINT_PROBLEM: "LINT_PROBLEM";
|
|
1821
|
+
readonly PATH_TEMPLATES_IDENTICAL: "PATH_TEMPLATES_IDENTICAL";
|
|
1822
|
+
readonly QUERYSTRING_NEXT_TO_QUERY: "QUERYSTRING_NEXT_TO_QUERY";
|
|
1823
|
+
readonly REF_CIRCULAR: "REF_CIRCULAR";
|
|
1824
|
+
readonly REF_NOT_FOUND: "REF_NOT_FOUND";
|
|
1825
|
+
};
|
|
1826
|
+
type WarningCode = (typeof WARNING_CODES)[keyof typeof WARNING_CODES];
|
|
1827
|
+
|
|
1828
|
+
/**
|
|
1829
|
+
* Transform the ComponentsObject (4.8.7)
|
|
1830
|
+
* @see https://spec.openapis.org/oas/latest.html#components-object
|
|
1831
|
+
*
|
|
1832
|
+
* Ported to IR (ENGINEERING_PLAN Phase 5, step 6). Same name and parameters as the original;
|
|
1833
|
+
* returns IR (task 6.2). For the public API: the `components` type, then the root type aliases.
|
|
1834
|
+
*/
|
|
784
1835
|
declare function transformComponentsObject(componentsObject: ComponentsObject, ctx: GlobalContext): (IrType | IrTypeAliasDeclaration)[];
|
|
785
1836
|
|
|
1837
|
+
/**
|
|
1838
|
+
* Transform HeaderObject nodes (4.8.21)
|
|
1839
|
+
* @see https://spec.openapis.org/oas/v3.1.0#header-object
|
|
1840
|
+
*
|
|
1841
|
+
* Ported to IR (ENGINEERING_PLAN Phase 5, step 3). Same name and parameters as the original;
|
|
1842
|
+
* returns IR (task 6.2). For the public API and for users who call it from callbacks.
|
|
1843
|
+
*/
|
|
786
1844
|
declare function transformHeaderObject(headerObject: HeaderObject, options: TransformNodeOptions): IrType;
|
|
787
1845
|
|
|
1846
|
+
/**
|
|
1847
|
+
* Transform MediaTypeObject nodes (4.8.14)
|
|
1848
|
+
* @see https://spec.openapis.org/oas/v3.1.0#media-type-object
|
|
1849
|
+
*
|
|
1850
|
+
* Ported to IR (ENGINEERING_PLAN Phase 5, step 3). Same name and parameters as the original;
|
|
1851
|
+
* returns IR (task 6.2). For the public API and for users who call it from callbacks.
|
|
1852
|
+
*/
|
|
788
1853
|
declare function transformMediaTypeObject(mediaTypeObject: MediaTypeObject, options: TransformNodeOptions): IrType;
|
|
789
1854
|
|
|
1855
|
+
/**
|
|
1856
|
+
* Transform OperationObject nodes (4.8.10)
|
|
1857
|
+
* @see https://spec.openapis.org/oas/v3.1.0#operation-object
|
|
1858
|
+
*
|
|
1859
|
+
* Ported to IR (ENGINEERING_PLAN Phase 5, step 5). Same name and parameters as the original;
|
|
1860
|
+
* returns IR (task 6.2). For the public API and for users who call it from callbacks.
|
|
1861
|
+
*/
|
|
790
1862
|
declare function transformOperationObject(operationObject: OperationObject, options: TransformNodeOptions): IrMember[];
|
|
1863
|
+
/** inject an operation at the top level */
|
|
791
1864
|
declare function injectOperationObject(operationId: string, operationObject: OperationObject, options: TransformNodeOptions): void;
|
|
792
1865
|
|
|
1866
|
+
/**
|
|
1867
|
+
* Transform ParameterObject nodes (4.8.12)
|
|
1868
|
+
* @see https://spec.openapis.org/oas/v3.1.0#parameter-object
|
|
1869
|
+
*
|
|
1870
|
+
* Ported to IR (ENGINEERING_PLAN Phase 5, step 3). Same name and parameters as the original;
|
|
1871
|
+
* returns IR (task 6.2). For the public API and for users who call it from callbacks.
|
|
1872
|
+
*/
|
|
793
1873
|
declare function transformParameterObject(parameterObject: ParameterObject, options: TransformNodeOptions): IrType;
|
|
794
1874
|
|
|
1875
|
+
/** The methods every generated path item lists, with `?: never` when the document has none. */
|
|
795
1876
|
type HttpMethod = "get" | "put" | "post" | "delete" | "options" | "head" | "patch" | "trace";
|
|
1877
|
+
/**
|
|
1878
|
+
* The OpenAPI 3.2 QUERY method. Its member is written only when the path item declares it, so
|
|
1879
|
+
* documents without it keep their output (ADR-020).
|
|
1880
|
+
*/
|
|
1881
|
+
declare const QUERY_METHOD = "query";
|
|
1882
|
+
/** Every operation field of a path item. */
|
|
1883
|
+
type PathItemMethod = HttpMethod | typeof QUERY_METHOD;
|
|
796
1884
|
|
|
797
|
-
|
|
1885
|
+
/**
|
|
1886
|
+
* The operation methods of a path item: openapi-typescript's eight, plus the OpenAPI 3.2 `query`
|
|
1887
|
+
* (ADR-020), as `HttpMethod` of openapi-typesafe-helpers lists them.
|
|
1888
|
+
*/
|
|
1889
|
+
type Method = PathItemMethod;
|
|
1890
|
+
/**
|
|
1891
|
+
* Transform PathItem nodes (4.8.9)
|
|
1892
|
+
* @see https://spec.openapis.org/oas/v3.1.0#path-item-object
|
|
1893
|
+
*
|
|
1894
|
+
* Ported to IR (ENGINEERING_PLAN Phase 5, step 5). Same name and parameters as the original;
|
|
1895
|
+
* returns IR (task 6.2). For the public API and for users who call it from callbacks.
|
|
1896
|
+
*/
|
|
798
1897
|
declare function transformPathItemObject(pathItem: PathItemObject, options: TransformNodeOptions): IrType;
|
|
799
1898
|
|
|
1899
|
+
/**
|
|
1900
|
+
* Transform the PathsObject node (4.8.8)
|
|
1901
|
+
* @see https://spec.openapis.org/oas/v3.1.0#operation-object
|
|
1902
|
+
*
|
|
1903
|
+
* Ported to IR (ENGINEERING_PLAN Phase 5, step 5). Same name and parameters as the original;
|
|
1904
|
+
* returns IR (task 6.2). For the public API and for users who call it from callbacks.
|
|
1905
|
+
*/
|
|
800
1906
|
declare function transformPathsObject(pathsObject: PathsObject, ctx: GlobalContext): IrType;
|
|
801
1907
|
|
|
1908
|
+
/**
|
|
1909
|
+
* Transform RequestBodyObject nodes (4.8.13)
|
|
1910
|
+
* @see https://spec.openapis.org/oas/v3.1.0#request-body-object
|
|
1911
|
+
*
|
|
1912
|
+
* Ported to IR (ENGINEERING_PLAN Phase 5, step 4). Same name and parameters as the original;
|
|
1913
|
+
* returns IR (task 6.2). For the public API and for users who call it from callbacks.
|
|
1914
|
+
*/
|
|
802
1915
|
declare function transformRequestBodyObject(requestBodyObject: RequestBodyObject, options: TransformNodeOptions): IrType;
|
|
803
1916
|
|
|
1917
|
+
/**
|
|
1918
|
+
* Transform ResponseObject nodes (4.8.17)
|
|
1919
|
+
* @see https://spec.openapis.org/oas/v3.1.0#response-object
|
|
1920
|
+
*
|
|
1921
|
+
* Ported to IR (ENGINEERING_PLAN Phase 5, step 4). Same name and parameters as the original;
|
|
1922
|
+
* returns IR (task 6.2). For the public API and for users who call it from callbacks.
|
|
1923
|
+
*/
|
|
804
1924
|
declare function transformResponseObject(responseObject: ResponseObject, options: TransformNodeOptions): IrType;
|
|
805
1925
|
|
|
1926
|
+
/**
|
|
1927
|
+
* Transform ResponsesObject nodes (4.8.16)
|
|
1928
|
+
* @see https://spec.openapis.org/oas/v3.1.0#responses-object
|
|
1929
|
+
*
|
|
1930
|
+
* Ported to IR (ENGINEERING_PLAN Phase 5, step 4). Same name and parameters as the original;
|
|
1931
|
+
* returns IR (task 6.2). For the public API and for users who call it from callbacks.
|
|
1932
|
+
*/
|
|
806
1933
|
declare function transformResponsesObject(responsesObject: ResponsesObject, options: TransformNodeOptions): IrType;
|
|
807
1934
|
|
|
1935
|
+
/**
|
|
1936
|
+
* Transform SchemaObject nodes (4.8.24)
|
|
1937
|
+
* @see https://spec.openapis.org/oas/v3.1.0#schema-object
|
|
1938
|
+
*
|
|
1939
|
+
* Ported to IR (ENGINEERING_PLAN Phase 5, step 2): the work happens in
|
|
1940
|
+
* `application/transform/schema`; this keeps the original name and parameters, returning IR
|
|
1941
|
+
* (task 6.2), for the public API and for users who call it from callbacks.
|
|
1942
|
+
*/
|
|
808
1943
|
declare function transformSchemaObject(schemaObject: SchemaObject | ReferenceObject, options: TransformNodeOptions, fromAdditionalProperties?: boolean): IrType;
|
|
1944
|
+
/** Transform SchemaObjects without the `postTransform` callback at the top level. */
|
|
809
1945
|
declare function transformSchemaObjectWithComposition(schemaObject: SchemaObject | ReferenceObject, options: TransformNodeOptions, fromAdditionalProperties?: boolean): IrType;
|
|
810
1946
|
|
|
811
|
-
export { ALL_OUTPUT_FIXES, BOOLEAN, COMMENT_HEADER, ERROR_CODES, FALSE, JS_ENUM_INVALID_CHARS_RE, JS_PROPERTY_INDEX_INVALID_CHARS_RE, JS_PROPERTY_INDEX_RE, NEVER, NULL, NUMBER, OUTPUT_FIXES, OpenAPITypesafeError, OutputFix, QUESTION_TOKEN, SPECIAL_CHARACTER_MAP, STRING, STRING_TO_AST_DEPRECATION_CODE, TRUE, UNDEFINED, UNKNOWN, addJSDocComment, astToString, c, createDiscriminatorProperty, createRef, debug, openapiTS as default, enumCache, error, formatTime, getEntries, injectOperationObject, isOpenAPITypesafeError, oapiRef, resolveRef, scanDiscriminators, stringToAST, transformComponentsObject, transformHeaderObject, transformMediaTypeObject, transformOperationObject, transformParameterObject, transformPathItemObject, transformPathsObject, transformRequestBodyObject, transformResponseObject, transformResponsesObject, transformSchema, transformSchemaObject, transformSchemaObjectWithComposition, tsArrayLiteralExpression, tsDedupe, tsEnum, tsEnumMember, tsIntersection, tsIsPrimitive, tsLiteral, tsModifiers, tsNullable, tsOmit, tsPropertyIndex, tsReadonlyArray, tsRecord, tsUnion, tsWithRequired, walk, warn };
|
|
812
|
-
export type { $defs, AnnotatedSchemaObject, ArraySubtype, AstToStringInput, AstToStringOptions, BooleanSubtype, CallbackObject, ComponentsObject, ContactObject, DiscriminatorObject, EncodingObject, ErrorCode, ErrorDetails, ExampleObject, Extensable, ExternalDocumentationObject, FooterEntry, GeneratorOptions, GlobalContext, HeaderObject, InfoObject, IntegerSubtype, IrArrayType, IrBooleanLiteralType, IrCallbackOptions, IrCallbackType, IrComment, IrConstArrayDeclaration, IrDeclaration, IrEnumDeclaration, IrEnumMember, IrIndexSignature, IrIndexedAccessType, IrInterfaceDeclaration, IrIntersectionType, IrKeyword, IrKeywordType, IrMember, IrNumberLiteralType, IrObjectType, IrPostTransform, IrPropertyName, IrPropertySignature, IrRawDeclaration, IrRawType, IrReadonlyType, IrReferenceType, IrStringEncoding, IrStringLiteralType, IrTransform, IrTransformObject, IrTransformProperty, IrTupleElement, IrTupleType, IrType, IrTypeAliasDeclaration, IrUnionType, LegacyCallbackName, LegacyCallbackOptions, LicenseObject, LinkObject, MediaTypeObject, Method, NullSubtype, NumberSubtype, OAuthFlowObject, OAuthFlowsObject, OapiRefOptions, ObjectSubtype, OpenAPI3, OpenAPITSBaseOptions, OpenAPITSIrOptions, OpenAPITSOptions, OperationObject, OutputFixName, ParameterObject, PathItemObject, PathsObject, ReferenceObject, RequestBodyObject, ResolveRefOptions, ResponseObject, ResponsesObject, SchemaObject, SchemaSource, SecurityRequirementObject, SecuritySchemeObject, ServerObject, ServerVariableObject, StringSubtype, TagObject, TransformNodeOptions, TransformObject, TypeInput, WebhooksObject, XMLObject };
|
|
1947
|
+
export { ALL_OUTPUT_FIXES, BOOLEAN, COMMENT_HEADER, ERROR_CODES, FALSE, JS_ENUM_INVALID_CHARS_RE, JS_PROPERTY_INDEX_INVALID_CHARS_RE, JS_PROPERTY_INDEX_RE, NEVER, NULL, NUMBER, OUTPUT_FIXES, OpenAPITypesafeError, OutputFix, QUESTION_TOKEN, SPECIAL_CHARACTER_MAP, STRING, STRING_TO_AST_DEPRECATION_CODE, TRUE, UNDEFINED, UNKNOWN, WARNING_CODES, addJSDocComment, astToString, c, createDiscriminatorProperty, createRef, debug, openapiTS as default, enumCache, error, formatTime, getEntries, injectOperationObject, isOpenAPITypesafeError, oapiRef, resolveRef, scanDiscriminators, stringToAST, transformComponentsObject, transformHeaderObject, transformMediaTypeObject, transformOperationObject, transformParameterObject, transformPathItemObject, transformPathsObject, transformRequestBodyObject, transformResponseObject, transformResponsesObject, transformSchema, transformSchemaObject, transformSchemaObjectWithComposition, tsArrayLiteralExpression, tsDedupe, tsEnum, tsEnumMember, tsIntersection, tsIsPrimitive, tsLiteral, tsModifiers, tsNullable, tsOmit, tsPropertyIndex, tsReadonlyArray, tsRecord, tsUnion, tsWithRequired, walk, warn };
|
|
1948
|
+
export type { $defs, AnnotatedSchemaObject, ArraySubtype, AstToStringInput, AstToStringOptions, BooleanSubtype, CallbackObject, ComponentsObject, ContactObject, DiscriminatorObject, EncodingObject, ErrorCode, ErrorDetails, ExampleObject, Extensable, ExternalDocumentationObject, FooterEntry, GeneratorOptions, GlobalContext, HeaderObject, InfoObject, IntegerSubtype, IrArrayType, IrBooleanLiteralType, IrCallbackOptions, IrCallbackType, IrComment, IrConstArrayDeclaration, IrDeclaration, IrEnumDeclaration, IrEnumMember, IrIndexSignature, IrIndexedAccessType, IrInterfaceDeclaration, IrIntersectionType, IrKeyword, IrKeywordType, IrMember, IrNumberLiteralType, IrObjectType, IrPostTransform, IrPropertyName, IrPropertySignature, IrRawDeclaration, IrRawType, IrReadonlyType, IrReferenceType, IrStringEncoding, IrStringLiteralType, IrTransform, IrTransformObject, IrTransformProperty, IrTupleElement, IrTupleType, IrType, IrTypeAliasDeclaration, IrUnionType, LegacyCallbackName, LegacyCallbackOptions, LicenseObject, LinkObject, MediaTypeObject, Method, NullSubtype, NumberSubtype, OAuthFlowObject, OAuthFlowsObject, OapiRefOptions, ObjectSubtype, OpenAPI3, OpenAPITSBaseOptions, OpenAPITSIrOptions, OpenAPITSOptions, OperationObject, OutputFixName, ParameterObject, PathItemObject, PathsObject, ReferenceObject, RequestBodyObject, ResolveRefOptions, ResponseObject, ResponsesObject, SchemaObject, SchemaSource, SecurityRequirementObject, SecuritySchemeObject, ServerObject, ServerVariableObject, StringSubtype, TagObject, TransformNodeOptions, TransformObject, TypeInput, WarningCode, WebhooksObject, XMLObject };
|