@samchon/openapi
Advanced tools
Comparing version 2.0.0-dev.20241111 to 2.0.0-dev.20241112
@@ -153,3 +153,16 @@ "use strict"; | ||
return null; | ||
return __assign(__assign({}, props.schema), { oneOf: oneOf.filter(function (v) { return v !== null; }) }); | ||
return __assign(__assign({}, props.schema), { oneOf: oneOf.filter(function (v) { return v !== null; }), discriminator: props.schema.discriminator | ||
? { | ||
propertyName: props.schema.discriminator.propertyName, | ||
mapping: props.schema.discriminator.mapping | ||
? Object.fromEntries(Object.entries(props.schema.discriminator.mapping).map(function (_a) { | ||
var _b = __read(_a, 2), key = _b[0], value = _b[1]; | ||
return [ | ||
key, | ||
value.replace("#/components/schemas/", "#/$defs/"), | ||
]; | ||
})) | ||
: undefined, | ||
} | ||
: undefined }); | ||
} | ||
@@ -156,0 +169,0 @@ return props.schema; |
@@ -57,4 +57,28 @@ "use strict"; | ||
.map(function (route) { | ||
if (route.method === "head") | ||
var _a, _b; | ||
if (route.method === "head") { | ||
errors.push({ | ||
method: route.method, | ||
path: route.path, | ||
messages: [ | ||
"HEAD method is not supported in the LLM application.", | ||
], | ||
operation: function () { return route.operation(); }, | ||
route: function () { return route; }, | ||
}); | ||
return null; | ||
} | ||
else if (((_a = route.body) === null || _a === void 0 ? void 0 : _a.type) === "multipart/form-data" || | ||
((_b = route.success) === null || _b === void 0 ? void 0 : _b.type) === "multipart/form-data") { | ||
errors.push({ | ||
method: route.method, | ||
path: route.path, | ||
messages: [ | ||
"The \"multipart/form-data\" content type is not supported in the LLM application.", | ||
], | ||
operation: function () { return route.operation(); }, | ||
route: function () { return route; }, | ||
}); | ||
return null; | ||
} | ||
var func = composeFunction({ | ||
@@ -70,3 +94,3 @@ model: props.model, | ||
path: route.path, | ||
messages: ["Failed to escape $ref"], | ||
messages: ["Failed to escape $ref"], // @todo | ||
operation: function () { return route.operation(); }, | ||
@@ -73,0 +97,0 @@ route: function () { return route; }, |
@@ -55,12 +55,6 @@ "use strict"; | ||
return null; | ||
var downgraded = OpenApiV3Downgrader_1.OpenApiV3Downgrader.downgradeSchema({ | ||
return OpenApiV3Downgrader_1.OpenApiV3Downgrader.downgradeSchema({ | ||
original: {}, | ||
downgraded: {}, | ||
})(resolved); | ||
LlmTypeCheckerV3_1.LlmTypeCheckerV3.visit(downgraded, function (schema) { | ||
if (LlmTypeCheckerV3_1.LlmTypeCheckerV3.isOneOf(schema) && | ||
schema.discriminator !== undefined) | ||
delete schema.discriminator; | ||
}); | ||
return downgraded; | ||
}; | ||
@@ -67,0 +61,0 @@ LlmConverterV3.separate = function (props) { |
@@ -203,2 +203,3 @@ "use strict"; | ||
var visit = function (schema) { | ||
var _a, _b; | ||
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isBoolean(schema)) | ||
@@ -215,16 +216,10 @@ union.push({ type: "boolean" }); | ||
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isTuple(schema)) | ||
union.push(__assign(__assign(__assign({}, schema), { items: (function () { | ||
if (schema.additionalItems === true) | ||
return {}; | ||
var elements = __spreadArray(__spreadArray([], __read(schema.prefixItems), false), __read((typeof schema.additionalItems === "object" | ||
? [OpenApiV3Downgrader.downgradeSchema(collection)(schema.additionalItems)] | ||
: [])), false); | ||
if (elements.length === 0) | ||
return {}; | ||
return { | ||
oneOf: elements.map(OpenApiV3Downgrader.downgradeSchema(collection)), | ||
}; | ||
})(), minItems: schema.prefixItems.length, maxItems: !!schema.additionalItems === true | ||
visit(__assign(__assign(__assign({}, schema), { type: "array", items: { | ||
oneOf: __spreadArray(__spreadArray([], __read(schema.prefixItems), false), __read((typeof schema.additionalItems === "object" && | ||
schema.additionalItems !== null | ||
? [schema.additionalItems] | ||
: [])), false), | ||
}, minItems: (_a = schema.minItems) !== null && _a !== void 0 ? _a : schema.prefixItems.length, maxItems: (_b = schema.maxItems) !== null && _b !== void 0 ? _b : (schema.additionalItems === true | ||
? undefined | ||
: schema.prefixItems.length }), { | ||
: schema.prefixItems.length) }), { | ||
prefixItems: undefined, | ||
@@ -231,0 +226,0 @@ additionalItems: undefined, |
@@ -224,2 +224,3 @@ "use strict"; | ||
var visit = function (schema) { | ||
var _a, _b; | ||
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isBoolean(schema)) | ||
@@ -241,21 +242,13 @@ union.push({ type: "boolean" }); | ||
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isTuple(schema)) | ||
union.push(__assign(__assign(__assign(__assign({}, schema), { items: (function () { | ||
if (schema.additionalItems === true) | ||
return {}; | ||
var elements = __spreadArray(__spreadArray([], __read(schema.prefixItems), false), __read((typeof schema.additionalItems === "object" | ||
? [SwaggerV2Downgrader.downgradeSchema(collection)(schema.additionalItems)] | ||
: [])), false); | ||
if (elements.length === 0) | ||
return {}; | ||
return { | ||
"x-oneOf": elements.map(SwaggerV2Downgrader.downgradeSchema(collection)), | ||
}; | ||
})(), minItems: schema.prefixItems.length, maxItems: !!schema.additionalItems === true | ||
visit(__assign(__assign(__assign({}, schema), { type: "array", items: { | ||
oneOf: __spreadArray(__spreadArray([], __read(schema.prefixItems), false), __read((typeof schema.additionalItems === "object" && | ||
schema.additionalItems !== null | ||
? [schema.additionalItems] | ||
: [])), false), | ||
}, minItems: (_a = schema.minItems) !== null && _a !== void 0 ? _a : schema.prefixItems.length, maxItems: (_b = schema.maxItems) !== null && _b !== void 0 ? _b : (schema.additionalItems === true | ||
? undefined | ||
: schema.prefixItems.length }), { | ||
: schema.prefixItems.length) }), { | ||
prefixItems: undefined, | ||
additionalItems: undefined, | ||
}), { examples: schema.examples | ||
? Object.values(schema.examples) | ||
: undefined })); | ||
})); | ||
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isObject(schema)) | ||
@@ -284,6 +277,8 @@ union.push(__assign(__assign({}, schema), { properties: schema.properties | ||
var visitConstant = function (schema) { | ||
var e_3, _a; | ||
var insert = function (value) { | ||
var _a; | ||
var matched = union.find(function (u) { | ||
return u.type === value; | ||
return u.type === | ||
typeof value; | ||
}); | ||
@@ -296,7 +291,20 @@ if (matched !== undefined) { | ||
union.push({ type: typeof value, enum: [value] }); | ||
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isConstant(schema)) | ||
insert(schema.const); | ||
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isOneOf(schema)) | ||
schema.oneOf.forEach(insert); | ||
}; | ||
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isConstant(schema)) | ||
insert(schema.const); | ||
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isOneOf(schema)) | ||
try { | ||
for (var _b = __values(schema.oneOf), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var u = _c.value; | ||
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isConstant(u)) | ||
insert(u.const); | ||
} | ||
} | ||
catch (e_3_1) { e_3 = { error: e_3_1 }; } | ||
finally { | ||
try { | ||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b); | ||
} | ||
finally { if (e_3) throw e_3.error; } | ||
} | ||
}; | ||
@@ -303,0 +311,0 @@ visit(input); |
@@ -53,3 +53,3 @@ export type IChatGptSchema = IChatGptSchema.IBoolean | IChatGptSchema.IInteger | IChatGptSchema.INumber | IChatGptSchema.IString | IChatGptSchema.IArray | IChatGptSchema.ITuple | IChatGptSchema.IObject | IChatGptSchema.IReference | IChatGptSchema.IOneOf | IChatGptSchema.INull | IChatGptSchema.IUnknown; | ||
* For reference, even though your Swagger (or OpenAPI) document has | ||
* defined the `exclusiveMinimum` value as `number`, {@link OpenApi} | ||
* defined the `exclusiveMinimum` value as `number`, {@link IChatGptSchema} | ||
* forcibly converts it to `boolean` type, and assign the numeric value to | ||
@@ -63,3 +63,3 @@ * the {@link minimum} property. | ||
* For reference, even though your Swagger (or OpenAPI) document has | ||
* defined the `exclusiveMaximum` value as `number`, {@link OpenApi} | ||
* defined the `exclusiveMaximum` value as `number`, {@link IChatGptSchema} | ||
* forcibly converts it to `boolean` type, and assign the numeric value to | ||
@@ -312,7 +312,7 @@ * the {@link maximum} property. | ||
* following the JSON Pointer specification. In the OpenAPI, the `$ref` | ||
* starts with `#/components/schemas/` which means the type is stored in | ||
* the {@link OpenApi.IComponents.schemas} object. | ||
* starts with `#/$defs/` which means the type is stored in | ||
* the {@link IChatGptSchema.ITop.$defs} object. | ||
* | ||
* - `#/components/schemas/SomeObject` | ||
* - `#/components/schemas/AnotherObject` | ||
* - `#/$defs/SomeObject` | ||
* - `#/$defs/AnotherObject` | ||
*/ | ||
@@ -327,3 +327,3 @@ $ref: Key; | ||
* For reference, even though your Swagger (or OpenAPI) document has | ||
* defined `anyOf` instead of the `oneOf`, {@link OpenApi} forcibly | ||
* defined `anyOf` instead of the `oneOf`, {@link IChatGptSchema} forcibly | ||
* converts it to `oneOf` type. | ||
@@ -356,3 +356,3 @@ */ | ||
* the discriminator value, and `value` of `mapping` is the | ||
* schema name like `#/components/schemas/SomeObject`. | ||
* schema name like `#/$defs/SomeObject`. | ||
*/ | ||
@@ -359,0 +359,0 @@ mapping?: Record<string, string>; |
@@ -71,3 +71,3 @@ import { OpenApi } from "../OpenApi"; | ||
*/ | ||
export interface IHttpLlmApplication<Model extends IHttpLlmApplication.Model, Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema | IGeminiSchema = IHttpLlmApplication.ModelSchema[Model], Operation extends OpenApi.IOperation = OpenApi.IOperation, Route extends IHttpMigrateRoute = IHttpMigrateRoute> { | ||
export interface IHttpLlmApplication<Model extends IHttpLlmApplication.Model, Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema.ITop | IGeminiSchema = IHttpLlmApplication.ModelSchema[Model], Operation extends OpenApi.IOperation = OpenApi.IOperation, Route extends IHttpMigrateRoute = IHttpMigrateRoute> { | ||
/** | ||
@@ -103,3 +103,3 @@ * Model of the target LLM. | ||
"3.1": ILlmSchemaV3_1; | ||
chatgpt: IChatGptSchema; | ||
chatgpt: IChatGptSchema.ITop; | ||
gemini: IGeminiSchema; | ||
@@ -144,3 +144,3 @@ }; | ||
*/ | ||
interface IOptions<Model extends IHttpLlmApplication.Model, Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema | IGeminiSchema = IHttpLlmApplication.ModelSchema[Model]> { | ||
interface IOptions<Model extends IHttpLlmApplication.Model, Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema.ITop | IGeminiSchema = IHttpLlmApplication.ModelSchema[Model]> { | ||
/** | ||
@@ -147,0 +147,0 @@ * Whether the parameters are keyworded or not. |
@@ -59,3 +59,3 @@ import { OpenApi } from "../OpenApi"; | ||
*/ | ||
export interface IHttpLlmFunction<Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema | IGeminiSchema, Operation extends OpenApi.IOperation = OpenApi.IOperation, Route extends IHttpMigrateRoute = IHttpMigrateRoute> { | ||
export interface IHttpLlmFunction<Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema.ITop | IGeminiSchema, Operation extends OpenApi.IOperation = OpenApi.IOperation, Route extends IHttpMigrateRoute = IHttpMigrateRoute> { | ||
/** | ||
@@ -215,3 +215,3 @@ * HTTP method of the endpoint. | ||
*/ | ||
interface ISeparated<Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema | IGeminiSchema> { | ||
interface ISeparated<Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema.ITop | IGeminiSchema> { | ||
/** | ||
@@ -229,3 +229,3 @@ * Parameters that would be composed by the LLM. | ||
*/ | ||
interface ISeparatedParameter<Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema | IGeminiSchema> { | ||
interface ISeparatedParameter<Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema.ITop | IGeminiSchema> { | ||
/** | ||
@@ -232,0 +232,0 @@ * Index of the parameter. |
@@ -36,3 +36,3 @@ import { IChatGptSchema } from "./IChatGptSchema"; | ||
*/ | ||
export interface ILlmApplication<Model extends ILlmApplication.Model, Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema | IGeminiSchema = ILlmApplication.ModelSchema[Model]> { | ||
export interface ILlmApplication<Model extends ILlmApplication.Model, Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema.ITop | IGeminiSchema = ILlmApplication.ModelSchema[Model]> { | ||
/** | ||
@@ -58,3 +58,3 @@ * Model of the LLM. | ||
"3.1": ILlmSchemaV3_1; | ||
chatgpt: IChatGptSchema; | ||
chatgpt: IChatGptSchema.ITop; | ||
gemini: IGeminiSchema; | ||
@@ -65,3 +65,3 @@ }; | ||
*/ | ||
interface IOptions<Model extends ILlmApplication.Model, Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema | IGeminiSchema = ILlmApplication.ModelSchema[Model]> { | ||
interface IOptions<Model extends ILlmApplication.Model, Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema.ITop | IGeminiSchema = ILlmApplication.ModelSchema[Model]> { | ||
/** | ||
@@ -68,0 +68,0 @@ * Whether to allow recursive types or not. |
@@ -27,3 +27,3 @@ import { IChatGptSchema } from "./IChatGptSchema"; | ||
*/ | ||
export interface ILlmFunction<Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema | IGeminiSchema> { | ||
export interface ILlmFunction<Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema.ITop | IGeminiSchema> { | ||
/** | ||
@@ -79,3 +79,3 @@ * Representative name of the function. | ||
*/ | ||
interface ISeparated<Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema | IGeminiSchema> { | ||
interface ISeparated<Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema.ITop | IGeminiSchema> { | ||
/** | ||
@@ -93,3 +93,3 @@ * Parameters that would be composed by the LLM. | ||
*/ | ||
interface ISeparatedParameter<Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema | IGeminiSchema> { | ||
interface ISeparatedParameter<Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema.ITop | IGeminiSchema> { | ||
/** | ||
@@ -96,0 +96,0 @@ * Index of the parameter. |
@@ -224,3 +224,3 @@ "use strict"; | ||
return undefined; | ||
return __assign(__assign({}, props), { oneOf: filtered.map(function (v) { return flat(props.components, v); }).flat() }); | ||
return __assign(__assign({}, props), { oneOf: filtered.map(function (v) { return flat(props.components, v); }).flat(), discriminator: undefined }); | ||
} | ||
@@ -227,0 +227,0 @@ else if (OpenApiTypeChecker.isObject(props.schema)) { |
{ | ||
"name": "@samchon/openapi", | ||
"version": "2.0.0-dev.20241111", | ||
"version": "2.0.0-dev.20241112", | ||
"description": "OpenAPI definitions and converters for 'typia' and 'nestia'.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -133,2 +133,17 @@ import { OpenApi } from "../OpenApi"; | ||
oneOf: oneOf.filter((v) => v !== null), | ||
discriminator: props.schema.discriminator | ||
? { | ||
propertyName: props.schema.discriminator.propertyName, | ||
mapping: props.schema.discriminator.mapping | ||
? Object.fromEntries( | ||
Object.entries(props.schema.discriminator.mapping).map( | ||
([key, value]) => [ | ||
key, | ||
value.replace("#/components/schemas/", "#/$defs/"), | ||
], | ||
), | ||
) | ||
: undefined, | ||
} | ||
: undefined, | ||
}; | ||
@@ -135,0 +150,0 @@ } |
@@ -45,3 +45,28 @@ import { OpenApi } from "../OpenApi"; | ||
.map((route) => { | ||
if (route.method === "head") return null; | ||
if (route.method === "head") { | ||
errors.push({ | ||
method: route.method, | ||
path: route.path, | ||
messages: [ | ||
"HEAD method is not supported in the LLM application.", | ||
], | ||
operation: () => route.operation(), | ||
route: () => route as any as Route, | ||
}); | ||
return null; | ||
} else if ( | ||
route.body?.type === "multipart/form-data" || | ||
route.success?.type === "multipart/form-data" | ||
) { | ||
errors.push({ | ||
method: route.method, | ||
path: route.path, | ||
messages: [ | ||
`The "multipart/form-data" content type is not supported in the LLM application.`, | ||
], | ||
operation: () => route.operation(), | ||
route: () => route as any as Route, | ||
}); | ||
return null; | ||
} | ||
const func: IHttpLlmFunction<Schema> | null = composeFunction({ | ||
@@ -57,3 +82,3 @@ model: props.model, | ||
path: route.path, | ||
messages: ["Failed to escape $ref"], | ||
messages: ["Failed to escape $ref"], // @todo | ||
operation: () => route.operation(), | ||
@@ -60,0 +85,0 @@ route: () => route as any as Route, |
@@ -19,14 +19,6 @@ import { OpenApi } from "../OpenApi"; | ||
if (resolved === null) return null; | ||
const downgraded: ILlmSchemaV3 = OpenApiV3Downgrader.downgradeSchema({ | ||
return OpenApiV3Downgrader.downgradeSchema({ | ||
original: {}, | ||
downgraded: {}, | ||
})(resolved) as ILlmSchemaV3; | ||
LlmTypeCheckerV3.visit(downgraded, (schema) => { | ||
if ( | ||
LlmTypeCheckerV3.isOneOf(schema) && | ||
(schema as any).discriminator !== undefined | ||
) | ||
delete (schema as any).discriminator; | ||
}); | ||
return downgraded; | ||
})(resolved); | ||
}; | ||
@@ -33,0 +25,0 @@ |
@@ -211,22 +211,20 @@ import { OpenApi } from "../OpenApi"; | ||
else if (OpenApiTypeChecker.isTuple(schema)) | ||
union.push({ | ||
visit({ | ||
...schema, | ||
items: ((): OpenApiV3.IJsonSchema => { | ||
if (schema.additionalItems === true) return {}; | ||
const elements = [ | ||
type: "array", | ||
items: { | ||
oneOf: [ | ||
...schema.prefixItems, | ||
...(typeof schema.additionalItems === "object" | ||
? [downgradeSchema(collection)(schema.additionalItems)] | ||
...(typeof schema.additionalItems === "object" && | ||
schema.additionalItems !== null | ||
? [schema.additionalItems] | ||
: []), | ||
]; | ||
if (elements.length === 0) return {}; | ||
return { | ||
oneOf: elements.map(downgradeSchema(collection) as any), | ||
}; | ||
})(), | ||
minItems: schema.prefixItems.length, | ||
], | ||
}, | ||
minItems: schema.minItems ?? schema.prefixItems.length, | ||
maxItems: | ||
!!schema.additionalItems === true | ||
schema.maxItems ?? | ||
(schema.additionalItems === true | ||
? undefined | ||
: schema.prefixItems.length, | ||
: schema.prefixItems.length), | ||
...{ | ||
@@ -236,3 +234,3 @@ prefixItems: undefined, | ||
}, | ||
}); | ||
} satisfies OpenApi.IJsonSchema.IArray); | ||
else if (OpenApiTypeChecker.isObject(schema)) | ||
@@ -239,0 +237,0 @@ union.push({ |
@@ -231,22 +231,20 @@ import { OpenApi } from "../OpenApi"; | ||
else if (OpenApiTypeChecker.isTuple(schema)) | ||
union.push({ | ||
visit({ | ||
...schema, | ||
items: ((): SwaggerV2.IJsonSchema => { | ||
if (schema.additionalItems === true) return {}; | ||
const elements = [ | ||
type: "array", | ||
items: { | ||
oneOf: [ | ||
...schema.prefixItems, | ||
...(typeof schema.additionalItems === "object" | ||
? [downgradeSchema(collection)(schema.additionalItems)] | ||
...(typeof schema.additionalItems === "object" && | ||
schema.additionalItems !== null | ||
? [schema.additionalItems] | ||
: []), | ||
]; | ||
if (elements.length === 0) return {}; | ||
return { | ||
"x-oneOf": elements.map(downgradeSchema(collection) as any), | ||
}; | ||
})(), | ||
minItems: schema.prefixItems.length, | ||
], | ||
}, | ||
minItems: schema.minItems ?? schema.prefixItems.length, | ||
maxItems: | ||
!!schema.additionalItems === true | ||
schema.maxItems ?? | ||
(schema.additionalItems === true | ||
? undefined | ||
: schema.prefixItems.length, | ||
: schema.prefixItems.length), | ||
...{ | ||
@@ -256,6 +254,3 @@ prefixItems: undefined, | ||
}, | ||
examples: schema.examples | ||
? Object.values(schema.examples) | ||
: undefined, | ||
}); | ||
} satisfies OpenApi.IJsonSchema.IArray); | ||
else if (OpenApiTypeChecker.isObject(schema)) | ||
@@ -290,3 +285,4 @@ union.push({ | ||
(u) => | ||
(u as SwaggerV2.IJsonSchema.__ISignificant<any>).type === value, | ||
(u as SwaggerV2.IJsonSchema.__ISignificant<any>).type === | ||
typeof value, | ||
) as SwaggerV2.IJsonSchema.INumber | undefined; | ||
@@ -297,6 +293,7 @@ if (matched !== undefined) { | ||
} else union.push({ type: typeof value as "number", enum: [value] }); | ||
if (OpenApiTypeChecker.isConstant(schema)) insert(schema.const); | ||
else if (OpenApiTypeChecker.isOneOf(schema)) | ||
schema.oneOf.forEach(insert); | ||
}; | ||
if (OpenApiTypeChecker.isConstant(schema)) insert(schema.const); | ||
else if (OpenApiTypeChecker.isOneOf(schema)) | ||
for (const u of schema.oneOf) | ||
if (OpenApiTypeChecker.isConstant(u)) insert(u.const); | ||
}; | ||
@@ -303,0 +300,0 @@ |
@@ -70,3 +70,3 @@ export type IChatGptSchema = | ||
* For reference, even though your Swagger (or OpenAPI) document has | ||
* defined the `exclusiveMinimum` value as `number`, {@link OpenApi} | ||
* defined the `exclusiveMinimum` value as `number`, {@link IChatGptSchema} | ||
* forcibly converts it to `boolean` type, and assign the numeric value to | ||
@@ -81,3 +81,3 @@ * the {@link minimum} property. | ||
* For reference, even though your Swagger (or OpenAPI) document has | ||
* defined the `exclusiveMaximum` value as `number`, {@link OpenApi} | ||
* defined the `exclusiveMaximum` value as `number`, {@link IChatGptSchema} | ||
* forcibly converts it to `boolean` type, and assign the numeric value to | ||
@@ -380,7 +380,7 @@ * the {@link maximum} property. | ||
* following the JSON Pointer specification. In the OpenAPI, the `$ref` | ||
* starts with `#/components/schemas/` which means the type is stored in | ||
* the {@link OpenApi.IComponents.schemas} object. | ||
* starts with `#/$defs/` which means the type is stored in | ||
* the {@link IChatGptSchema.ITop.$defs} object. | ||
* | ||
* - `#/components/schemas/SomeObject` | ||
* - `#/components/schemas/AnotherObject` | ||
* - `#/$defs/SomeObject` | ||
* - `#/$defs/AnotherObject` | ||
*/ | ||
@@ -396,3 +396,3 @@ $ref: Key; | ||
* For reference, even though your Swagger (or OpenAPI) document has | ||
* defined `anyOf` instead of the `oneOf`, {@link OpenApi} forcibly | ||
* defined `anyOf` instead of the `oneOf`, {@link IChatGptSchema} forcibly | ||
* converts it to `oneOf` type. | ||
@@ -427,3 +427,3 @@ */ | ||
* the discriminator value, and `value` of `mapping` is the | ||
* schema name like `#/components/schemas/SomeObject`. | ||
* schema name like `#/$defs/SomeObject`. | ||
*/ | ||
@@ -430,0 +430,0 @@ mapping?: Record<string, string>; |
@@ -77,3 +77,3 @@ import { OpenApi } from "../OpenApi"; | ||
| ILlmSchemaV3_1 | ||
| IChatGptSchema | ||
| IChatGptSchema.ITop | ||
| IGeminiSchema = IHttpLlmApplication.ModelSchema[Model], | ||
@@ -116,3 +116,3 @@ Operation extends OpenApi.IOperation = OpenApi.IOperation, | ||
"3.1": ILlmSchemaV3_1; | ||
chatgpt: IChatGptSchema; | ||
chatgpt: IChatGptSchema.ITop; | ||
gemini: IGeminiSchema; | ||
@@ -171,3 +171,3 @@ }; | ||
| ILlmSchemaV3_1 | ||
| IChatGptSchema | ||
| IChatGptSchema.ITop | ||
| IGeminiSchema = IHttpLlmApplication.ModelSchema[Model], | ||
@@ -174,0 +174,0 @@ > { |
@@ -61,3 +61,7 @@ import { OpenApi } from "../OpenApi"; | ||
export interface IHttpLlmFunction< | ||
Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema | IGeminiSchema, | ||
Schema extends | ||
| ILlmSchemaV3 | ||
| ILlmSchemaV3_1 | ||
| IChatGptSchema.ITop | ||
| IGeminiSchema, | ||
Operation extends OpenApi.IOperation = OpenApi.IOperation, | ||
@@ -235,3 +239,3 @@ Route extends IHttpMigrateRoute = IHttpMigrateRoute, | ||
| ILlmSchemaV3_1 | ||
| IChatGptSchema | ||
| IChatGptSchema.ITop | ||
| IGeminiSchema, | ||
@@ -257,3 +261,3 @@ > { | ||
| ILlmSchemaV3_1 | ||
| IChatGptSchema | ||
| IChatGptSchema.ITop | ||
| IGeminiSchema, | ||
@@ -260,0 +264,0 @@ > { |
@@ -42,3 +42,3 @@ import { IChatGptSchema } from "./IChatGptSchema"; | ||
| ILlmSchemaV3_1 | ||
| IChatGptSchema | ||
| IChatGptSchema.ITop | ||
| IGeminiSchema = ILlmApplication.ModelSchema[Model], | ||
@@ -68,3 +68,3 @@ > { | ||
"3.1": ILlmSchemaV3_1; | ||
chatgpt: IChatGptSchema; | ||
chatgpt: IChatGptSchema.ITop; | ||
gemini: IGeminiSchema; | ||
@@ -81,3 +81,3 @@ }; | ||
| ILlmSchemaV3_1 | ||
| IChatGptSchema | ||
| IChatGptSchema.ITop | ||
| IGeminiSchema = ILlmApplication.ModelSchema[Model], | ||
@@ -84,0 +84,0 @@ > { |
@@ -29,3 +29,7 @@ import { IChatGptSchema } from "./IChatGptSchema"; | ||
export interface ILlmFunction< | ||
Schema extends ILlmSchemaV3 | ILlmSchemaV3_1 | IChatGptSchema | IGeminiSchema, | ||
Schema extends | ||
| ILlmSchemaV3 | ||
| ILlmSchemaV3_1 | ||
| IChatGptSchema.ITop | ||
| IGeminiSchema, | ||
> { | ||
@@ -92,3 +96,3 @@ /** | ||
| ILlmSchemaV3_1 | ||
| IChatGptSchema | ||
| IChatGptSchema.ITop | ||
| IGeminiSchema, | ||
@@ -114,3 +118,3 @@ > { | ||
| ILlmSchemaV3_1 | ||
| IChatGptSchema | ||
| IChatGptSchema.ITop | ||
| IGeminiSchema, | ||
@@ -117,0 +121,0 @@ > { |
@@ -204,2 +204,3 @@ import { OpenApi } from "../OpenApi"; | ||
oneOf: filtered.map((v) => flat(props.components, v)).flat(), | ||
discriminator: undefined, | ||
}; | ||
@@ -206,0 +207,0 @@ } else if (isObject(props.schema)) { |
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
1487391
26058