@samchon/openapi
Advanced tools
Comparing version 3.0.0-dev.20250222 to 3.0.0-dev.20250224
@@ -73,3 +73,6 @@ "use strict"; | ||
var key = _e.value; | ||
result.value.$defs[key] = transform(result.value.$defs[key]); | ||
result.value.$defs[key] = transform({ | ||
config: props.config, | ||
schema: result.value.$defs[key], | ||
}); | ||
} | ||
@@ -86,3 +89,6 @@ } | ||
success: true, | ||
value: transform(result.value), | ||
value: transform({ | ||
config: props.config, | ||
schema: result.value, | ||
}), | ||
}; | ||
@@ -109,3 +115,6 @@ }; | ||
if (oldbie.has(key) === false) | ||
props.$defs[key] = transform(props.$defs[key]); | ||
props.$defs[key] = transform({ | ||
config: props.config, | ||
schema: props.$defs[key], | ||
}); | ||
} | ||
@@ -122,3 +131,6 @@ } | ||
success: true, | ||
value: transform(result.value), | ||
value: transform({ | ||
config: props.config, | ||
schema: result.value, | ||
}), | ||
}; | ||
@@ -158,6 +170,6 @@ }; | ||
}; | ||
var transform = function (schema) { | ||
var transform = function (props) { | ||
var _a; | ||
var union = []; | ||
var attribute = __assign({ title: schema.title, description: schema.description, example: schema.example, examples: schema.examples }, Object.fromEntries(Object.entries(schema).filter(function (_a) { | ||
var attribute = __assign({ title: props.schema.title, description: props.schema.description, example: props.schema.example, examples: props.schema.examples }, Object.fromEntries(Object.entries(ChatGptSchemaComposer.schema).filter(function (_a) { | ||
var _b = __read(_a, 2), key = _b[0], value = _b[1]; | ||
@@ -170,3 +182,6 @@ return key.startsWith("x-") && value !== undefined; | ||
else if (LlmTypeCheckerV3_1_1.LlmTypeCheckerV3_1.isArray(input)) | ||
union.push(__assign(__assign({}, input), { items: transform(input.items) })); | ||
union.push(__assign(__assign({}, input), { items: transform({ | ||
config: props.config, | ||
schema: input.items, | ||
}) })); | ||
else if (LlmTypeCheckerV3_1_1.LlmTypeCheckerV3_1.isObject(input)) | ||
@@ -177,8 +192,16 @@ union.push(__assign(__assign({}, input), { properties: Object.fromEntries(Object.entries(input.properties).map(function (_a) { | ||
key, | ||
transform(value), | ||
transform({ | ||
config: props.config, | ||
schema: value, | ||
}), | ||
]; | ||
})), additionalProperties: typeof input.additionalProperties === "object" && | ||
input.additionalProperties !== null | ||
? transform(input.additionalProperties) | ||
: input.additionalProperties })); | ||
})), additionalProperties: props.config.strict === true | ||
? false | ||
: typeof input.additionalProperties === "object" && | ||
input.additionalProperties !== null | ||
? transform({ | ||
config: props.config, | ||
schema: input.additionalProperties, | ||
}) | ||
: input.additionalProperties })); | ||
else if (LlmTypeCheckerV3_1_1.LlmTypeCheckerV3_1.isConstant(input) === false) | ||
@@ -209,4 +232,4 @@ union.push(input); | ||
}; | ||
visit(schema); | ||
visitConstant(schema); | ||
visit(props.schema); | ||
visitConstant(props.schema); | ||
if (union.length === 0) | ||
@@ -213,0 +236,0 @@ return __assign(__assign({}, attribute), { type: undefined }); |
{ | ||
"name": "@samchon/openapi", | ||
"version": "3.0.0-dev.20250222", | ||
"version": "3.0.0-dev.20250224", | ||
"description": "OpenAPI definitions and converters for 'typia' and 'nestia'.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -46,6 +46,12 @@ import { OpenApi } from "../../OpenApi"; | ||
for (const key of Object.keys(result.value.$defs)) | ||
result.value.$defs[key] = transform(result.value.$defs[key]); | ||
result.value.$defs[key] = transform({ | ||
config: props.config, | ||
schema: result.value.$defs[key], | ||
}); | ||
return { | ||
success: true, | ||
value: transform(result.value) as IChatGptSchema.IParameters, | ||
value: transform({ | ||
config: props.config, | ||
schema: result.value, | ||
}) as IChatGptSchema.IParameters, | ||
}; | ||
@@ -81,6 +87,12 @@ }; | ||
if (oldbie.has(key) === false) | ||
props.$defs[key] = transform(props.$defs[key]); | ||
props.$defs[key] = transform({ | ||
config: props.config, | ||
schema: props.$defs[key], | ||
}); | ||
return { | ||
success: true, | ||
value: transform(result.value), | ||
value: transform({ | ||
config: props.config, | ||
schema: result.value, | ||
}), | ||
}; | ||
@@ -114,9 +126,12 @@ }; | ||
const transform = (schema: ILlmSchemaV3_1): IChatGptSchema => { | ||
const transform = (props: { | ||
config: IChatGptSchema.IConfig; | ||
schema: ILlmSchemaV3_1; | ||
}): IChatGptSchema => { | ||
const union: Array<IChatGptSchema> = []; | ||
const attribute: IChatGptSchema.__IAttribute = { | ||
title: schema.title, | ||
description: schema.description, | ||
example: schema.example, | ||
examples: schema.examples, | ||
title: props.schema.title, | ||
description: props.schema.description, | ||
example: props.schema.example, | ||
examples: props.schema.examples, | ||
...Object.fromEntries( | ||
@@ -133,3 +148,6 @@ Object.entries(schema).filter( | ||
...input, | ||
items: transform(input.items), | ||
items: transform({ | ||
config: props.config, | ||
schema: input.items, | ||
}), | ||
}); | ||
@@ -142,10 +160,18 @@ else if (LlmTypeCheckerV3_1.isObject(input)) | ||
key, | ||
transform(value), | ||
transform({ | ||
config: props.config, | ||
schema: value, | ||
}), | ||
]), | ||
), | ||
additionalProperties: | ||
typeof input.additionalProperties === "object" && | ||
input.additionalProperties !== null | ||
? transform(input.additionalProperties) | ||
: input.additionalProperties, | ||
props.config.strict === true | ||
? false | ||
: typeof input.additionalProperties === "object" && | ||
input.additionalProperties !== null | ||
? transform({ | ||
config: props.config, | ||
schema: input.additionalProperties, | ||
}) | ||
: input.additionalProperties, | ||
}); | ||
@@ -175,4 +201,4 @@ else if (LlmTypeCheckerV3_1.isConstant(input) === false) | ||
}; | ||
visit(schema); | ||
visitConstant(schema); | ||
visit(props.schema); | ||
visitConstant(props.schema); | ||
if (union.length === 0) | ||
@@ -179,0 +205,0 @@ return { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1922260
33208