@typia/utils 12.0.0-dev.20260225
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +79 -0
- package/lib/converters/LlmSchemaConverter.d.ts +102 -0
- package/lib/converters/LlmSchemaConverter.js +652 -0
- package/lib/converters/LlmSchemaConverter.js.map +1 -0
- package/lib/converters/LlmSchemaConverter.mjs +771 -0
- package/lib/converters/LlmSchemaConverter.mjs.map +1 -0
- package/lib/converters/OpenApiConverter.d.ts +135 -0
- package/lib/converters/OpenApiConverter.js +130 -0
- package/lib/converters/OpenApiConverter.js.map +1 -0
- package/lib/converters/OpenApiConverter.mjs +128 -0
- package/lib/converters/OpenApiConverter.mjs.map +1 -0
- package/lib/converters/index.d.ts +2 -0
- package/lib/converters/index.js +21 -0
- package/lib/converters/index.js.map +1 -0
- package/lib/converters/index.mjs +4 -0
- package/lib/converters/index.mjs.map +1 -0
- package/lib/converters/internal/LlmDescriptionInverter.d.ts +6 -0
- package/lib/converters/internal/LlmDescriptionInverter.js +141 -0
- package/lib/converters/internal/LlmDescriptionInverter.js.map +1 -0
- package/lib/converters/internal/LlmDescriptionInverter.mjs +141 -0
- package/lib/converters/internal/LlmDescriptionInverter.mjs.map +1 -0
- package/lib/converters/internal/LlmParametersComposer.d.ts +1 -0
- package/lib/converters/internal/LlmParametersComposer.js +39 -0
- package/lib/converters/internal/LlmParametersComposer.js.map +1 -0
- package/lib/converters/internal/LlmParametersComposer.mjs +42 -0
- package/lib/converters/internal/LlmParametersComposer.mjs.map +1 -0
- package/lib/converters/internal/OpenApiConstraintShifter.d.ts +6 -0
- package/lib/converters/internal/OpenApiConstraintShifter.js +103 -0
- package/lib/converters/internal/OpenApiConstraintShifter.js.map +1 -0
- package/lib/converters/internal/OpenApiConstraintShifter.mjs +102 -0
- package/lib/converters/internal/OpenApiConstraintShifter.mjs.map +1 -0
- package/lib/converters/internal/OpenApiExclusiveEmender.d.ts +4 -0
- package/lib/converters/internal/OpenApiExclusiveEmender.js +32 -0
- package/lib/converters/internal/OpenApiExclusiveEmender.js.map +1 -0
- package/lib/converters/internal/OpenApiExclusiveEmender.mjs +35 -0
- package/lib/converters/internal/OpenApiExclusiveEmender.mjs.map +1 -0
- package/lib/converters/internal/OpenApiV3Downgrader.d.ts +10 -0
- package/lib/converters/internal/OpenApiV3Downgrader.js +214 -0
- package/lib/converters/internal/OpenApiV3Downgrader.js.map +1 -0
- package/lib/converters/internal/OpenApiV3Downgrader.mjs +279 -0
- package/lib/converters/internal/OpenApiV3Downgrader.mjs.map +1 -0
- package/lib/converters/internal/OpenApiV3Upgrader.d.ts +6 -0
- package/lib/converters/internal/OpenApiV3Upgrader.js +285 -0
- package/lib/converters/internal/OpenApiV3Upgrader.js.map +1 -0
- package/lib/converters/internal/OpenApiV3Upgrader.mjs +349 -0
- package/lib/converters/internal/OpenApiV3Upgrader.mjs.map +1 -0
- package/lib/converters/internal/OpenApiV3_1Upgrader.d.ts +6 -0
- package/lib/converters/internal/OpenApiV3_1Upgrader.js +405 -0
- package/lib/converters/internal/OpenApiV3_1Upgrader.js.map +1 -0
- package/lib/converters/internal/OpenApiV3_1Upgrader.mjs +545 -0
- package/lib/converters/internal/OpenApiV3_1Upgrader.mjs.map +1 -0
- package/lib/converters/internal/SwaggerV2Downgrader.d.ts +10 -0
- package/lib/converters/internal/SwaggerV2Downgrader.js +294 -0
- package/lib/converters/internal/SwaggerV2Downgrader.js.map +1 -0
- package/lib/converters/internal/SwaggerV2Downgrader.mjs +332 -0
- package/lib/converters/internal/SwaggerV2Downgrader.mjs.map +1 -0
- package/lib/converters/internal/SwaggerV2Upgrader.d.ts +6 -0
- package/lib/converters/internal/SwaggerV2Upgrader.js +357 -0
- package/lib/converters/internal/SwaggerV2Upgrader.js.map +1 -0
- package/lib/converters/internal/SwaggerV2Upgrader.mjs +403 -0
- package/lib/converters/internal/SwaggerV2Upgrader.mjs.map +1 -0
- package/lib/http/HttpError.d.ts +61 -0
- package/lib/http/HttpError.js +70 -0
- package/lib/http/HttpError.js.map +1 -0
- package/lib/http/HttpError.mjs +76 -0
- package/lib/http/HttpError.mjs.map +1 -0
- package/lib/http/HttpLlm.d.ts +130 -0
- package/lib/http/HttpLlm.js +124 -0
- package/lib/http/HttpLlm.js.map +1 -0
- package/lib/http/HttpLlm.mjs +123 -0
- package/lib/http/HttpLlm.mjs.map +1 -0
- package/lib/http/HttpMigration.d.ts +58 -0
- package/lib/http/HttpMigration.js +52 -0
- package/lib/http/HttpMigration.js.map +1 -0
- package/lib/http/HttpMigration.mjs +52 -0
- package/lib/http/HttpMigration.mjs.map +1 -0
- package/lib/http/index.d.ts +3 -0
- package/lib/http/index.js +20 -0
- package/lib/http/index.js.map +1 -0
- package/lib/http/index.mjs +4 -0
- package/lib/http/index.mjs.map +1 -0
- package/lib/http/internal/HttpLlmApplicationComposer.d.ts +8 -0
- package/lib/http/internal/HttpLlmApplicationComposer.js +254 -0
- package/lib/http/internal/HttpLlmApplicationComposer.js.map +1 -0
- package/lib/http/internal/HttpLlmApplicationComposer.mjs +256 -0
- package/lib/http/internal/HttpLlmApplicationComposer.mjs.map +1 -0
- package/lib/http/internal/HttpLlmFunctionFetcher.d.ts +6 -0
- package/lib/http/internal/HttpLlmFunctionFetcher.js +24 -0
- package/lib/http/internal/HttpLlmFunctionFetcher.js.map +1 -0
- package/lib/http/internal/HttpLlmFunctionFetcher.mjs +24 -0
- package/lib/http/internal/HttpLlmFunctionFetcher.mjs.map +1 -0
- package/lib/http/internal/HttpMigrateApplicationComposer.d.ts +4 -0
- package/lib/http/internal/HttpMigrateApplicationComposer.js +45 -0
- package/lib/http/internal/HttpMigrateApplicationComposer.js.map +1 -0
- package/lib/http/internal/HttpMigrateApplicationComposer.mjs +47 -0
- package/lib/http/internal/HttpMigrateApplicationComposer.mjs.map +1 -0
- package/lib/http/internal/HttpMigrateRouteAccessor.d.ts +4 -0
- package/lib/http/internal/HttpMigrateRouteAccessor.js +107 -0
- package/lib/http/internal/HttpMigrateRouteAccessor.js.map +1 -0
- package/lib/http/internal/HttpMigrateRouteAccessor.mjs +106 -0
- package/lib/http/internal/HttpMigrateRouteAccessor.mjs.map +1 -0
- package/lib/http/internal/HttpMigrateRouteComposer.d.ts +11 -0
- package/lib/http/internal/HttpMigrateRouteComposer.js +398 -0
- package/lib/http/internal/HttpMigrateRouteComposer.js.map +1 -0
- package/lib/http/internal/HttpMigrateRouteComposer.mjs +392 -0
- package/lib/http/internal/HttpMigrateRouteComposer.mjs.map +1 -0
- package/lib/http/internal/HttpMigrateRouteFetcher.d.ts +6 -0
- package/lib/http/internal/HttpMigrateRouteFetcher.js +179 -0
- package/lib/http/internal/HttpMigrateRouteFetcher.js.map +1 -0
- package/lib/http/internal/HttpMigrateRouteFetcher.mjs +174 -0
- package/lib/http/internal/HttpMigrateRouteFetcher.mjs.map +1 -0
- package/lib/http/internal/LlmDataMerger.d.ts +48 -0
- package/lib/http/internal/LlmDataMerger.js +60 -0
- package/lib/http/internal/LlmDataMerger.js.map +1 -0
- package/lib/http/internal/LlmDataMerger.mjs +59 -0
- package/lib/http/internal/LlmDataMerger.mjs.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +21 -0
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +20 -0
- package/lib/index.mjs.map +1 -0
- package/lib/utils/ArrayUtil.d.ts +1 -0
- package/lib/utils/ArrayUtil.js +29 -0
- package/lib/utils/ArrayUtil.js.map +1 -0
- package/lib/utils/ArrayUtil.mjs +28 -0
- package/lib/utils/ArrayUtil.mjs.map +1 -0
- package/lib/utils/MapUtil.d.ts +1 -0
- package/lib/utils/MapUtil.js +16 -0
- package/lib/utils/MapUtil.js.map +1 -0
- package/lib/utils/MapUtil.mjs +15 -0
- package/lib/utils/MapUtil.mjs.map +1 -0
- package/lib/utils/NamingConvention.d.ts +68 -0
- package/lib/utils/NamingConvention.js +199 -0
- package/lib/utils/NamingConvention.js.map +1 -0
- package/lib/utils/NamingConvention.mjs +198 -0
- package/lib/utils/NamingConvention.mjs.map +1 -0
- package/lib/utils/Singleton.d.ts +1 -0
- package/lib/utils/Singleton.js +18 -0
- package/lib/utils/Singleton.js.map +1 -0
- package/lib/utils/Singleton.mjs +18 -0
- package/lib/utils/Singleton.mjs.map +1 -0
- package/lib/utils/StringUtil.d.ts +1 -0
- package/lib/utils/StringUtil.js +17 -0
- package/lib/utils/StringUtil.js.map +1 -0
- package/lib/utils/StringUtil.mjs +13 -0
- package/lib/utils/StringUtil.mjs.map +1 -0
- package/lib/utils/dedent.d.ts +12 -0
- package/lib/utils/dedent.js +51 -0
- package/lib/utils/dedent.js.map +1 -0
- package/lib/utils/dedent.mjs +50 -0
- package/lib/utils/dedent.mjs.map +1 -0
- package/lib/utils/index.d.ts +7 -0
- package/lib/utils/index.js +24 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/index.mjs +8 -0
- package/lib/utils/index.mjs.map +1 -0
- package/lib/utils/internal/EndpointUtil.d.ts +8 -0
- package/lib/utils/internal/EndpointUtil.js +37 -0
- package/lib/utils/internal/EndpointUtil.js.map +1 -0
- package/lib/utils/internal/EndpointUtil.mjs +37 -0
- package/lib/utils/internal/EndpointUtil.mjs.map +1 -0
- package/lib/utils/internal/JsonDescriptor.d.ts +10 -0
- package/lib/utils/internal/JsonDescriptor.js +58 -0
- package/lib/utils/internal/JsonDescriptor.js.map +1 -0
- package/lib/utils/internal/JsonDescriptor.mjs +48 -0
- package/lib/utils/internal/JsonDescriptor.mjs.map +1 -0
- package/lib/utils/internal/OpenApiTypeCheckerBase.d.ts +1 -0
- package/lib/utils/internal/OpenApiTypeCheckerBase.js +520 -0
- package/lib/utils/internal/OpenApiTypeCheckerBase.js.map +1 -0
- package/lib/utils/internal/OpenApiTypeCheckerBase.mjs +584 -0
- package/lib/utils/internal/OpenApiTypeCheckerBase.mjs.map +1 -0
- package/lib/utils/stringifyValidationFailure.d.ts +25 -0
- package/lib/utils/stringifyValidationFailure.js +326 -0
- package/lib/utils/stringifyValidationFailure.js.map +1 -0
- package/lib/utils/stringifyValidationFailure.mjs +325 -0
- package/lib/utils/stringifyValidationFailure.mjs.map +1 -0
- package/lib/validators/LlmTypeChecker.d.ts +117 -0
- package/lib/validators/LlmTypeChecker.js +309 -0
- package/lib/validators/LlmTypeChecker.js.map +1 -0
- package/lib/validators/LlmTypeChecker.mjs +300 -0
- package/lib/validators/LlmTypeChecker.mjs.map +1 -0
- package/lib/validators/OpenApiTypeChecker.d.ts +211 -0
- package/lib/validators/OpenApiTypeChecker.js +207 -0
- package/lib/validators/OpenApiTypeChecker.js.map +1 -0
- package/lib/validators/OpenApiTypeChecker.mjs +218 -0
- package/lib/validators/OpenApiTypeChecker.mjs.map +1 -0
- package/lib/validators/OpenApiV3TypeChecker.d.ts +26 -0
- package/lib/validators/OpenApiV3TypeChecker.js +30 -0
- package/lib/validators/OpenApiV3TypeChecker.js.map +1 -0
- package/lib/validators/OpenApiV3TypeChecker.mjs +29 -0
- package/lib/validators/OpenApiV3TypeChecker.mjs.map +1 -0
- package/lib/validators/OpenApiV3_1TypeChecker.d.ts +29 -0
- package/lib/validators/OpenApiV3_1TypeChecker.js +34 -0
- package/lib/validators/OpenApiV3_1TypeChecker.js.map +1 -0
- package/lib/validators/OpenApiV3_1TypeChecker.mjs +33 -0
- package/lib/validators/OpenApiV3_1TypeChecker.mjs.map +1 -0
- package/lib/validators/OpenApiValidator.d.ts +36 -0
- package/lib/validators/OpenApiValidator.js +71 -0
- package/lib/validators/OpenApiValidator.js.map +1 -0
- package/lib/validators/OpenApiValidator.mjs +75 -0
- package/lib/validators/OpenApiValidator.mjs.map +1 -0
- package/lib/validators/SwaggerV2TypeChecker.d.ts +27 -0
- package/lib/validators/SwaggerV2TypeChecker.js +31 -0
- package/lib/validators/SwaggerV2TypeChecker.js.map +1 -0
- package/lib/validators/SwaggerV2TypeChecker.mjs +30 -0
- package/lib/validators/SwaggerV2TypeChecker.mjs.map +1 -0
- package/lib/validators/functional/_isBigintString.d.ts +1 -0
- package/lib/validators/functional/_isBigintString.js +14 -0
- package/lib/validators/functional/_isBigintString.js.map +1 -0
- package/lib/validators/functional/_isBigintString.mjs +12 -0
- package/lib/validators/functional/_isBigintString.mjs.map +1 -0
- package/lib/validators/functional/_isFormatByte.d.ts +1 -0
- package/lib/validators/functional/_isFormatByte.js +10 -0
- package/lib/validators/functional/_isFormatByte.js.map +1 -0
- package/lib/validators/functional/_isFormatByte.mjs +8 -0
- package/lib/validators/functional/_isFormatByte.mjs.map +1 -0
- package/lib/validators/functional/_isFormatDate.d.ts +1 -0
- package/lib/validators/functional/_isFormatDate.js +7 -0
- package/lib/validators/functional/_isFormatDate.js.map +1 -0
- package/lib/validators/functional/_isFormatDate.mjs +5 -0
- package/lib/validators/functional/_isFormatDate.mjs.map +1 -0
- package/lib/validators/functional/_isFormatDateTime.d.ts +1 -0
- package/lib/validators/functional/_isFormatDateTime.js +7 -0
- package/lib/validators/functional/_isFormatDateTime.js.map +1 -0
- package/lib/validators/functional/_isFormatDateTime.mjs +5 -0
- package/lib/validators/functional/_isFormatDateTime.mjs.map +1 -0
- package/lib/validators/functional/_isFormatDuration.d.ts +1 -0
- package/lib/validators/functional/_isFormatDuration.js +7 -0
- package/lib/validators/functional/_isFormatDuration.js.map +1 -0
- package/lib/validators/functional/_isFormatDuration.mjs +5 -0
- package/lib/validators/functional/_isFormatDuration.mjs.map +1 -0
- package/lib/validators/functional/_isFormatEmail.d.ts +1 -0
- package/lib/validators/functional/_isFormatEmail.js +7 -0
- package/lib/validators/functional/_isFormatEmail.js.map +1 -0
- package/lib/validators/functional/_isFormatEmail.mjs +5 -0
- package/lib/validators/functional/_isFormatEmail.mjs.map +1 -0
- package/lib/validators/functional/_isFormatHostname.d.ts +1 -0
- package/lib/validators/functional/_isFormatHostname.js +7 -0
- package/lib/validators/functional/_isFormatHostname.js.map +1 -0
- package/lib/validators/functional/_isFormatHostname.mjs +5 -0
- package/lib/validators/functional/_isFormatHostname.mjs.map +1 -0
- package/lib/validators/functional/_isFormatIdnEmail.d.ts +1 -0
- package/lib/validators/functional/_isFormatIdnEmail.js +7 -0
- package/lib/validators/functional/_isFormatIdnEmail.js.map +1 -0
- package/lib/validators/functional/_isFormatIdnEmail.mjs +5 -0
- package/lib/validators/functional/_isFormatIdnEmail.mjs.map +1 -0
- package/lib/validators/functional/_isFormatIdnHostname.d.ts +1 -0
- package/lib/validators/functional/_isFormatIdnHostname.js +7 -0
- package/lib/validators/functional/_isFormatIdnHostname.js.map +1 -0
- package/lib/validators/functional/_isFormatIdnHostname.mjs +5 -0
- package/lib/validators/functional/_isFormatIdnHostname.mjs.map +1 -0
- package/lib/validators/functional/_isFormatIpv4.d.ts +1 -0
- package/lib/validators/functional/_isFormatIpv4.js +7 -0
- package/lib/validators/functional/_isFormatIpv4.js.map +1 -0
- package/lib/validators/functional/_isFormatIpv4.mjs +5 -0
- package/lib/validators/functional/_isFormatIpv4.mjs.map +1 -0
- package/lib/validators/functional/_isFormatIpv6.d.ts +1 -0
- package/lib/validators/functional/_isFormatIpv6.js +7 -0
- package/lib/validators/functional/_isFormatIpv6.js.map +1 -0
- package/lib/validators/functional/_isFormatIpv6.mjs +5 -0
- package/lib/validators/functional/_isFormatIpv6.mjs.map +1 -0
- package/lib/validators/functional/_isFormatIri.d.ts +1 -0
- package/lib/validators/functional/_isFormatIri.js +7 -0
- package/lib/validators/functional/_isFormatIri.js.map +1 -0
- package/lib/validators/functional/_isFormatIri.mjs +5 -0
- package/lib/validators/functional/_isFormatIri.mjs.map +1 -0
- package/lib/validators/functional/_isFormatIriReference.d.ts +1 -0
- package/lib/validators/functional/_isFormatIriReference.js +7 -0
- package/lib/validators/functional/_isFormatIriReference.js.map +1 -0
- package/lib/validators/functional/_isFormatIriReference.mjs +5 -0
- package/lib/validators/functional/_isFormatIriReference.mjs.map +1 -0
- package/lib/validators/functional/_isFormatJsonPointer.d.ts +1 -0
- package/lib/validators/functional/_isFormatJsonPointer.js +7 -0
- package/lib/validators/functional/_isFormatJsonPointer.js.map +1 -0
- package/lib/validators/functional/_isFormatJsonPointer.mjs +5 -0
- package/lib/validators/functional/_isFormatJsonPointer.mjs.map +1 -0
- package/lib/validators/functional/_isFormatPassword.d.ts +1 -0
- package/lib/validators/functional/_isFormatPassword.js +6 -0
- package/lib/validators/functional/_isFormatPassword.js.map +1 -0
- package/lib/validators/functional/_isFormatPassword.mjs +4 -0
- package/lib/validators/functional/_isFormatPassword.mjs.map +1 -0
- package/lib/validators/functional/_isFormatRegex.d.ts +1 -0
- package/lib/validators/functional/_isFormatRegex.js +14 -0
- package/lib/validators/functional/_isFormatRegex.js.map +1 -0
- package/lib/validators/functional/_isFormatRegex.mjs +12 -0
- package/lib/validators/functional/_isFormatRegex.mjs.map +1 -0
- package/lib/validators/functional/_isFormatRelativeJsonPointer.d.ts +1 -0
- package/lib/validators/functional/_isFormatRelativeJsonPointer.js +7 -0
- package/lib/validators/functional/_isFormatRelativeJsonPointer.js.map +1 -0
- package/lib/validators/functional/_isFormatRelativeJsonPointer.mjs +5 -0
- package/lib/validators/functional/_isFormatRelativeJsonPointer.mjs.map +1 -0
- package/lib/validators/functional/_isFormatTime.d.ts +1 -0
- package/lib/validators/functional/_isFormatTime.js +7 -0
- package/lib/validators/functional/_isFormatTime.js.map +1 -0
- package/lib/validators/functional/_isFormatTime.mjs +5 -0
- package/lib/validators/functional/_isFormatTime.mjs.map +1 -0
- package/lib/validators/functional/_isFormatUri.d.ts +1 -0
- package/lib/validators/functional/_isFormatUri.js +8 -0
- package/lib/validators/functional/_isFormatUri.js.map +1 -0
- package/lib/validators/functional/_isFormatUri.mjs +6 -0
- package/lib/validators/functional/_isFormatUri.mjs.map +1 -0
- package/lib/validators/functional/_isFormatUriReference.d.ts +1 -0
- package/lib/validators/functional/_isFormatUriReference.js +7 -0
- package/lib/validators/functional/_isFormatUriReference.js.map +1 -0
- package/lib/validators/functional/_isFormatUriReference.mjs +5 -0
- package/lib/validators/functional/_isFormatUriReference.mjs.map +1 -0
- package/lib/validators/functional/_isFormatUriTemplate.d.ts +1 -0
- package/lib/validators/functional/_isFormatUriTemplate.js +7 -0
- package/lib/validators/functional/_isFormatUriTemplate.js.map +1 -0
- package/lib/validators/functional/_isFormatUriTemplate.mjs +5 -0
- package/lib/validators/functional/_isFormatUriTemplate.mjs.map +1 -0
- package/lib/validators/functional/_isFormatUrl.d.ts +1 -0
- package/lib/validators/functional/_isFormatUrl.js +7 -0
- package/lib/validators/functional/_isFormatUrl.js.map +1 -0
- package/lib/validators/functional/_isFormatUrl.mjs +5 -0
- package/lib/validators/functional/_isFormatUrl.mjs.map +1 -0
- package/lib/validators/functional/_isFormatUuid.d.ts +1 -0
- package/lib/validators/functional/_isFormatUuid.js +7 -0
- package/lib/validators/functional/_isFormatUuid.js.map +1 -0
- package/lib/validators/functional/_isFormatUuid.mjs +5 -0
- package/lib/validators/functional/_isFormatUuid.mjs.map +1 -0
- package/lib/validators/functional/_isUniqueItems.d.ts +1 -0
- package/lib/validators/functional/_isUniqueItems.js +140 -0
- package/lib/validators/functional/_isUniqueItems.js.map +1 -0
- package/lib/validators/functional/_isUniqueItems.mjs +138 -0
- package/lib/validators/functional/_isUniqueItems.mjs.map +1 -0
- package/lib/validators/index.d.ts +2 -0
- package/lib/validators/index.js +27 -0
- package/lib/validators/index.js.map +1 -0
- package/lib/validators/index.mjs +7 -0
- package/lib/validators/index.mjs.map +1 -0
- package/lib/validators/internal/IOpenApiValidatorContext.d.ts +14 -0
- package/lib/validators/internal/IOpenApiValidatorContext.js +3 -0
- package/lib/validators/internal/IOpenApiValidatorContext.js.map +1 -0
- package/lib/validators/internal/IOpenApiValidatorContext.mjs +2 -0
- package/lib/validators/internal/IOpenApiValidatorContext.mjs.map +1 -0
- package/lib/validators/internal/OpenApiArrayValidator.d.ts +5 -0
- package/lib/validators/internal/OpenApiArrayValidator.js +32 -0
- package/lib/validators/internal/OpenApiArrayValidator.js.map +1 -0
- package/lib/validators/internal/OpenApiArrayValidator.mjs +47 -0
- package/lib/validators/internal/OpenApiArrayValidator.mjs.map +1 -0
- package/lib/validators/internal/OpenApiBooleanValidator.d.ts +5 -0
- package/lib/validators/internal/OpenApiBooleanValidator.js +10 -0
- package/lib/validators/internal/OpenApiBooleanValidator.js.map +1 -0
- package/lib/validators/internal/OpenApiBooleanValidator.mjs +9 -0
- package/lib/validators/internal/OpenApiBooleanValidator.mjs.map +1 -0
- package/lib/validators/internal/OpenApiConstantValidator.d.ts +5 -0
- package/lib/validators/internal/OpenApiConstantValidator.js +10 -0
- package/lib/validators/internal/OpenApiConstantValidator.js.map +1 -0
- package/lib/validators/internal/OpenApiConstantValidator.mjs +9 -0
- package/lib/validators/internal/OpenApiConstantValidator.mjs.map +1 -0
- package/lib/validators/internal/OpenApiIntegerValidator.d.ts +5 -0
- package/lib/validators/internal/OpenApiIntegerValidator.js +33 -0
- package/lib/validators/internal/OpenApiIntegerValidator.js.map +1 -0
- package/lib/validators/internal/OpenApiIntegerValidator.mjs +47 -0
- package/lib/validators/internal/OpenApiIntegerValidator.mjs.map +1 -0
- package/lib/validators/internal/OpenApiNumberValidator.d.ts +5 -0
- package/lib/validators/internal/OpenApiNumberValidator.js +33 -0
- package/lib/validators/internal/OpenApiNumberValidator.js.map +1 -0
- package/lib/validators/internal/OpenApiNumberValidator.mjs +47 -0
- package/lib/validators/internal/OpenApiNumberValidator.mjs.map +1 -0
- package/lib/validators/internal/OpenApiObjectValidator.d.ts +5 -0
- package/lib/validators/internal/OpenApiObjectValidator.js +58 -0
- package/lib/validators/internal/OpenApiObjectValidator.js.map +1 -0
- package/lib/validators/internal/OpenApiObjectValidator.mjs +68 -0
- package/lib/validators/internal/OpenApiObjectValidator.mjs.map +1 -0
- package/lib/validators/internal/OpenApiOneOfValidator.d.ts +5 -0
- package/lib/validators/internal/OpenApiOneOfValidator.js +182 -0
- package/lib/validators/internal/OpenApiOneOfValidator.js.map +1 -0
- package/lib/validators/internal/OpenApiOneOfValidator.mjs +206 -0
- package/lib/validators/internal/OpenApiOneOfValidator.mjs.map +1 -0
- package/lib/validators/internal/OpenApiSchemaNamingRule.d.ts +4 -0
- package/lib/validators/internal/OpenApiSchemaNamingRule.js +122 -0
- package/lib/validators/internal/OpenApiSchemaNamingRule.js.map +1 -0
- package/lib/validators/internal/OpenApiSchemaNamingRule.mjs +121 -0
- package/lib/validators/internal/OpenApiSchemaNamingRule.mjs.map +1 -0
- package/lib/validators/internal/OpenApiStationValidator.d.ts +5 -0
- package/lib/validators/internal/OpenApiStationValidator.js +63 -0
- package/lib/validators/internal/OpenApiStationValidator.js.map +1 -0
- package/lib/validators/internal/OpenApiStationValidator.mjs +107 -0
- package/lib/validators/internal/OpenApiStationValidator.mjs.map +1 -0
- package/lib/validators/internal/OpenApiStringValidator.d.ts +5 -0
- package/lib/validators/internal/OpenApiStringValidator.js +73 -0
- package/lib/validators/internal/OpenApiStringValidator.js.map +1 -0
- package/lib/validators/internal/OpenApiStringValidator.mjs +85 -0
- package/lib/validators/internal/OpenApiStringValidator.mjs.map +1 -0
- package/lib/validators/internal/OpenApiTupleValidator.d.ts +5 -0
- package/lib/validators/internal/OpenApiTupleValidator.js +31 -0
- package/lib/validators/internal/OpenApiTupleValidator.js.map +1 -0
- package/lib/validators/internal/OpenApiTupleValidator.mjs +46 -0
- package/lib/validators/internal/OpenApiTupleValidator.mjs.map +1 -0
- package/package.json +91 -0
- package/src/converters/LlmSchemaConverter.ts +924 -0
- package/src/converters/OpenApiConverter.ts +285 -0
- package/src/converters/index.ts +5 -0
- package/src/converters/internal/LlmDescriptionInverter.ts +178 -0
- package/src/converters/internal/LlmParametersComposer.ts +52 -0
- package/src/converters/internal/OpenApiConstraintShifter.ts +154 -0
- package/src/converters/internal/OpenApiExclusiveEmender.ts +46 -0
- package/src/converters/internal/OpenApiV3Downgrader.ts +355 -0
- package/src/converters/internal/OpenApiV3Upgrader.ts +470 -0
- package/src/converters/internal/OpenApiV3_1Upgrader.ts +685 -0
- package/src/converters/internal/SwaggerV2Downgrader.ts +424 -0
- package/src/converters/internal/SwaggerV2Upgrader.ts +523 -0
- package/src/http/HttpError.ts +107 -0
- package/src/http/HttpLlm.ts +210 -0
- package/src/http/HttpMigration.ts +92 -0
- package/src/http/index.ts +3 -0
- package/src/http/internal/HttpLlmApplicationComposer.ts +308 -0
- package/src/http/internal/HttpLlmFunctionFetcher.ts +37 -0
- package/src/http/internal/HttpMigrateApplicationComposer.ts +56 -0
- package/src/http/internal/HttpMigrateRouteAccessor.ts +135 -0
- package/src/http/internal/HttpMigrateRouteComposer.ts +513 -0
- package/src/http/internal/HttpMigrateRouteFetcher.ts +203 -0
- package/src/http/internal/LlmDataMerger.ts +73 -0
- package/src/index.ts +4 -0
- package/src/utils/ArrayUtil.ts +42 -0
- package/src/utils/MapUtil.ts +15 -0
- package/src/utils/NamingConvention.ts +205 -0
- package/src/utils/Singleton.ts +17 -0
- package/src/utils/StringUtil.ts +14 -0
- package/src/utils/dedent.ts +57 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/internal/EndpointUtil.ts +44 -0
- package/src/utils/internal/JsonDescriptor.ts +70 -0
- package/src/utils/internal/OpenApiTypeCheckerBase.ts +822 -0
- package/src/utils/stringifyValidationFailure.ts +415 -0
- package/src/validators/LlmTypeChecker.ts +402 -0
- package/src/validators/OpenApiTypeChecker.ts +297 -0
- package/src/validators/OpenApiV3TypeChecker.ts +70 -0
- package/src/validators/OpenApiV3_1TypeChecker.ts +86 -0
- package/src/validators/OpenApiValidator.ts +94 -0
- package/src/validators/SwaggerV2TypeChecker.ts +71 -0
- package/src/validators/functional/_isBigintString.ts +8 -0
- package/src/validators/functional/_isFormatByte.ts +7 -0
- package/src/validators/functional/_isFormatDate.ts +3 -0
- package/src/validators/functional/_isFormatDateTime.ts +4 -0
- package/src/validators/functional/_isFormatDuration.ts +4 -0
- package/src/validators/functional/_isFormatEmail.ts +4 -0
- package/src/validators/functional/_isFormatHostname.ts +4 -0
- package/src/validators/functional/_isFormatIdnEmail.ts +4 -0
- package/src/validators/functional/_isFormatIdnHostname.ts +4 -0
- package/src/validators/functional/_isFormatIpv4.ts +4 -0
- package/src/validators/functional/_isFormatIpv6.ts +4 -0
- package/src/validators/functional/_isFormatIri.ts +3 -0
- package/src/validators/functional/_isFormatIriReference.ts +4 -0
- package/src/validators/functional/_isFormatJsonPointer.ts +3 -0
- package/src/validators/functional/_isFormatPassword.ts +1 -0
- package/src/validators/functional/_isFormatRegex.ts +8 -0
- package/src/validators/functional/_isFormatRelativeJsonPointer.ts +4 -0
- package/src/validators/functional/_isFormatTime.ts +4 -0
- package/src/validators/functional/_isFormatUri.ts +6 -0
- package/src/validators/functional/_isFormatUriReference.ts +5 -0
- package/src/validators/functional/_isFormatUriTemplate.ts +4 -0
- package/src/validators/functional/_isFormatUrl.ts +4 -0
- package/src/validators/functional/_isFormatUuid.ts +3 -0
- package/src/validators/functional/_isUniqueItems.ts +159 -0
- package/src/validators/index.ts +14 -0
- package/src/validators/internal/IOpenApiValidatorContext.ts +17 -0
- package/src/validators/internal/OpenApiArrayValidator.ts +49 -0
- package/src/validators/internal/OpenApiBooleanValidator.ts +11 -0
- package/src/validators/internal/OpenApiConstantValidator.ts +11 -0
- package/src/validators/internal/OpenApiIntegerValidator.ts +49 -0
- package/src/validators/internal/OpenApiNumberValidator.ts +48 -0
- package/src/validators/internal/OpenApiObjectValidator.ts +83 -0
- package/src/validators/internal/OpenApiOneOfValidator.ts +309 -0
- package/src/validators/internal/OpenApiSchemaNamingRule.ts +124 -0
- package/src/validators/internal/OpenApiStationValidator.ts +115 -0
- package/src/validators/internal/OpenApiStringValidator.ts +88 -0
- package/src/validators/internal/OpenApiTupleValidator.ts +55 -0
|
@@ -0,0 +1,652 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LlmSchemaConverter = void 0;
|
|
4
|
+
const NamingConvention_1 = require("../utils/NamingConvention");
|
|
5
|
+
const JsonDescriptor_1 = require("../utils/internal/JsonDescriptor");
|
|
6
|
+
const LlmTypeChecker_1 = require("../validators/LlmTypeChecker");
|
|
7
|
+
const OpenApiTypeChecker_1 = require("../validators/OpenApiTypeChecker");
|
|
8
|
+
const OpenApiValidator_1 = require("../validators/OpenApiValidator");
|
|
9
|
+
const LlmDescriptionInverter_1 = require("./internal/LlmDescriptionInverter");
|
|
10
|
+
const LlmParametersComposer_1 = require("./internal/LlmParametersComposer");
|
|
11
|
+
const OpenApiConstraintShifter_1 = require("./internal/OpenApiConstraintShifter");
|
|
12
|
+
/**
|
|
13
|
+
* OpenAPI to LLM schema converter.
|
|
14
|
+
*
|
|
15
|
+
* `LlmSchemaConverter` converts OpenAPI JSON schemas to LLM-compatible
|
|
16
|
+
* {@link ILlmSchema} format. LLMs don't fully support JSON Schema, so this
|
|
17
|
+
* simplifies schemas by removing unsupported features (tuples, `const`, mixed
|
|
18
|
+
* unions).
|
|
19
|
+
*
|
|
20
|
+
* Main functions:
|
|
21
|
+
*
|
|
22
|
+
* - {@link parameters}: Convert object schema to {@link ILlmSchema.IParameters}
|
|
23
|
+
* - {@link schema}: Convert any schema to {@link ILlmSchema}
|
|
24
|
+
* - {@link separate}: Split parameters into LLM-fillable vs human-required
|
|
25
|
+
* - {@link invert}: Extract constraints from description back to schema
|
|
26
|
+
*
|
|
27
|
+
* Configuration options ({@link ILlmSchema.IConfig}):
|
|
28
|
+
*
|
|
29
|
+
* - `reference`: Allow `$ref` references (reduces tokens but may confuse LLM)
|
|
30
|
+
* - `strict`: OpenAI structured output mode (all properties required)
|
|
31
|
+
*
|
|
32
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
33
|
+
*/
|
|
34
|
+
var LlmSchemaConverter;
|
|
35
|
+
(function (LlmSchemaConverter) {
|
|
36
|
+
/**
|
|
37
|
+
* Get configuration with defaults applied.
|
|
38
|
+
*
|
|
39
|
+
* @param config Partial configuration
|
|
40
|
+
* @returns Full configuration with defaults
|
|
41
|
+
*/
|
|
42
|
+
LlmSchemaConverter.getConfig = (config) => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
return ({
|
|
45
|
+
reference: (_a = config === null || config === void 0 ? void 0 : config.reference) !== null && _a !== void 0 ? _a : true,
|
|
46
|
+
strict: (_b = config === null || config === void 0 ? void 0 : config.strict) !== null && _b !== void 0 ? _b : false,
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
/* -----------------------------------------------------------
|
|
50
|
+
CONVERTERS
|
|
51
|
+
----------------------------------------------------------- */
|
|
52
|
+
/**
|
|
53
|
+
* Convert OpenAPI object schema to LLM parameters schema.
|
|
54
|
+
*
|
|
55
|
+
* @param props.config Conversion configuration
|
|
56
|
+
* @param props.components OpenAPI components for reference resolution
|
|
57
|
+
* @param props.schema Object or reference schema to convert
|
|
58
|
+
* @param props.accessor Error path accessor
|
|
59
|
+
* @param props.refAccessor Reference path accessor
|
|
60
|
+
* @returns Converted parameters or error
|
|
61
|
+
*/
|
|
62
|
+
LlmSchemaConverter.parameters = (props) => {
|
|
63
|
+
const config = LlmSchemaConverter.getConfig(props.config);
|
|
64
|
+
const entity = LlmParametersComposer_1.LlmParametersFinder.parameters(Object.assign(Object.assign({}, props), { method: "LlmSchemaConverter.parameters" }));
|
|
65
|
+
if (entity.success === false)
|
|
66
|
+
return entity;
|
|
67
|
+
const $defs = {};
|
|
68
|
+
const result = transform(Object.assign(Object.assign({}, props), { config,
|
|
69
|
+
$defs, schema: entity.value }));
|
|
70
|
+
if (result.success === false)
|
|
71
|
+
return result;
|
|
72
|
+
return {
|
|
73
|
+
success: true,
|
|
74
|
+
value: Object.assign(Object.assign({}, result.value), { additionalProperties: false, $defs, description: OpenApiTypeChecker_1.OpenApiTypeChecker.isReference(props.schema)
|
|
75
|
+
? JsonDescriptor_1.JsonDescriptor.cascade({
|
|
76
|
+
prefix: "#/components/schemas/",
|
|
77
|
+
components: props.components,
|
|
78
|
+
schema: Object.assign(Object.assign({}, props.schema), { description: result.value.description }),
|
|
79
|
+
escape: true,
|
|
80
|
+
})
|
|
81
|
+
: result.value.description }),
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Convert OpenAPI schema to LLM schema.
|
|
86
|
+
*
|
|
87
|
+
* @param props.config Conversion configuration
|
|
88
|
+
* @param props.components OpenAPI components for reference resolution
|
|
89
|
+
* @param props.$defs Definition store (mutated with referenced types)
|
|
90
|
+
* @param props.schema Schema to convert
|
|
91
|
+
* @param props.accessor Error path accessor
|
|
92
|
+
* @param props.refAccessor Reference path accessor
|
|
93
|
+
* @returns Converted schema or error
|
|
94
|
+
*/
|
|
95
|
+
LlmSchemaConverter.schema = (props) => transform({
|
|
96
|
+
config: LlmSchemaConverter.getConfig(props.config),
|
|
97
|
+
components: props.components,
|
|
98
|
+
$defs: props.$defs,
|
|
99
|
+
schema: props.schema,
|
|
100
|
+
accessor: props.accessor,
|
|
101
|
+
refAccessor: props.refAccessor,
|
|
102
|
+
});
|
|
103
|
+
const transform = (props) => {
|
|
104
|
+
var _a, _b;
|
|
105
|
+
// PREPARE ASSETS
|
|
106
|
+
const union = [];
|
|
107
|
+
const attribute = Object.assign({ title: props.schema.title, description: props.schema.description, deprecated: props.schema.deprecated, readOnly: props.schema.readOnly, writeOnly: props.schema.writeOnly, example: props.schema.example, examples: props.schema.examples }, Object.fromEntries(Object.entries(props.schema).filter(([key, value]) => key.startsWith("x-") && value !== undefined)));
|
|
108
|
+
// VALIDADTE SCHEMA
|
|
109
|
+
const reasons = [];
|
|
110
|
+
OpenApiTypeChecker_1.OpenApiTypeChecker.visit({
|
|
111
|
+
closure: (next, accessor) => {
|
|
112
|
+
var _a, _b;
|
|
113
|
+
if (props.config.strict === true) {
|
|
114
|
+
// STRICT MODE VALIDATION
|
|
115
|
+
reasons.push(...validateStrict(next, accessor));
|
|
116
|
+
}
|
|
117
|
+
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isTuple(next))
|
|
118
|
+
reasons.push({
|
|
119
|
+
accessor,
|
|
120
|
+
schema: next,
|
|
121
|
+
message: `LLM does not allow tuple type.`,
|
|
122
|
+
});
|
|
123
|
+
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isReference(next)) {
|
|
124
|
+
// UNABLE TO FIND MATCHED REFERENCE
|
|
125
|
+
const key = (_a = next.$ref.split("#/components/schemas/")[1]) !== null && _a !== void 0 ? _a : next.$ref.split("/").at(-1);
|
|
126
|
+
if (((_b = props.components.schemas) === null || _b === void 0 ? void 0 : _b[key]) === undefined)
|
|
127
|
+
reasons.push({
|
|
128
|
+
schema: next,
|
|
129
|
+
accessor: accessor,
|
|
130
|
+
message: `unable to find reference type ${JSON.stringify(key)}.`,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
components: props.components,
|
|
135
|
+
schema: props.schema,
|
|
136
|
+
accessor: props.accessor,
|
|
137
|
+
refAccessor: props.refAccessor,
|
|
138
|
+
});
|
|
139
|
+
if (reasons.length > 0)
|
|
140
|
+
return {
|
|
141
|
+
success: false,
|
|
142
|
+
error: {
|
|
143
|
+
method: "LlmSchemaConverter.schema",
|
|
144
|
+
message: "Failed to compose LLM schema",
|
|
145
|
+
reasons,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
const visitConstant = (input) => {
|
|
149
|
+
const insert = (value) => {
|
|
150
|
+
var _a;
|
|
151
|
+
const matched = union.find((u) => (u === null || u === void 0 ? void 0 : u.type) === typeof value);
|
|
152
|
+
if (matched !== undefined) {
|
|
153
|
+
(_a = matched.enum) !== null && _a !== void 0 ? _a : (matched.enum = []);
|
|
154
|
+
matched.enum.push(value);
|
|
155
|
+
}
|
|
156
|
+
else
|
|
157
|
+
union.push({
|
|
158
|
+
type: typeof value,
|
|
159
|
+
enum: [value],
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isConstant(input))
|
|
163
|
+
insert(input.const);
|
|
164
|
+
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isOneOf(input))
|
|
165
|
+
input.oneOf.forEach(visitConstant);
|
|
166
|
+
};
|
|
167
|
+
const visit = (input, accessor) => {
|
|
168
|
+
var _a, _b, _c, _d, _e;
|
|
169
|
+
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isOneOf(input)) {
|
|
170
|
+
// UNION TYPE
|
|
171
|
+
input.oneOf.forEach((s, i) => visit(s, `${accessor}.oneOf[${i}]`));
|
|
172
|
+
}
|
|
173
|
+
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isReference(input)) {
|
|
174
|
+
// REFERENCE TYPE
|
|
175
|
+
const key = (_a = input.$ref.split("#/components/schemas/")[1]) !== null && _a !== void 0 ? _a : input.$ref.split("/").at(-1);
|
|
176
|
+
const target = (_b = props.components.schemas) === null || _b === void 0 ? void 0 : _b[key];
|
|
177
|
+
if (target === undefined)
|
|
178
|
+
return;
|
|
179
|
+
else if (
|
|
180
|
+
// KEEP THE REFERENCE TYPE
|
|
181
|
+
props.config.reference === true ||
|
|
182
|
+
OpenApiTypeChecker_1.OpenApiTypeChecker.isRecursiveReference({
|
|
183
|
+
components: props.components,
|
|
184
|
+
schema: input,
|
|
185
|
+
})) {
|
|
186
|
+
const out = () => {
|
|
187
|
+
union.push(Object.assign(Object.assign({}, input), { $ref: `#/$defs/${key}` }));
|
|
188
|
+
};
|
|
189
|
+
if (props.$defs[key] !== undefined)
|
|
190
|
+
return out();
|
|
191
|
+
props.$defs[key] = {};
|
|
192
|
+
const converted = transform({
|
|
193
|
+
config: props.config,
|
|
194
|
+
components: props.components,
|
|
195
|
+
$defs: props.$defs,
|
|
196
|
+
schema: target,
|
|
197
|
+
refAccessor: props.refAccessor,
|
|
198
|
+
accessor: `${(_c = props.refAccessor) !== null && _c !== void 0 ? _c : "$def"}[${JSON.stringify(key)}]`,
|
|
199
|
+
});
|
|
200
|
+
if (converted.success === false)
|
|
201
|
+
return; // UNREACHABLE
|
|
202
|
+
props.$defs[key] = converted.value;
|
|
203
|
+
return out();
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
// DISCARD THE REFERENCE TYPE
|
|
207
|
+
const length = union.length;
|
|
208
|
+
visit(target, accessor);
|
|
209
|
+
visitConstant(target);
|
|
210
|
+
if (length === union.length - 1)
|
|
211
|
+
union[union.length - 1] = Object.assign(Object.assign({}, union[union.length - 1]), { description: JsonDescriptor_1.JsonDescriptor.cascade({
|
|
212
|
+
prefix: "#/components/schemas/",
|
|
213
|
+
components: props.components,
|
|
214
|
+
schema: input,
|
|
215
|
+
escape: true,
|
|
216
|
+
}) });
|
|
217
|
+
else
|
|
218
|
+
attribute.description = JsonDescriptor_1.JsonDescriptor.cascade({
|
|
219
|
+
prefix: "#/components/schemas/",
|
|
220
|
+
components: props.components,
|
|
221
|
+
schema: input,
|
|
222
|
+
escape: true,
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isObject(input)) {
|
|
227
|
+
// OBJECT TYPE
|
|
228
|
+
const properties = Object.fromEntries(Object.entries((_d = input.properties) !== null && _d !== void 0 ? _d : {})
|
|
229
|
+
.map(([key, value]) => {
|
|
230
|
+
var _a;
|
|
231
|
+
const converted = transform({
|
|
232
|
+
config: props.config,
|
|
233
|
+
components: props.components,
|
|
234
|
+
$defs: props.$defs,
|
|
235
|
+
schema: value,
|
|
236
|
+
refAccessor: props.refAccessor,
|
|
237
|
+
accessor: `${(_a = props.accessor) !== null && _a !== void 0 ? _a : "$input.schema"}.properties[${JSON.stringify(key)}]`,
|
|
238
|
+
});
|
|
239
|
+
if (converted.success === false) {
|
|
240
|
+
reasons.push(...converted.error.reasons);
|
|
241
|
+
return [key, null];
|
|
242
|
+
}
|
|
243
|
+
return [key, converted.value];
|
|
244
|
+
})
|
|
245
|
+
.filter(([, value]) => value !== null));
|
|
246
|
+
if (Object.values(properties).some((v) => v === null))
|
|
247
|
+
return;
|
|
248
|
+
const additionalProperties = (() => {
|
|
249
|
+
if (typeof input.additionalProperties === "object" &&
|
|
250
|
+
input.additionalProperties !== null) {
|
|
251
|
+
const converted = transform({
|
|
252
|
+
config: props.config,
|
|
253
|
+
components: props.components,
|
|
254
|
+
$defs: props.$defs,
|
|
255
|
+
schema: input.additionalProperties,
|
|
256
|
+
refAccessor: props.refAccessor,
|
|
257
|
+
accessor: `${accessor}.additionalProperties`,
|
|
258
|
+
});
|
|
259
|
+
if (converted.success === false) {
|
|
260
|
+
reasons.push(...converted.error.reasons);
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
return converted.value;
|
|
264
|
+
}
|
|
265
|
+
return props.config.strict === true
|
|
266
|
+
? false
|
|
267
|
+
: input.additionalProperties;
|
|
268
|
+
})();
|
|
269
|
+
if (additionalProperties === null)
|
|
270
|
+
return;
|
|
271
|
+
union.push(Object.assign(Object.assign({}, input), { properties,
|
|
272
|
+
additionalProperties, required: (_e = input.required) !== null && _e !== void 0 ? _e : [], description: props.config.strict === true
|
|
273
|
+
? JsonDescriptor_1.JsonDescriptor.take(input)
|
|
274
|
+
: input.description }));
|
|
275
|
+
}
|
|
276
|
+
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isArray(input)) {
|
|
277
|
+
// ARRAY TYPE
|
|
278
|
+
const items = transform({
|
|
279
|
+
config: props.config,
|
|
280
|
+
components: props.components,
|
|
281
|
+
$defs: props.$defs,
|
|
282
|
+
schema: input.items,
|
|
283
|
+
refAccessor: props.refAccessor,
|
|
284
|
+
accessor: `${accessor}.items`,
|
|
285
|
+
});
|
|
286
|
+
if (items.success === false) {
|
|
287
|
+
reasons.push(...items.error.reasons);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
union.push(props.config.strict === true
|
|
291
|
+
? OpenApiConstraintShifter_1.OpenApiConstraintShifter.shiftArray(Object.assign(Object.assign({}, input), { items: items.value }))
|
|
292
|
+
: Object.assign(Object.assign({}, input), { items: items.value }));
|
|
293
|
+
}
|
|
294
|
+
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isString(input))
|
|
295
|
+
union.push(props.config.strict === true
|
|
296
|
+
? OpenApiConstraintShifter_1.OpenApiConstraintShifter.shiftString(Object.assign({}, input))
|
|
297
|
+
: input);
|
|
298
|
+
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isNumber(input) ||
|
|
299
|
+
OpenApiTypeChecker_1.OpenApiTypeChecker.isInteger(input))
|
|
300
|
+
union.push(props.config.strict === true
|
|
301
|
+
? OpenApiConstraintShifter_1.OpenApiConstraintShifter.shiftNumeric(Object.assign({}, input))
|
|
302
|
+
: input);
|
|
303
|
+
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isTuple(input))
|
|
304
|
+
return; // UNREACHABLE
|
|
305
|
+
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isConstant(input) === false)
|
|
306
|
+
union.push(Object.assign({}, input));
|
|
307
|
+
};
|
|
308
|
+
visitConstant(props.schema);
|
|
309
|
+
visit(props.schema, (_a = props.accessor) !== null && _a !== void 0 ? _a : "$input.schema");
|
|
310
|
+
if (reasons.length > 0)
|
|
311
|
+
return {
|
|
312
|
+
success: false,
|
|
313
|
+
error: {
|
|
314
|
+
method: "LlmSchemaConverter.schema",
|
|
315
|
+
message: "Failed to compose LLM schema",
|
|
316
|
+
reasons,
|
|
317
|
+
},
|
|
318
|
+
};
|
|
319
|
+
else if (union.length === 0)
|
|
320
|
+
return {
|
|
321
|
+
// unknown type
|
|
322
|
+
success: true,
|
|
323
|
+
value: Object.assign(Object.assign({}, attribute), { type: undefined }),
|
|
324
|
+
};
|
|
325
|
+
else if (union.length === 1)
|
|
326
|
+
return {
|
|
327
|
+
// single type
|
|
328
|
+
success: true,
|
|
329
|
+
value: Object.assign(Object.assign(Object.assign({}, attribute), union[0]), { description: props.config.strict === true &&
|
|
330
|
+
LlmTypeChecker_1.LlmTypeChecker.isReference(union[0])
|
|
331
|
+
? undefined
|
|
332
|
+
: ((_b = union[0].description) !== null && _b !== void 0 ? _b : attribute.description) }),
|
|
333
|
+
};
|
|
334
|
+
return {
|
|
335
|
+
success: true,
|
|
336
|
+
value: Object.assign(Object.assign({}, attribute), { anyOf: union.map((u) => (Object.assign(Object.assign({}, u), { description: props.config.strict === true && LlmTypeChecker_1.LlmTypeChecker.isReference(u)
|
|
337
|
+
? undefined
|
|
338
|
+
: u.description }))), "x-discriminator": OpenApiTypeChecker_1.OpenApiTypeChecker.isOneOf(props.schema) &&
|
|
339
|
+
props.schema.discriminator !== undefined &&
|
|
340
|
+
props.schema.oneOf.length === union.length &&
|
|
341
|
+
union.every((e) => LlmTypeChecker_1.LlmTypeChecker.isReference(e) || LlmTypeChecker_1.LlmTypeChecker.isNull(e))
|
|
342
|
+
? {
|
|
343
|
+
propertyName: props.schema.discriminator.propertyName,
|
|
344
|
+
mapping: props.schema.discriminator.mapping !== undefined
|
|
345
|
+
? Object.fromEntries(Object.entries(props.schema.discriminator.mapping).map(([key, value]) => [
|
|
346
|
+
key,
|
|
347
|
+
`#/$defs/${value.split("/").at(-1)}`,
|
|
348
|
+
]))
|
|
349
|
+
: undefined,
|
|
350
|
+
}
|
|
351
|
+
: undefined }),
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
/* -----------------------------------------------------------
|
|
355
|
+
INVERTERS
|
|
356
|
+
----------------------------------------------------------- */
|
|
357
|
+
/**
|
|
358
|
+
* Convert LLM schema back to OpenAPI schema.
|
|
359
|
+
*
|
|
360
|
+
* Restores constraint information from description tags and converts `$defs`
|
|
361
|
+
* references to `#/components/schemas`.
|
|
362
|
+
*
|
|
363
|
+
* @param props.components Target components (mutated with definitions)
|
|
364
|
+
* @param props.schema LLM schema to invert
|
|
365
|
+
* @param props.$defs LLM schema definitions
|
|
366
|
+
* @returns OpenAPI JSON schema
|
|
367
|
+
*/
|
|
368
|
+
LlmSchemaConverter.invert = (props) => {
|
|
369
|
+
const union = [];
|
|
370
|
+
const attribute = Object.assign({ title: props.schema.title, description: props.schema.description, deprecated: props.schema.deprecated, readOnly: props.schema.readOnly, writeOnly: props.schema.writeOnly, example: props.schema.example, examples: props.schema.examples }, Object.fromEntries(Object.entries(props.schema).filter(([key, value]) => key.startsWith("x-") && value !== undefined)));
|
|
371
|
+
const next = (schema) => LlmSchemaConverter.invert({
|
|
372
|
+
components: props.components,
|
|
373
|
+
$defs: props.$defs,
|
|
374
|
+
schema,
|
|
375
|
+
});
|
|
376
|
+
const visit = (schema) => {
|
|
377
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
378
|
+
var _h;
|
|
379
|
+
if (LlmTypeChecker_1.LlmTypeChecker.isArray(schema))
|
|
380
|
+
union.push(Object.assign(Object.assign(Object.assign({}, schema), LlmDescriptionInverter_1.LlmDescriptionInverter.array(schema.description)), { items: next(schema.items) }));
|
|
381
|
+
else if (LlmTypeChecker_1.LlmTypeChecker.isObject(schema))
|
|
382
|
+
union.push(Object.assign(Object.assign({}, schema), { properties: Object.fromEntries(Object.entries(schema.properties).map(([key, value]) => [
|
|
383
|
+
key,
|
|
384
|
+
next(value),
|
|
385
|
+
])), additionalProperties: typeof schema.additionalProperties === "object" &&
|
|
386
|
+
schema.additionalProperties !== null
|
|
387
|
+
? next(schema.additionalProperties)
|
|
388
|
+
: schema.additionalProperties }));
|
|
389
|
+
else if (LlmTypeChecker_1.LlmTypeChecker.isAnyOf(schema))
|
|
390
|
+
schema.anyOf.forEach(visit);
|
|
391
|
+
else if (LlmTypeChecker_1.LlmTypeChecker.isReference(schema)) {
|
|
392
|
+
const key = (_a = schema.$ref.split("#/$defs/")[1]) !== null && _a !== void 0 ? _a : schema.$ref.split("/").at(-1);
|
|
393
|
+
if (((_b = props.components.schemas) === null || _b === void 0 ? void 0 : _b[key]) === undefined) {
|
|
394
|
+
(_c = (_h = props.components).schemas) !== null && _c !== void 0 ? _c : (_h.schemas = {});
|
|
395
|
+
props.components.schemas[key] = {};
|
|
396
|
+
props.components.schemas[key] = next((_d = props.$defs[key]) !== null && _d !== void 0 ? _d : {});
|
|
397
|
+
}
|
|
398
|
+
union.push(Object.assign(Object.assign({}, schema), { $ref: `#/components/schemas/${key}` }));
|
|
399
|
+
}
|
|
400
|
+
else if (LlmTypeChecker_1.LlmTypeChecker.isBoolean(schema))
|
|
401
|
+
if (!!((_e = schema.enum) === null || _e === void 0 ? void 0 : _e.length))
|
|
402
|
+
schema.enum.forEach((v) => union.push({
|
|
403
|
+
const: v,
|
|
404
|
+
}));
|
|
405
|
+
else
|
|
406
|
+
union.push(schema);
|
|
407
|
+
else if (LlmTypeChecker_1.LlmTypeChecker.isInteger(schema) ||
|
|
408
|
+
LlmTypeChecker_1.LlmTypeChecker.isNumber(schema))
|
|
409
|
+
if (!!((_f = schema.enum) === null || _f === void 0 ? void 0 : _f.length))
|
|
410
|
+
schema.enum.forEach((v) => union.push({
|
|
411
|
+
const: v,
|
|
412
|
+
}));
|
|
413
|
+
else
|
|
414
|
+
union.push(Object.assign(Object.assign(Object.assign({}, schema), LlmDescriptionInverter_1.LlmDescriptionInverter.numeric(schema.description)), { enum: undefined }));
|
|
415
|
+
else if (LlmTypeChecker_1.LlmTypeChecker.isString(schema))
|
|
416
|
+
if (!!((_g = schema.enum) === null || _g === void 0 ? void 0 : _g.length))
|
|
417
|
+
schema.enum.forEach((v) => union.push({
|
|
418
|
+
const: v,
|
|
419
|
+
}));
|
|
420
|
+
else
|
|
421
|
+
union.push(Object.assign(Object.assign(Object.assign({}, schema), LlmDescriptionInverter_1.LlmDescriptionInverter.string(schema.description)), { enum: undefined }));
|
|
422
|
+
else
|
|
423
|
+
union.push(Object.assign({}, schema));
|
|
424
|
+
};
|
|
425
|
+
visit(props.schema);
|
|
426
|
+
return Object.assign(Object.assign({}, attribute), (union.length === 0
|
|
427
|
+
? { type: undefined }
|
|
428
|
+
: union.length === 1
|
|
429
|
+
? Object.assign({}, union[0]) : {
|
|
430
|
+
oneOf: union.map((u) => (Object.assign(Object.assign({}, u), { nullable: undefined }))),
|
|
431
|
+
discriminator: LlmTypeChecker_1.LlmTypeChecker.isAnyOf(props.schema) &&
|
|
432
|
+
props.schema["x-discriminator"] !== undefined
|
|
433
|
+
? {
|
|
434
|
+
propertyName: props.schema["x-discriminator"].propertyName,
|
|
435
|
+
mapping: props.schema["x-discriminator"].mapping !== undefined
|
|
436
|
+
? Object.fromEntries(Object.entries(props.schema["x-discriminator"].mapping).map(([key, value]) => [
|
|
437
|
+
key,
|
|
438
|
+
`#/components/schemas/${value.split("/").at(-1)}`,
|
|
439
|
+
]))
|
|
440
|
+
: undefined,
|
|
441
|
+
}
|
|
442
|
+
: undefined,
|
|
443
|
+
}));
|
|
444
|
+
};
|
|
445
|
+
/* -----------------------------------------------------------
|
|
446
|
+
SEPARATORS
|
|
447
|
+
----------------------------------------------------------- */
|
|
448
|
+
/**
|
|
449
|
+
* Separate parameters into LLM and human parts.
|
|
450
|
+
*
|
|
451
|
+
* Splits parameters based on predicate (human-side if true). Creates separate
|
|
452
|
+
* schemas for LLM-fillable and human-required fields.
|
|
453
|
+
*
|
|
454
|
+
* @param props.parameters Parameters schema to separate
|
|
455
|
+
* @param props.predicate Returns true for human-side properties
|
|
456
|
+
* @param props.convention Key naming convention for separated types
|
|
457
|
+
* @param props.equals Whether to use strict equality validation
|
|
458
|
+
* @returns Separated LLM and human parameter schemas
|
|
459
|
+
*/
|
|
460
|
+
LlmSchemaConverter.separate = (props) => {
|
|
461
|
+
var _a, _b;
|
|
462
|
+
const convention = (_a = props.convention) !== null && _a !== void 0 ? _a : ((key, type) => `${key}.${NamingConvention_1.NamingConvention.capitalize(type)}`);
|
|
463
|
+
const [llm, human] = separateObject({
|
|
464
|
+
predicate: props.predicate,
|
|
465
|
+
convention,
|
|
466
|
+
$defs: props.parameters.$defs,
|
|
467
|
+
schema: props.parameters,
|
|
468
|
+
});
|
|
469
|
+
if (llm === null || human === null)
|
|
470
|
+
return {
|
|
471
|
+
llm: (_b = llm) !== null && _b !== void 0 ? _b : {
|
|
472
|
+
type: "object",
|
|
473
|
+
properties: {},
|
|
474
|
+
required: [],
|
|
475
|
+
additionalProperties: false,
|
|
476
|
+
$defs: {},
|
|
477
|
+
},
|
|
478
|
+
human: human,
|
|
479
|
+
};
|
|
480
|
+
const output = {
|
|
481
|
+
llm: Object.assign(Object.assign({}, llm), { $defs: Object.fromEntries(Object.entries(props.parameters.$defs).filter(([key]) => key.endsWith(".Llm"))), additionalProperties: false }),
|
|
482
|
+
human: Object.assign(Object.assign({}, human), { $defs: Object.fromEntries(Object.entries(props.parameters.$defs).filter(([key]) => key.endsWith(".Human"))), additionalProperties: false }),
|
|
483
|
+
};
|
|
484
|
+
for (const key of Object.keys(props.parameters.$defs))
|
|
485
|
+
if (key.endsWith(".Llm") === false && key.endsWith(".Human") === false)
|
|
486
|
+
delete props.parameters.$defs[key];
|
|
487
|
+
if (Object.keys(output.llm.properties).length !== 0) {
|
|
488
|
+
const components = {};
|
|
489
|
+
output.validate = OpenApiValidator_1.OpenApiValidator.create({
|
|
490
|
+
components,
|
|
491
|
+
schema: LlmSchemaConverter.invert({
|
|
492
|
+
components,
|
|
493
|
+
schema: output.llm,
|
|
494
|
+
$defs: output.llm.$defs,
|
|
495
|
+
}),
|
|
496
|
+
required: true,
|
|
497
|
+
equals: props.equals,
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
return output;
|
|
501
|
+
};
|
|
502
|
+
const separateStation = (props) => {
|
|
503
|
+
if (props.predicate(props.schema) === true)
|
|
504
|
+
return [null, props.schema];
|
|
505
|
+
else if (LlmTypeChecker_1.LlmTypeChecker.isUnknown(props.schema) ||
|
|
506
|
+
LlmTypeChecker_1.LlmTypeChecker.isAnyOf(props.schema))
|
|
507
|
+
return [props.schema, null];
|
|
508
|
+
else if (LlmTypeChecker_1.LlmTypeChecker.isObject(props.schema))
|
|
509
|
+
return separateObject({
|
|
510
|
+
predicate: props.predicate,
|
|
511
|
+
convention: props.convention,
|
|
512
|
+
$defs: props.$defs,
|
|
513
|
+
schema: props.schema,
|
|
514
|
+
});
|
|
515
|
+
else if (LlmTypeChecker_1.LlmTypeChecker.isArray(props.schema))
|
|
516
|
+
return separateArray({
|
|
517
|
+
predicate: props.predicate,
|
|
518
|
+
convention: props.convention,
|
|
519
|
+
$defs: props.$defs,
|
|
520
|
+
schema: props.schema,
|
|
521
|
+
});
|
|
522
|
+
else if (LlmTypeChecker_1.LlmTypeChecker.isReference(props.schema))
|
|
523
|
+
return separateReference({
|
|
524
|
+
predicate: props.predicate,
|
|
525
|
+
convention: props.convention,
|
|
526
|
+
$defs: props.$defs,
|
|
527
|
+
schema: props.schema,
|
|
528
|
+
});
|
|
529
|
+
return [props.schema, null];
|
|
530
|
+
};
|
|
531
|
+
const separateArray = (props) => {
|
|
532
|
+
const [x, y] = separateStation({
|
|
533
|
+
predicate: props.predicate,
|
|
534
|
+
convention: props.convention,
|
|
535
|
+
$defs: props.$defs,
|
|
536
|
+
schema: props.schema.items,
|
|
537
|
+
});
|
|
538
|
+
return [
|
|
539
|
+
x !== null
|
|
540
|
+
? Object.assign(Object.assign({}, props.schema), { items: x }) : null,
|
|
541
|
+
y !== null
|
|
542
|
+
? Object.assign(Object.assign({}, props.schema), { items: y }) : null,
|
|
543
|
+
];
|
|
544
|
+
};
|
|
545
|
+
const separateObject = (props) => {
|
|
546
|
+
var _a, _b;
|
|
547
|
+
// EMPTY OBJECT
|
|
548
|
+
if (Object.keys((_a = props.schema.properties) !== null && _a !== void 0 ? _a : {}).length === 0 &&
|
|
549
|
+
!!props.schema.additionalProperties === false)
|
|
550
|
+
return [props.schema, null];
|
|
551
|
+
const llm = Object.assign(Object.assign({}, props.schema), { properties: {}, additionalProperties: props.schema.additionalProperties });
|
|
552
|
+
const human = Object.assign(Object.assign({}, props.schema), { properties: {} });
|
|
553
|
+
for (const [key, value] of Object.entries((_b = props.schema.properties) !== null && _b !== void 0 ? _b : {})) {
|
|
554
|
+
const [x, y] = separateStation({
|
|
555
|
+
predicate: props.predicate,
|
|
556
|
+
convention: props.convention,
|
|
557
|
+
$defs: props.$defs,
|
|
558
|
+
schema: value,
|
|
559
|
+
});
|
|
560
|
+
if (x !== null)
|
|
561
|
+
llm.properties[key] = x;
|
|
562
|
+
if (y !== null)
|
|
563
|
+
human.properties[key] = y;
|
|
564
|
+
}
|
|
565
|
+
if (typeof props.schema.additionalProperties === "object" &&
|
|
566
|
+
props.schema.additionalProperties !== null) {
|
|
567
|
+
const [dx, dy] = separateStation({
|
|
568
|
+
predicate: props.predicate,
|
|
569
|
+
convention: props.convention,
|
|
570
|
+
$defs: props.$defs,
|
|
571
|
+
schema: props.schema.additionalProperties,
|
|
572
|
+
});
|
|
573
|
+
llm.additionalProperties = dx !== null && dx !== void 0 ? dx : false;
|
|
574
|
+
human.additionalProperties = dy !== null && dy !== void 0 ? dy : false;
|
|
575
|
+
}
|
|
576
|
+
return [
|
|
577
|
+
!!Object.keys(llm.properties).length || !!llm.additionalProperties
|
|
578
|
+
? shrinkRequired(llm)
|
|
579
|
+
: null,
|
|
580
|
+
!!Object.keys(human.properties).length || human.additionalProperties
|
|
581
|
+
? shrinkRequired(human)
|
|
582
|
+
: null,
|
|
583
|
+
];
|
|
584
|
+
};
|
|
585
|
+
const separateReference = (props) => {
|
|
586
|
+
var _a, _b, _c, _d, _e, _f;
|
|
587
|
+
const key = (_a = props.schema.$ref.split("#/$defs/")[1]) !== null && _a !== void 0 ? _a : props.schema.$ref.split("/").at(-1);
|
|
588
|
+
const humanKey = props.convention(key, "human");
|
|
589
|
+
const llmKey = props.convention(key, "llm");
|
|
590
|
+
// FIND EXISTING
|
|
591
|
+
if (((_b = props.$defs) === null || _b === void 0 ? void 0 : _b[humanKey]) || ((_c = props.$defs) === null || _c === void 0 ? void 0 : _c[llmKey]))
|
|
592
|
+
return [
|
|
593
|
+
((_d = props.$defs) === null || _d === void 0 ? void 0 : _d[llmKey])
|
|
594
|
+
? Object.assign(Object.assign({}, props.schema), { $ref: `#/$defs/${llmKey}` }) : null,
|
|
595
|
+
((_e = props.$defs) === null || _e === void 0 ? void 0 : _e[humanKey])
|
|
596
|
+
? Object.assign(Object.assign({}, props.schema), { $ref: `#/$defs/${humanKey}` }) : null,
|
|
597
|
+
];
|
|
598
|
+
// PRE-ASSIGNMENT
|
|
599
|
+
props.$defs[llmKey] = {};
|
|
600
|
+
props.$defs[humanKey] = {};
|
|
601
|
+
// DO COMPOSE
|
|
602
|
+
const schema = (_f = props.$defs) === null || _f === void 0 ? void 0 : _f[key];
|
|
603
|
+
const [llm, human] = separateStation({
|
|
604
|
+
predicate: props.predicate,
|
|
605
|
+
convention: props.convention,
|
|
606
|
+
$defs: props.$defs,
|
|
607
|
+
schema,
|
|
608
|
+
});
|
|
609
|
+
if (llm !== null)
|
|
610
|
+
Object.assign(props.$defs[llmKey], llm);
|
|
611
|
+
if (human !== null)
|
|
612
|
+
Object.assign(props.$defs[humanKey], human);
|
|
613
|
+
// ONLY ONE
|
|
614
|
+
if (llm === null || human === null) {
|
|
615
|
+
delete props.$defs[llmKey];
|
|
616
|
+
delete props.$defs[humanKey];
|
|
617
|
+
return llm === null ? [null, props.schema] : [props.schema, null];
|
|
618
|
+
}
|
|
619
|
+
// BOTH OF THEM
|
|
620
|
+
return [
|
|
621
|
+
llm !== null
|
|
622
|
+
? Object.assign(Object.assign({}, props.schema), { $ref: `#/$defs/${llmKey}` }) : null,
|
|
623
|
+
human !== null
|
|
624
|
+
? Object.assign(Object.assign({}, props.schema), { $ref: `#/$defs/${humanKey}` }) : null,
|
|
625
|
+
];
|
|
626
|
+
};
|
|
627
|
+
const shrinkRequired = (s) => {
|
|
628
|
+
s.required = s.required.filter((key) => { var _a; return ((_a = s.properties) === null || _a === void 0 ? void 0 : _a[key]) !== undefined; });
|
|
629
|
+
return s;
|
|
630
|
+
};
|
|
631
|
+
})(LlmSchemaConverter || (exports.LlmSchemaConverter = LlmSchemaConverter = {}));
|
|
632
|
+
const validateStrict = (schema, accessor) => {
|
|
633
|
+
var _a, _b;
|
|
634
|
+
const reasons = [];
|
|
635
|
+
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isObject(schema)) {
|
|
636
|
+
if (!!schema.additionalProperties)
|
|
637
|
+
reasons.push({
|
|
638
|
+
schema: schema,
|
|
639
|
+
accessor: `${accessor}.additionalProperties`,
|
|
640
|
+
message: "LLM does not allow additionalProperties in strict mode, the dynamic key typed object.",
|
|
641
|
+
});
|
|
642
|
+
for (const key of Object.keys((_a = schema.properties) !== null && _a !== void 0 ? _a : {}))
|
|
643
|
+
if (((_b = schema.required) === null || _b === void 0 ? void 0 : _b.includes(key)) === false)
|
|
644
|
+
reasons.push({
|
|
645
|
+
schema: schema,
|
|
646
|
+
accessor: `${accessor}.properties.${key}`,
|
|
647
|
+
message: "LLM does not allow optional properties in strict mode.",
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
return reasons;
|
|
651
|
+
};
|
|
652
|
+
//# sourceMappingURL=LlmSchemaConverter.js.map
|