@samchon/openapi
Advanced tools
Comparing version 2.0.0-dev.20241123-6 to 2.0.0-dev.20241124-2
@@ -41,2 +41,3 @@ "use strict"; | ||
var ChatGptConverter_1 = require("./ChatGptConverter"); | ||
var ClaudeConverter_1 = require("./ClaudeConverter"); | ||
var GeminiConverter_1 = require("./GeminiConverter"); | ||
@@ -211,6 +212,7 @@ var LlmConverterV3_2 = require("./LlmConverterV3"); | ||
var SEPARATORS = { | ||
chatgpt: ChatGptConverter_1.ChatGptConverter.separate, | ||
claude: ClaudeConverter_1.ClaudeConverter.separate, | ||
gemini: GeminiConverter_1.GeminiConverter.separate, | ||
"3.0": LlmConverterV3_2.LlmConverterV3.separate, | ||
"3.1": LlmConverterV3_1_1.LlmConverterV3_1.separate, | ||
chatgpt: ChatGptConverter_1.ChatGptConverter.separate, | ||
gemini: GeminiConverter_1.GeminiConverter.separate, | ||
}; |
@@ -68,3 +68,3 @@ "use strict"; | ||
var visit = function (input) { | ||
var _a; | ||
var _a, _b; | ||
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isOneOf(input)) { | ||
@@ -131,3 +131,3 @@ input.oneOf.forEach(visit); | ||
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isObject(input)) { | ||
var properties = Object.entries(input.properties || {}).reduce(function (acc, _a) { | ||
var properties = Object.entries((_b = input.properties) !== null && _b !== void 0 ? _b : {}).reduce(function (acc, _a) { | ||
var _b = __read(_a, 2), key = _b[0], value = _b[1]; | ||
@@ -134,0 +134,0 @@ var converted = LlmConverterV3_1.schema({ |
import { OpenApi } from "../OpenApi"; | ||
import { IChatGptSchema } from "../structures/IChatGptSchema"; | ||
import { IClaudeSchema } from "../structures/IClaudeSchema"; | ||
import { IGeminiSchema } from "../structures/IGeminiSchema"; | ||
@@ -9,7 +10,12 @@ import { ILlmApplication } from "../structures/ILlmApplication"; | ||
const parameters: <Model extends ILlmApplication.Model>(model: Model) => { | ||
"3.0": (props: { | ||
chatgpt: (props: { | ||
components: OpenApi.IComponents; | ||
schema: OpenApi.IJsonSchema.IObject; | ||
config: ILlmSchemaV3.IConfig; | ||
}) => ILlmSchemaV3.IParameters | null; | ||
config: IChatGptSchema.IConfig; | ||
}) => IChatGptSchema.IParameters | null; | ||
claude: (props: { | ||
components: OpenApi.IComponents; | ||
schema: OpenApi.IJsonSchema.IObject; | ||
config: IClaudeSchema.IConfig; | ||
}) => IClaudeSchema.IParameters | null; | ||
gemini: (props: { | ||
@@ -20,2 +26,7 @@ components: OpenApi.IComponents; | ||
}) => IGeminiSchema.IObject | null; | ||
"3.0": (props: { | ||
components: OpenApi.IComponents; | ||
schema: OpenApi.IJsonSchema.IObject; | ||
config: ILlmSchemaV3.IConfig; | ||
}) => ILlmSchemaV3.IParameters | null; | ||
"3.1": (props: { | ||
@@ -25,15 +36,17 @@ components: OpenApi.IComponents; | ||
config: ILlmSchemaV3_1.IConfig; | ||
}) => ILlmSchemaV3_1.IParameters | null; | ||
}) => IClaudeSchema.IParameters | null; | ||
}[Model]; | ||
const schema: <Model extends ILlmApplication.Model>(model: Model) => { | ||
chatgpt: (props: { | ||
components: OpenApi.IComponents; | ||
schema: OpenApi.IJsonSchema.IObject; | ||
schema: OpenApi.IJsonSchema; | ||
$defs: Record<string, IChatGptSchema>; | ||
config: IChatGptSchema.IConfig; | ||
}) => IChatGptSchema.IParameters | null; | ||
}[Model]; | ||
const schema: <Model extends ILlmApplication.Model>(model: Model) => { | ||
"3.0": (props: { | ||
}) => IChatGptSchema | null; | ||
claude: (props: { | ||
components: OpenApi.IComponents; | ||
schema: OpenApi.IJsonSchema; | ||
config: ILlmSchemaV3.IConfig; | ||
}) => ILlmSchemaV3 | null; | ||
$defs: Record<string, IClaudeSchema>; | ||
config: IClaudeSchema.IConfig; | ||
}) => IClaudeSchema | null; | ||
gemini: (props: { | ||
@@ -44,2 +57,7 @@ components: OpenApi.IComponents; | ||
}) => IGeminiSchema | null; | ||
"3.0": (props: { | ||
components: OpenApi.IComponents; | ||
schema: OpenApi.IJsonSchema; | ||
config: ILlmSchemaV3.IConfig; | ||
}) => ILlmSchemaV3 | null; | ||
"3.1": (props: { | ||
@@ -51,9 +69,23 @@ components: OpenApi.IComponents; | ||
}) => ILlmSchemaV3_1 | null; | ||
chatgpt: (props: { | ||
components: OpenApi.IComponents; | ||
schema: OpenApi.IJsonSchema; | ||
$defs: Record<string, IChatGptSchema>; | ||
config: IChatGptSchema.IConfig; | ||
}) => IChatGptSchema | null; | ||
}[Model]; | ||
const defaultConfig: <Model extends ILlmApplication.Model>(model: Model) => { | ||
chatgpt: { | ||
constraint: false; | ||
reference: false; | ||
}; | ||
claude: { | ||
reference: false; | ||
}; | ||
gemini: { | ||
recursive: number; | ||
}; | ||
"3.0": { | ||
constraint: false; | ||
recursive: number; | ||
}; | ||
"3.1": { | ||
constraint: false; | ||
reference: false; | ||
}; | ||
}[Model]; | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
var ChatGptConverter_1 = require("./ChatGptConverter"); | ||
var ClaudeConverter_1 = require("./ClaudeConverter"); | ||
var GeminiConverter_1 = require("./GeminiConverter"); | ||
@@ -15,20 +16,30 @@ var LlmConverterV3_2 = require("./LlmConverterV3"); | ||
}; | ||
LlmSchemaConverter.defaultConfig = function (model) { return DEFAULT_CONFIGS[model]; }; | ||
})(LlmSchemaConverter || (exports.LlmSchemaConverter = LlmSchemaConverter = {})); | ||
var PARAMETERS_CASTERS = { | ||
"3.0": function (props) { | ||
return LlmConverterV3_2.LlmConverterV3.parameters({ | ||
chatgpt: function (props) { return ChatGptConverter_1.ChatGptConverter.parameters(props); }, | ||
claude: function (props) { return ClaudeConverter_1.ClaudeConverter.parameters(props); }, | ||
gemini: function (props) { return GeminiConverter_1.GeminiConverter.parameters(props); }, | ||
"3.0": function (props) { return LlmConverterV3_2.LlmConverterV3.parameters(props); }, | ||
"3.1": function (props) { return LlmConverterV3_1_1.LlmConverterV3_1.parameters(props); }, | ||
}; | ||
var SCHEMA_CASTERS = { | ||
chatgpt: function (props) { | ||
return ChatGptConverter_1.ChatGptConverter.schema({ | ||
components: props.components, | ||
schema: props.schema, | ||
$defs: props.$defs, | ||
config: props.config, | ||
}); | ||
}, | ||
gemini: function (props) { | ||
return GeminiConverter_1.GeminiConverter.parameters({ | ||
claude: function (props) { | ||
return ClaudeConverter_1.ClaudeConverter.schema({ | ||
components: props.components, | ||
schema: props.schema, | ||
$defs: props.$defs, | ||
config: props.config, | ||
}); | ||
}, | ||
"3.1": function (props) { | ||
return LlmConverterV3_1_1.LlmConverterV3_1.parameters({ | ||
gemini: function (props) { | ||
return GeminiConverter_1.GeminiConverter.schema({ | ||
components: props.components, | ||
@@ -39,11 +50,2 @@ schema: props.schema, | ||
}, | ||
chatgpt: function (props) { | ||
return ChatGptConverter_1.ChatGptConverter.parameters({ | ||
components: props.components, | ||
schema: props.schema, | ||
config: props.config, | ||
}); | ||
}, | ||
}; | ||
var SCHEMA_CASTERS = { | ||
"3.0": function (props) { | ||
@@ -56,9 +58,2 @@ return LlmConverterV3_2.LlmConverterV3.schema({ | ||
}, | ||
gemini: function (props) { | ||
return GeminiConverter_1.GeminiConverter.schema({ | ||
components: props.components, | ||
schema: props.schema, | ||
config: props.config, | ||
}); | ||
}, | ||
"3.1": function (props) { | ||
@@ -72,10 +67,22 @@ return LlmConverterV3_1_1.LlmConverterV3_1.schema({ | ||
}, | ||
chatgpt: function (props) { | ||
return ChatGptConverter_1.ChatGptConverter.schema({ | ||
components: props.components, | ||
schema: props.schema, | ||
$defs: props.$defs, | ||
config: props.config, | ||
}); | ||
}; | ||
var DEFAULT_CONFIGS = { | ||
chatgpt: { | ||
constraint: false, | ||
reference: false, | ||
}, | ||
claude: { | ||
reference: false, | ||
}, | ||
gemini: { | ||
recursive: 3, | ||
}, | ||
"3.0": { | ||
constraint: false, | ||
recursive: 3, | ||
}, | ||
"3.1": { | ||
constraint: false, | ||
reference: false, | ||
}, | ||
}; |
@@ -165,3 +165,3 @@ "use strict"; | ||
.flat())), false)), | ||
required: __spreadArray([], __read(new Set(entire.map(function (o) { return o.required; }).flat())), false), | ||
required: __spreadArray([], __read(new Set(entire.map(function (o) { var _a; return (_a = o.required) !== null && _a !== void 0 ? _a : []; }).flat())), false), | ||
}, | ||
@@ -168,0 +168,0 @@ }), |
@@ -55,3 +55,3 @@ "use strict"; | ||
var _a; | ||
if (input["x-samchon-emend-version"] === "2.0") | ||
if (input["x-samchon-emend"] === true) | ||
return input; | ||
@@ -82,3 +82,3 @@ return __assign(__assign({}, input), { components: convertComponents((_a = input.components) !== null && _a !== void 0 ? _a : {}), paths: input.paths | ||
})) | ||
: undefined, "x-samchon-emend-version": "2.0" }); | ||
: undefined, "x-samchon-emend": true }); | ||
}; | ||
@@ -85,0 +85,0 @@ /* ----------------------------------------------------------- |
@@ -66,3 +66,3 @@ "use strict"; | ||
})) | ||
: undefined, openapi: "3.1.0", "x-samchon-emend-version": "2.0" })); | ||
: undefined, openapi: "3.1.0", "x-samchon-emend": true })); | ||
}; | ||
@@ -69,0 +69,0 @@ /* ----------------------------------------------------------- |
@@ -78,3 +78,3 @@ "use strict"; | ||
tags: input.tags, | ||
"x-samchon-emend-version": "2.0", | ||
"x-samchon-emend": true, | ||
}); }; | ||
@@ -81,0 +81,0 @@ /* ----------------------------------------------------------- |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -6,2 +17,3 @@ exports.HttpLlm = void 0; | ||
var HttpLlmConverter_1 = require("./converters/HttpLlmConverter"); | ||
var LlmSchemaConverter_1 = require("./converters/LlmSchemaConverter"); | ||
var HttpLlmFunctionFetcher_1 = require("./http/HttpLlmFunctionFetcher"); | ||
@@ -62,5 +74,5 @@ var LlmDataMerger_1 = require("./utils/LlmDataMerger"); | ||
HttpLlm.application = function (props) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; | ||
var _a, _b; | ||
// MIGRATE | ||
var migrate = props.document["x-samchon-emend-version"] === "2.0" | ||
var migrate = props.document["x-samchon-emend"] === true | ||
? HttpMigration_1.HttpMigration.application(props.document) | ||
@@ -71,12 +83,3 @@ : props.document; | ||
model: props.model, | ||
options: (props.model === "chatgpt" || props.model === "3.1" | ||
? { | ||
separate: (_b = (_a = props.options) === null || _a === void 0 ? void 0 : _a.separate) !== null && _b !== void 0 ? _b : null, | ||
reference: (_d = (_c = props.options) === null || _c === void 0 ? void 0 : _c.reference) !== null && _d !== void 0 ? _d : false, | ||
constraint: (_f = (_e = props.options) === null || _e === void 0 ? void 0 : _e.constraint) !== null && _f !== void 0 ? _f : false, | ||
} | ||
: { | ||
separate: (_h = (_g = props.options) === null || _g === void 0 ? void 0 : _g.separate) !== null && _h !== void 0 ? _h : null, | ||
recursive: (_k = (_j = props.options) === null || _j === void 0 ? void 0 : _j.recursive) !== null && _k !== void 0 ? _k : 3, | ||
}), | ||
options: __assign(__assign({}, LlmSchemaConverter_1.LlmSchemaConverter.defaultConfig(props.model)), { separate: (_b = (_a = props.options) === null || _a === void 0 ? void 0 : _a.separate) !== null && _b !== void 0 ? _b : null }), | ||
}); | ||
@@ -83,0 +86,0 @@ }; |
@@ -17,2 +17,3 @@ export * from "./OpenApi"; | ||
export * from "./structures/IChatGptSchema"; | ||
export * from "./structures/IClaudeSchema"; | ||
export * from "./structures/IGeminiSchema"; | ||
@@ -23,5 +24,6 @@ export * from "./structures/ILlmSchema"; | ||
export * from "./HttpLlm"; | ||
export * from "./utils/ChatGptTypeChecker"; | ||
export * from "./utils/ClaudeTypeChecker"; | ||
export * from "./utils/GeminiTypeChecker"; | ||
export * from "./utils/LlmTypeCheckerV3"; | ||
export * from "./utils/LlmTypeCheckerV3_1"; | ||
export * from "./utils/ChatGptTypeChecker"; | ||
export * from "./utils/GeminiTypeChecker"; |
@@ -42,2 +42,3 @@ "use strict"; | ||
__exportStar(require("./structures/IChatGptSchema"), exports); | ||
__exportStar(require("./structures/IClaudeSchema"), exports); | ||
__exportStar(require("./structures/IGeminiSchema"), exports); | ||
@@ -48,5 +49,6 @@ __exportStar(require("./structures/ILlmSchema"), exports); | ||
__exportStar(require("./HttpLlm"), exports); | ||
__exportStar(require("./utils/ChatGptTypeChecker"), exports); | ||
__exportStar(require("./utils/ClaudeTypeChecker"), exports); | ||
__exportStar(require("./utils/GeminiTypeChecker"), exports); | ||
__exportStar(require("./utils/LlmTypeCheckerV3"), exports); | ||
__exportStar(require("./utils/LlmTypeCheckerV3_1"), exports); | ||
__exportStar(require("./utils/ChatGptTypeChecker"), exports); | ||
__exportStar(require("./utils/GeminiTypeChecker"), exports); |
@@ -138,3 +138,3 @@ import { OpenApiV3 } from "./OpenApiV3"; | ||
*/ | ||
"x-samchon-emend-version": "2.0"; | ||
"x-samchon-emend": true; | ||
} | ||
@@ -739,3 +739,3 @@ namespace IDocument { | ||
*/ | ||
properties: Record<string, Schema>; | ||
properties?: Record<string, Schema>; | ||
/** | ||
@@ -789,3 +789,3 @@ * Additional properties' info. | ||
*/ | ||
required: string[]; | ||
required?: string[]; | ||
} | ||
@@ -792,0 +792,0 @@ /** |
@@ -56,6 +56,6 @@ /** | ||
* @reference https://platform.openai.com/docs/guides/structured-outputs | ||
* @warning Specified not by the official documentation, but by my experiments. | ||
* Therefore, its definitions can be inaccurate or be changed in the | ||
* future. If you find any wrong or outdated definitions, please let me | ||
* know by issue | ||
* @warning Specified not only by the official documentation, but also by my | ||
* experiments. Therefore, its definitions can be inaccurate or be | ||
* changed in the future. If you find any wrong or outdated definitions, | ||
* please let me know by issue. | ||
* @issue https://github.com/samchon/openapi/issues | ||
@@ -62,0 +62,0 @@ * @author Jeongho Nam - https://github.com/samchon |
@@ -52,6 +52,7 @@ /** | ||
* @reference https://ai.google.dev/gemini-api/docs/structured-output | ||
* @warning Specified not by the official documentation, but by my experiments. | ||
* Therefore, its definitions can be inaccurate or be changed in the | ||
* future. If you find any wrong or outdated definitions, please let me | ||
* know by issue | ||
* @warning Specified not only by the official documentation, but also by my | ||
* experiments. Therefore, its definitions can be inaccurate or be | ||
* changed in the future. If you find any wrong or outdated definitions, | ||
* please let me know by issue. | ||
* @issue https://github.com/samchon/openapi/issues | ||
* @author Jeongho Nam - https://github.com/samchon | ||
@@ -58,0 +59,0 @@ */ |
import { IChatGptSchema } from "./IChatGptSchema"; | ||
import { IClaudeSchema } from "./IClaudeSchema"; | ||
import { IGeminiSchema } from "./IGeminiSchema"; | ||
@@ -46,20 +47,23 @@ import { ILlmFunction } from "./ILlmFunction"; | ||
export declare namespace ILlmApplication { | ||
type Model = "3.0" | "3.1" | "chatgpt" | "gemini"; | ||
type Model = "chatgpt" | "claude" | "gemini" | "3.0" | "3.1"; | ||
type ModelParameters = { | ||
chatgpt: IChatGptSchema.IParameters; | ||
claude: IClaudeSchema.IParameters; | ||
gemini: IGeminiSchema.IParameters; | ||
"3.0": ILlmSchemaV3.IParameters; | ||
"3.1": ILlmSchemaV3_1.IParameters; | ||
chatgpt: IChatGptSchema.IParameters; | ||
gemini: IGeminiSchema.IParameters; | ||
}; | ||
type ModelSchema = { | ||
chatgpt: IChatGptSchema; | ||
claude: IClaudeSchema; | ||
gemini: IGeminiSchema; | ||
"3.0": ILlmSchemaV3; | ||
"3.1": ILlmSchemaV3_1; | ||
chatgpt: IChatGptSchema; | ||
gemini: IGeminiSchema; | ||
}; | ||
type ModelConfig = { | ||
chatgpt: IChatGptSchema.IConfig; | ||
claude: IClaudeSchema.IConfig; | ||
gemini: IGeminiSchema.IConfig; | ||
"3.0": ILlmSchemaV3.IConfig; | ||
"3.1": ILlmSchemaV3_1.IConfig; | ||
chatgpt: IChatGptSchema.IConfig; | ||
gemini: IGeminiSchema.IConfig; | ||
}; | ||
@@ -66,0 +70,0 @@ /** |
import { IChatGptSchema } from "./IChatGptSchema"; | ||
import { IClaudeSchema } from "./IClaudeSchema"; | ||
import { IGeminiSchema } from "./IGeminiSchema"; | ||
@@ -27,3 +28,3 @@ import { ILlmSchemaV3 } from "./ILlmSchemaV3"; | ||
*/ | ||
export interface ILlmFunction<Parameters extends ILlmSchemaV3.IParameters | ILlmSchemaV3_1.IParameters | IChatGptSchema.IParameters | IGeminiSchema.IParameters> { | ||
export interface ILlmFunction<Parameters extends IChatGptSchema.IParameters | IClaudeSchema.IParameters | IGeminiSchema.IParameters | ILlmSchemaV3.IParameters | ILlmSchemaV3_1.IParameters> { | ||
/** | ||
@@ -87,3 +88,3 @@ * Representative name of the function. | ||
*/ | ||
interface ISeparated<Parameters extends ILlmSchemaV3.IParameters | ILlmSchemaV3_1.IParameters | IChatGptSchema.IParameters | IGeminiSchema.IParameters> { | ||
interface ISeparated<Parameters extends IChatGptSchema.IParameters | IClaudeSchema.IParameters | IGeminiSchema.IParameters | ILlmSchemaV3.IParameters | ILlmSchemaV3_1.IParameters> { | ||
/** | ||
@@ -90,0 +91,0 @@ * Parameters that would be composed by the LLM. |
@@ -15,3 +15,2 @@ /** | ||
* - Resolve nullable property: {@link OpenApiV3_1.IJsonSchema.__ISignificant.nullable} | ||
* - Tuple type is banned: {@link OpenApiV3_1.IJsonSchema.ITuple.prefixItems} | ||
* - Constant type is banned: {@link OpenApiV3_1.IJsonSchema.IConstant} | ||
@@ -27,8 +26,9 @@ * - Merge {@link OpenApiV3_1.IJsonSchema.IAnyOf} to {@link ILlmSchemaV3_1.IOneOf} | ||
* - Do not support {@link OpenApi.IJsonSchema.ITuple} type | ||
* - {@link ILlmSchemaV3_1.additionalProperties} is fixed to `false` | ||
* - {@link ILlmSchemaV3_1.properties} and {@link ILlmSchemaV3_1.required} are always defined | ||
* | ||
* For reference, if you've composed the `ILlmSchemaV3_1` type with the | ||
* {@link ILlmSchemaV3_1.IConfig.reference} `false` option (default is `false`), | ||
* only the recursived named types would be archived into the | ||
* {@link ILlmSchemaV3_1.IParameters.$defs}, and the others would be ecaped from the | ||
* {@link ILlmSchemaV3_1.IReference} type. | ||
* {@link ILlmSchemaV3_1.IConfig.reference} `false` option (default is `false`), only the | ||
* recursived named types would be archived into the {@link ILlmSchemaV3_1.IParameters.$defs}, | ||
* and the others would be ecaped from the {@link ILlmSchemaV3_1.IReference} type. | ||
* | ||
@@ -57,3 +57,3 @@ * Also, if you've composed the `ILlmSchemaV3_1` type with the | ||
*/ | ||
export type ILlmSchemaV3_1 = ILlmSchemaV3_1.IBoolean | ILlmSchemaV3_1.IInteger | ILlmSchemaV3_1.INumber | ILlmSchemaV3_1.IString | ILlmSchemaV3_1.IArray | ILlmSchemaV3_1.IObject | ILlmSchemaV3_1.IOneOf | ILlmSchemaV3_1.IReference | ILlmSchemaV3_1.INull | ILlmSchemaV3_1.IUnknown; | ||
export type ILlmSchemaV3_1 = ILlmSchemaV3_1.IConstant | ILlmSchemaV3_1.IBoolean | ILlmSchemaV3_1.IInteger | ILlmSchemaV3_1.INumber | ILlmSchemaV3_1.IString | ILlmSchemaV3_1.IArray | ILlmSchemaV3_1.IObject | ILlmSchemaV3_1.IReference | ILlmSchemaV3_1.IOneOf | ILlmSchemaV3_1.INull | ILlmSchemaV3_1.IUnknown; | ||
export declare namespace ILlmSchemaV3_1 { | ||
@@ -60,0 +60,0 @@ /** |
@@ -189,3 +189,3 @@ "use strict"; | ||
var escapeSchema = function (props) { | ||
var _a, _b; | ||
var _a, _b, _c, _d; | ||
if (OpenApiTypeCheckerBase.isReference(props.schema)) { | ||
@@ -297,4 +297,5 @@ // REFERENCE | ||
else if (properties_1.some(function (_a) { | ||
var _b = __read(_a, 2), k = _b[0], v = _b[1]; | ||
return v === undefined && object_1.required.includes(k) === true; | ||
var _b; | ||
var _c = __read(_a, 2), k = _c[0], v = _c[1]; | ||
return v === undefined && ((_b = object_1.required) === null || _b === void 0 ? void 0 : _b.includes(k)) === true; | ||
}) === true) | ||
@@ -305,3 +306,3 @@ return undefined; | ||
return v !== undefined; | ||
})), additionalProperties: additionalProperties !== null && additionalProperties !== void 0 ? additionalProperties : false, required: object_1.required.filter(function (k) { | ||
})), additionalProperties: additionalProperties !== null && additionalProperties !== void 0 ? additionalProperties : false, required: (_d = (_c = object_1.required) === null || _c === void 0 ? void 0 : _c.filter(function (k) { | ||
return properties_1.some(function (_a) { | ||
@@ -311,3 +312,3 @@ var _b = __read(_a, 2), key = _b[0], value = _b[1]; | ||
}); | ||
}) }); | ||
})) !== null && _d !== void 0 ? _d : [] }); | ||
} | ||
@@ -504,9 +505,9 @@ else if (OpenApiTypeCheckerBase.isTuple(props.schema)) { | ||
return Object.entries((_a = p.y.properties) !== null && _a !== void 0 ? _a : {}).every(function (_a) { | ||
var _b; | ||
var _c = __read(_a, 2), key = _c[0], b = _c[1]; | ||
var _b, _c, _d, _e; | ||
var _f = __read(_a, 2), key = _f[0], b = _f[1]; | ||
var a = (_b = p.x.properties) === null || _b === void 0 ? void 0 : _b[key]; | ||
if (a === undefined) | ||
return false; | ||
else if (p.x.required.includes(key) === true && | ||
p.y.required.includes(key) === false) | ||
else if (((_c = p.x.required) === null || _c === void 0 ? void 0 : _c.includes(key)) === true && | ||
((_e = (_d = p.y.required) === null || _d === void 0 ? void 0 : _d.includes(key)) !== null && _e !== void 0 ? _e : false) === false) | ||
return false; | ||
@@ -513,0 +514,0 @@ return coverStation({ |
@@ -18,7 +18,7 @@ import { ILlmSchemaV3_1 } from "../structures/ILlmSchemaV3_1"; | ||
}) => boolean; | ||
const escape: (props: { | ||
const covers: (props: { | ||
$defs?: Record<string, ILlmSchemaV3_1>; | ||
schema: ILlmSchemaV3_1; | ||
recursive: false | number; | ||
}) => ILlmSchemaV3_1 | null; | ||
x: ILlmSchemaV3_1; | ||
y: ILlmSchemaV3_1; | ||
}) => boolean; | ||
const visit: (props: { | ||
@@ -29,7 +29,2 @@ closure: (schema: ILlmSchemaV3_1) => void; | ||
}) => void; | ||
const covers: (props: { | ||
$defs?: Record<string, ILlmSchemaV3_1>; | ||
x: ILlmSchemaV3_1; | ||
y: ILlmSchemaV3_1; | ||
}) => boolean; | ||
} |
@@ -49,4 +49,4 @@ "use strict"; | ||
----------------------------------------------------------- */ | ||
LlmTypeCheckerV3_1.escape = function (props) { | ||
return OpenApiTypeCheckerBase_1.OpenApiTypeCheckerBase.escape({ | ||
LlmTypeCheckerV3_1.covers = function (props) { | ||
return OpenApiTypeCheckerBase_1.OpenApiTypeCheckerBase.covers({ | ||
prefix: "#/$defs/", | ||
@@ -56,4 +56,4 @@ components: { | ||
}, | ||
schema: props.schema, | ||
recursive: props.recursive, | ||
x: props.x, | ||
y: props.y, | ||
}); | ||
@@ -64,19 +64,9 @@ }; | ||
prefix: "#/$defs/", | ||
closure: props.closure, | ||
components: { | ||
schemas: props.$defs, | ||
}, | ||
closure: props.closure, | ||
schema: props.schema, | ||
}); | ||
}; | ||
LlmTypeCheckerV3_1.covers = function (props) { | ||
return OpenApiTypeCheckerBase_1.OpenApiTypeCheckerBase.covers({ | ||
prefix: "#/$defs/", | ||
components: { | ||
schemas: props.$defs, | ||
}, | ||
x: props.x, | ||
y: props.y, | ||
}); | ||
}; | ||
})(LlmTypeCheckerV3_1 || (exports.LlmTypeCheckerV3_1 = LlmTypeCheckerV3_1 = {})); |
{ | ||
"name": "@samchon/openapi", | ||
"version": "2.0.0-dev.20241123-6", | ||
"version": "2.0.0-dev.20241124-2", | ||
"description": "OpenAPI definitions and converters for 'typia' and 'nestia'.", | ||
@@ -35,2 +35,3 @@ "main": "./lib/index.js", | ||
"devDependencies": { | ||
"@anthropic-ai/sdk": "^0.32.1", | ||
"@google/generative-ai": "^0.21.0", | ||
@@ -37,0 +38,0 @@ "@nestia/core": "4.0.0-dev.20241116", |
@@ -46,3 +46,3 @@ > ## Next version is coming. | ||
- ✔️[`IChatGptSchema`](https://github.com/samchon/openapi/blob/master/src/structures/IChatGptSchema.ts): OpenAI ChatGPT | ||
- ✍️`IClaudeSchema`: Anthropic Claude | ||
- ✔️[`IClaudeSchema`](https://github.com/samchon/openapi/blob/master/src/structures/IClaudeSchema.ts): Anthropic Claude (same with [`ILlmSchemaV3_1`](https://github.com/samchon/openapi/blob/master/src/structures/ILlmSchemaV3_1.ts)) | ||
- ✔️[`IGeminiSchema`](https://github.com/samchon/openapi/blob/master/src/structures/IGeminiSchema.ts): Google Gemini | ||
@@ -247,2 +247,3 @@ - ✍️`ILlamaSchema`: Meta (Facebook) Llama | ||
- [`ChatGptTypeChecker`](https://github.com/samchon/openapi/blob/master/src/utils/ChatGptTypeChecker.ts) | ||
- [`ClaudeTypeChecker`](https://github.com/samchon/openapi/blob/master/src/utils/ClaudeTypeChecker.ts) | ||
- [`GeminiTypeChecker`](https://github.com/samchon/openapi/blob/master/src/utils/GeminiTypeChecker.ts) | ||
@@ -249,0 +250,0 @@ - [`LlmTypeCheckerV3`](https://github.com/samchon/openapi/blob/master/src/utils/LlmTypeCheckerV3.ts) |
@@ -8,2 +8,3 @@ import { OpenApi } from "../OpenApi"; | ||
import { ChatGptConverter } from "./ChatGptConverter"; | ||
import { ClaudeConverter } from "./ClaudeConverter"; | ||
import { GeminiConverter } from "./GeminiConverter"; | ||
@@ -238,6 +239,7 @@ import { LlmConverterV3 } from "./LlmConverterV3"; | ||
const SEPARATORS = { | ||
chatgpt: ChatGptConverter.separate, | ||
claude: ClaudeConverter.separate, | ||
gemini: GeminiConverter.separate, | ||
"3.0": LlmConverterV3.separate, | ||
"3.1": LlmConverterV3_1.separate, | ||
chatgpt: ChatGptConverter.separate, | ||
gemini: GeminiConverter.separate, | ||
}; |
@@ -111,3 +111,3 @@ import { OpenApi } from "../OpenApi"; | ||
const properties: Record<string, ILlmSchemaV3_1 | null> = | ||
Object.entries(input.properties || {}).reduce( | ||
Object.entries(input.properties ?? {}).reduce( | ||
(acc, [key, value]) => { | ||
@@ -114,0 +114,0 @@ const converted: ILlmSchemaV3_1 | null = schema({ |
import { OpenApi } from "../OpenApi"; | ||
import { IChatGptSchema } from "../structures/IChatGptSchema"; | ||
import { IClaudeSchema } from "../structures/IClaudeSchema"; | ||
import { IGeminiSchema } from "../structures/IGeminiSchema"; | ||
@@ -8,2 +9,3 @@ import { ILlmApplication } from "../structures/ILlmApplication"; | ||
import { ChatGptConverter } from "./ChatGptConverter"; | ||
import { ClaudeConverter } from "./ClaudeConverter"; | ||
import { GeminiConverter } from "./GeminiConverter"; | ||
@@ -20,15 +22,19 @@ import { LlmConverterV3 } from "./LlmConverterV3"; | ||
SCHEMA_CASTERS[model]; | ||
export const defaultConfig = <Model extends ILlmApplication.Model>( | ||
model: Model, | ||
) => DEFAULT_CONFIGS[model]; | ||
} | ||
const PARAMETERS_CASTERS = { | ||
"3.0": (props: { | ||
chatgpt: (props: { | ||
components: OpenApi.IComponents; | ||
schema: OpenApi.IJsonSchema.IObject; | ||
config: ILlmSchemaV3.IConfig; | ||
}) => | ||
LlmConverterV3.parameters({ | ||
components: props.components, | ||
schema: props.schema, | ||
config: props.config, | ||
}), | ||
config: IChatGptSchema.IConfig; | ||
}) => ChatGptConverter.parameters(props), | ||
claude: (props: { | ||
components: OpenApi.IComponents; | ||
schema: OpenApi.IJsonSchema.IObject; | ||
config: IClaudeSchema.IConfig; | ||
}) => ClaudeConverter.parameters(props), | ||
gemini: (props: { | ||
@@ -38,8 +44,8 @@ components: OpenApi.IComponents; | ||
config: IGeminiSchema.IConfig; | ||
}) => | ||
GeminiConverter.parameters({ | ||
components: props.components, | ||
schema: props.schema, | ||
config: props.config, | ||
}), | ||
}) => GeminiConverter.parameters(props), | ||
"3.0": (props: { | ||
components: OpenApi.IComponents; | ||
schema: OpenApi.IJsonSchema.IObject; | ||
config: ILlmSchemaV3.IConfig; | ||
}) => LlmConverterV3.parameters(props), | ||
"3.1": (props: { | ||
@@ -49,29 +55,28 @@ components: OpenApi.IComponents; | ||
config: ILlmSchemaV3_1.IConfig; | ||
}) => | ||
LlmConverterV3_1.parameters({ | ||
components: props.components, | ||
schema: props.schema, | ||
config: props.config, | ||
}), | ||
}) => LlmConverterV3_1.parameters(props), | ||
}; | ||
const SCHEMA_CASTERS = { | ||
chatgpt: (props: { | ||
components: OpenApi.IComponents; | ||
schema: OpenApi.IJsonSchema.IObject; | ||
schema: OpenApi.IJsonSchema; | ||
$defs: Record<string, IChatGptSchema>; | ||
config: IChatGptSchema.IConfig; | ||
}) => | ||
ChatGptConverter.parameters({ | ||
ChatGptConverter.schema({ | ||
components: props.components, | ||
schema: props.schema, | ||
$defs: props.$defs, | ||
config: props.config, | ||
}), | ||
}; | ||
const SCHEMA_CASTERS = { | ||
"3.0": (props: { | ||
claude: (props: { | ||
components: OpenApi.IComponents; | ||
schema: OpenApi.IJsonSchema; | ||
config: ILlmSchemaV3.IConfig; | ||
$defs: Record<string, IClaudeSchema>; | ||
config: IClaudeSchema.IConfig; | ||
}) => | ||
LlmConverterV3.schema({ | ||
ClaudeConverter.schema({ | ||
components: props.components, | ||
schema: props.schema, | ||
$defs: props.$defs, | ||
config: props.config, | ||
@@ -89,2 +94,12 @@ }), | ||
}), | ||
"3.0": (props: { | ||
components: OpenApi.IComponents; | ||
schema: OpenApi.IJsonSchema; | ||
config: ILlmSchemaV3.IConfig; | ||
}) => | ||
LlmConverterV3.schema({ | ||
components: props.components, | ||
schema: props.schema, | ||
config: props.config, | ||
}), | ||
"3.1": (props: { | ||
@@ -102,14 +117,23 @@ components: OpenApi.IComponents; | ||
}), | ||
chatgpt: (props: { | ||
components: OpenApi.IComponents; | ||
schema: OpenApi.IJsonSchema; | ||
$defs: Record<string, IChatGptSchema>; | ||
config: IChatGptSchema.IConfig; | ||
}) => | ||
ChatGptConverter.schema({ | ||
components: props.components, | ||
schema: props.schema, | ||
$defs: props.$defs, | ||
config: props.config, | ||
}), | ||
}; | ||
const DEFAULT_CONFIGS = { | ||
chatgpt: { | ||
constraint: false, | ||
reference: false, | ||
} satisfies IChatGptSchema.IConfig, | ||
claude: { | ||
reference: false, | ||
} satisfies IClaudeSchema.IConfig, | ||
gemini: { | ||
recursive: 3, | ||
} satisfies IGeminiSchema.IConfig, | ||
"3.0": { | ||
constraint: false, | ||
recursive: 3, | ||
} satisfies ILlmSchemaV3.IConfig, | ||
"3.1": { | ||
constraint: false, | ||
reference: false, | ||
} satisfies ILlmSchemaV3_1.IConfig, | ||
}; |
@@ -178,3 +178,5 @@ import { OpenApi } from "../OpenApi"; | ||
]), | ||
required: [...new Set(entire.map((o) => o.required).flat())], | ||
required: [ | ||
...new Set(entire.map((o) => o.required ?? []).flat()), | ||
], | ||
}, | ||
@@ -181,0 +183,0 @@ }), |
@@ -6,3 +6,3 @@ import { OpenApi } from "../OpenApi"; | ||
export const convert = (input: OpenApiV3_1.IDocument): OpenApi.IDocument => { | ||
if ((input as OpenApi.IDocument)["x-samchon-emend-version"] === "2.0") | ||
if ((input as OpenApi.IDocument)["x-samchon-emend"] === true) | ||
return input as OpenApi.IDocument; | ||
@@ -32,3 +32,3 @@ return { | ||
: undefined, | ||
"x-samchon-emend-version": "2.0", | ||
"x-samchon-emend": true, | ||
}; | ||
@@ -35,0 +35,0 @@ }; |
@@ -19,3 +19,3 @@ import { OpenApi } from "../OpenApi"; | ||
openapi: "3.1.0", | ||
"x-samchon-emend-version": "2.0", | ||
"x-samchon-emend": true, | ||
}); | ||
@@ -22,0 +22,0 @@ |
@@ -28,3 +28,3 @@ import { OpenApi } from "../OpenApi"; | ||
tags: input.tags, | ||
"x-samchon-emend-version": "2.0", | ||
"x-samchon-emend": true, | ||
}); | ||
@@ -31,0 +31,0 @@ |
import { HttpMigration } from "./HttpMigration"; | ||
import { OpenApi } from "./OpenApi"; | ||
import { HttpLlmConverter } from "./converters/HttpLlmConverter"; | ||
import { LlmSchemaConverter } from "./converters/LlmSchemaConverter"; | ||
import { HttpLlmFunctionFetcher } from "./http/HttpLlmFunctionFetcher"; | ||
@@ -90,3 +91,3 @@ import { IChatGptSchema } from "./structures/IChatGptSchema"; | ||
const migrate: IHttpMigrateApplication = | ||
(props.document as OpenApi.IDocument)["x-samchon-emend-version"] === "2.0" | ||
(props.document as OpenApi.IDocument)["x-samchon-emend"] === true | ||
? HttpMigration.application(props.document as OpenApi.IDocument) | ||
@@ -97,24 +98,6 @@ : (props.document as IHttpMigrateApplication); | ||
model: props.model, | ||
options: (props.model === "chatgpt" || props.model === "3.1" | ||
? ({ | ||
separate: | ||
(props.options | ||
?.separate as IHttpLlmApplication.IOptions<any>["separate"]) ?? | ||
null, | ||
reference: | ||
(props.options as IHttpLlmApplication.IOptions<any> | undefined) | ||
?.reference ?? false, | ||
constraint: | ||
(props.options as IHttpLlmApplication.IOptions<any> | undefined) | ||
?.constraint ?? false, | ||
} satisfies IHttpLlmApplication.IOptions<any>) | ||
: ({ | ||
separate: | ||
(props.options | ||
?.separate as IHttpLlmApplication.IOptions<any>["separate"]) ?? | ||
null, | ||
recursive: | ||
(props.options as IHttpLlmApplication.IOptions<any> | undefined) | ||
?.recursive ?? 3, | ||
} satisfies IHttpLlmApplication.IOptions<any>)) as IHttpLlmApplication.IOptions<any>, | ||
options: { | ||
...LlmSchemaConverter.defaultConfig(props.model), | ||
separate: props.options?.separate ?? null, | ||
}, | ||
}); | ||
@@ -121,0 +104,0 @@ }; |
@@ -32,2 +32,3 @@ //---- | ||
export * from "./structures/IChatGptSchema"; | ||
export * from "./structures/IClaudeSchema"; | ||
export * from "./structures/IGeminiSchema"; | ||
@@ -39,5 +40,6 @@ export * from "./structures/ILlmSchema"; | ||
export * from "./HttpLlm"; | ||
export * from "./utils/ChatGptTypeChecker"; | ||
export * from "./utils/ClaudeTypeChecker"; | ||
export * from "./utils/GeminiTypeChecker"; | ||
export * from "./utils/LlmTypeCheckerV3"; | ||
export * from "./utils/LlmTypeCheckerV3_1"; | ||
export * from "./utils/ChatGptTypeChecker"; | ||
export * from "./utils/GeminiTypeChecker"; |
@@ -217,3 +217,3 @@ import { OpenApiV3 } from "./OpenApiV3"; | ||
*/ | ||
"x-samchon-emend-version": "2.0"; | ||
"x-samchon-emend": true; | ||
} | ||
@@ -949,3 +949,3 @@ export namespace IDocument { | ||
*/ | ||
properties: Record<string, Schema>; | ||
properties?: Record<string, Schema>; | ||
@@ -1001,3 +1001,3 @@ /** | ||
*/ | ||
required: string[]; | ||
required?: string[]; | ||
} | ||
@@ -1004,0 +1004,0 @@ |
@@ -56,6 +56,6 @@ /** | ||
* @reference https://platform.openai.com/docs/guides/structured-outputs | ||
* @warning Specified not by the official documentation, but by my experiments. | ||
* Therefore, its definitions can be inaccurate or be changed in the | ||
* future. If you find any wrong or outdated definitions, please let me | ||
* know by issue | ||
* @warning Specified not only by the official documentation, but also by my | ||
* experiments. Therefore, its definitions can be inaccurate or be | ||
* changed in the future. If you find any wrong or outdated definitions, | ||
* please let me know by issue. | ||
* @issue https://github.com/samchon/openapi/issues | ||
@@ -62,0 +62,0 @@ * @author Jeongho Nam - https://github.com/samchon |
@@ -52,6 +52,7 @@ /** | ||
* @reference https://ai.google.dev/gemini-api/docs/structured-output | ||
* @warning Specified not by the official documentation, but by my experiments. | ||
* Therefore, its definitions can be inaccurate or be changed in the | ||
* future. If you find any wrong or outdated definitions, please let me | ||
* know by issue | ||
* @warning Specified not only by the official documentation, but also by my | ||
* experiments. Therefore, its definitions can be inaccurate or be | ||
* changed in the future. If you find any wrong or outdated definitions, | ||
* please let me know by issue. | ||
* @issue https://github.com/samchon/openapi/issues | ||
* @author Jeongho Nam - https://github.com/samchon | ||
@@ -58,0 +59,0 @@ */ |
import { IChatGptSchema } from "./IChatGptSchema"; | ||
import { IClaudeSchema } from "./IClaudeSchema"; | ||
import { IGeminiSchema } from "./IGeminiSchema"; | ||
@@ -58,20 +59,23 @@ import { ILlmFunction } from "./ILlmFunction"; | ||
export namespace ILlmApplication { | ||
export type Model = "3.0" | "3.1" | "chatgpt" | "gemini"; | ||
export type Model = "chatgpt" | "claude" | "gemini" | "3.0" | "3.1"; | ||
export type ModelParameters = { | ||
chatgpt: IChatGptSchema.IParameters; | ||
claude: IClaudeSchema.IParameters; | ||
gemini: IGeminiSchema.IParameters; | ||
"3.0": ILlmSchemaV3.IParameters; | ||
"3.1": ILlmSchemaV3_1.IParameters; | ||
chatgpt: IChatGptSchema.IParameters; | ||
gemini: IGeminiSchema.IParameters; | ||
}; | ||
export type ModelSchema = { | ||
chatgpt: IChatGptSchema; | ||
claude: IClaudeSchema; | ||
gemini: IGeminiSchema; | ||
"3.0": ILlmSchemaV3; | ||
"3.1": ILlmSchemaV3_1; | ||
chatgpt: IChatGptSchema; | ||
gemini: IGeminiSchema; | ||
}; | ||
export type ModelConfig = { | ||
chatgpt: IChatGptSchema.IConfig; | ||
claude: IClaudeSchema.IConfig; | ||
gemini: IGeminiSchema.IConfig; | ||
"3.0": ILlmSchemaV3.IConfig; | ||
"3.1": ILlmSchemaV3_1.IConfig; | ||
chatgpt: IChatGptSchema.IConfig; | ||
gemini: IGeminiSchema.IConfig; | ||
}; | ||
@@ -78,0 +82,0 @@ |
import { IChatGptSchema } from "./IChatGptSchema"; | ||
import { IClaudeSchema } from "./IClaudeSchema"; | ||
import { IGeminiSchema } from "./IGeminiSchema"; | ||
@@ -30,6 +31,7 @@ import { ILlmSchemaV3 } from "./ILlmSchemaV3"; | ||
Parameters extends | ||
| IChatGptSchema.IParameters | ||
| IClaudeSchema.IParameters | ||
| IGeminiSchema.IParameters | ||
| ILlmSchemaV3.IParameters | ||
| ILlmSchemaV3_1.IParameters | ||
| IChatGptSchema.IParameters | ||
| IGeminiSchema.IParameters, | ||
| ILlmSchemaV3_1.IParameters, | ||
> { | ||
@@ -103,6 +105,7 @@ /** | ||
Parameters extends | ||
| IChatGptSchema.IParameters | ||
| IClaudeSchema.IParameters | ||
| IGeminiSchema.IParameters | ||
| ILlmSchemaV3.IParameters | ||
| ILlmSchemaV3_1.IParameters | ||
| IChatGptSchema.IParameters | ||
| IGeminiSchema.IParameters, | ||
| ILlmSchemaV3_1.IParameters, | ||
> { | ||
@@ -109,0 +112,0 @@ /** |
@@ -15,3 +15,2 @@ /** | ||
* - Resolve nullable property: {@link OpenApiV3_1.IJsonSchema.__ISignificant.nullable} | ||
* - Tuple type is banned: {@link OpenApiV3_1.IJsonSchema.ITuple.prefixItems} | ||
* - Constant type is banned: {@link OpenApiV3_1.IJsonSchema.IConstant} | ||
@@ -27,8 +26,9 @@ * - Merge {@link OpenApiV3_1.IJsonSchema.IAnyOf} to {@link ILlmSchemaV3_1.IOneOf} | ||
* - Do not support {@link OpenApi.IJsonSchema.ITuple} type | ||
* - {@link ILlmSchemaV3_1.additionalProperties} is fixed to `false` | ||
* - {@link ILlmSchemaV3_1.properties} and {@link ILlmSchemaV3_1.required} are always defined | ||
* | ||
* For reference, if you've composed the `ILlmSchemaV3_1` type with the | ||
* {@link ILlmSchemaV3_1.IConfig.reference} `false` option (default is `false`), | ||
* only the recursived named types would be archived into the | ||
* {@link ILlmSchemaV3_1.IParameters.$defs}, and the others would be ecaped from the | ||
* {@link ILlmSchemaV3_1.IReference} type. | ||
* {@link ILlmSchemaV3_1.IConfig.reference} `false` option (default is `false`), only the | ||
* recursived named types would be archived into the {@link ILlmSchemaV3_1.IParameters.$defs}, | ||
* and the others would be ecaped from the {@link ILlmSchemaV3_1.IReference} type. | ||
* | ||
@@ -58,2 +58,3 @@ * Also, if you've composed the `ILlmSchemaV3_1` type with the | ||
export type ILlmSchemaV3_1 = | ||
| ILlmSchemaV3_1.IConstant | ||
| ILlmSchemaV3_1.IBoolean | ||
@@ -65,4 +66,4 @@ | ILlmSchemaV3_1.IInteger | ||
| ILlmSchemaV3_1.IObject | ||
| ILlmSchemaV3_1.IReference | ||
| ILlmSchemaV3_1.IOneOf | ||
| ILlmSchemaV3_1.IReference | ||
| ILlmSchemaV3_1.INull | ||
@@ -69,0 +70,0 @@ | ILlmSchemaV3_1.IUnknown; |
@@ -291,3 +291,3 @@ import { OpenApi } from "../../OpenApi"; | ||
properties.some( | ||
([k, v]) => v === undefined && object.required.includes(k) === true, | ||
([k, v]) => v === undefined && object.required?.includes(k) === true, | ||
) === true | ||
@@ -304,5 +304,6 @@ ) | ||
additionalProperties: additionalProperties ?? false, | ||
required: object.required.filter((k) => | ||
properties.some(([key, value]) => key === k && value !== undefined), | ||
), | ||
required: | ||
object.required?.filter((k) => | ||
properties.some(([key, value]) => key === k && value !== undefined), | ||
) ?? [], | ||
}; | ||
@@ -560,4 +561,4 @@ } else if (isTuple(props.schema)) { | ||
else if ( | ||
p.x.required.includes(key) === true && | ||
p.y.required.includes(key) === false | ||
p.x.required?.includes(key) === true && | ||
(p.y.required?.includes(key) ?? false) === false | ||
) | ||
@@ -564,0 +565,0 @@ return false; |
@@ -1,2 +0,1 @@ | ||
import { OpenApi } from "../OpenApi"; | ||
import { ILlmSchemaV3_1 } from "../structures/ILlmSchemaV3_1"; | ||
@@ -76,8 +75,8 @@ import { OpenApiTypeCheckerBase } from "./internal/OpenApiTypeCheckerBase"; | ||
----------------------------------------------------------- */ | ||
export const escape = (props: { | ||
export const covers = (props: { | ||
$defs?: Record<string, ILlmSchemaV3_1>; | ||
schema: ILlmSchemaV3_1; | ||
recursive: false | number; | ||
}): ILlmSchemaV3_1 | null => | ||
OpenApiTypeCheckerBase.escape({ | ||
x: ILlmSchemaV3_1; | ||
y: ILlmSchemaV3_1; | ||
}): boolean => | ||
OpenApiTypeCheckerBase.covers({ | ||
prefix: "#/$defs/", | ||
@@ -87,5 +86,5 @@ components: { | ||
}, | ||
schema: props.schema, | ||
recursive: props.recursive, | ||
}) as ILlmSchemaV3_1 | null; | ||
x: props.x, | ||
y: props.y, | ||
}); | ||
@@ -99,22 +98,8 @@ export const visit = (props: { | ||
prefix: "#/$defs/", | ||
closure: props.closure as (schema: OpenApi.IJsonSchema) => void, | ||
components: { | ||
schemas: props.$defs, | ||
}, | ||
closure: props.closure as any, | ||
schema: props.schema, | ||
}); | ||
export const covers = (props: { | ||
$defs?: Record<string, ILlmSchemaV3_1>; | ||
x: ILlmSchemaV3_1; | ||
y: ILlmSchemaV3_1; | ||
}): boolean => | ||
OpenApiTypeCheckerBase.covers({ | ||
prefix: "#/$defs/", | ||
components: { | ||
schemas: props.$defs, | ||
}, | ||
x: props.x, | ||
y: props.y, | ||
}); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1608285
244
27861
431
32