-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from samchon/feat/result
Completed v2 publishing
- Loading branch information
Showing
9 changed files
with
489 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,58 @@ | ||
import { OpenApi } from "../OpenApi"; | ||
|
||
/** | ||
* OpenAPI schema related error. | ||
* | ||
* `IOpenApiSchemaError` is a type representing an error that occured during the | ||
* iteration or transformation of the OpenAPI schema (JSON schema) of | ||
* {@link OpenApi.IJsonSchema} type. | ||
* | ||
* The most `IOpenApiSchemaError` is occured by the transformation process from | ||
* {@link OpenApi.IJsonSchema} to {@link ILlmSchema} type. The transformation can | ||
* be failed by following reasons: | ||
* | ||
* - Unable to find the {@link OpenApi.IJsonSchema.IReference} directing. | ||
* - Non-supported type in LLM schema models | ||
* - Every models do not support {@link OpenApi.IJsonSchema.ITuple} | ||
* - Gemini does not support {@link OpenApi.IJsonSchema.IOneOf} | ||
* - ChatGPT and Gemini do not support {@link OpenApi.IJsonSchema.IObject.additionalProperties} | ||
* | ||
* @author Jeongho Nam - https://github.com/samchon | ||
*/ | ||
export interface IOpenApiSchemaError { | ||
/** | ||
* Method that caused the error. | ||
*/ | ||
method: string; | ||
|
||
/** | ||
* Message of the error. | ||
*/ | ||
message: string; | ||
|
||
/** | ||
* The detailed reasons of the error. | ||
*/ | ||
reasons: IOpenApiSchemaError.IReason[]; | ||
} | ||
export namespace IOpenApiSchemaError { | ||
/** | ||
* Detailed reason of the error. | ||
*/ | ||
export interface IReason { | ||
/** | ||
* Schema that caused the error. | ||
*/ | ||
schema: OpenApi.IJsonSchema; | ||
|
||
/** | ||
* Accessor to the schema. | ||
*/ | ||
accessor: string; | ||
|
||
/** | ||
* Message of the reason. | ||
*/ | ||
message: string; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,46 @@ | ||
/** | ||
* Result of an operation that can either succeed or fail. | ||
* | ||
* `IResult` is an union type that represents the result of an operation | ||
* that can either succeed or fail. | ||
* | ||
* You can distinguise the result by checking the {@link IResult.success} value, | ||
* and if it's `true`, the success value is stored in {@link IResult.value}. | ||
* Otherwise, if it's `false`, the error value is stored in {@link IResult.error}. | ||
* | ||
* @template T Type of the success value. | ||
* @template E Type of the error value. | ||
* @author Jeongho Nam - https://github.com/samchon | ||
*/ | ||
export type IResult<T, E> = IResult.ISuccess<T> | IResult.IFailure<E>; | ||
export namespace IResult { | ||
/** | ||
* Success type of {@link IResult}. | ||
*/ | ||
export interface ISuccess<T> { | ||
/** | ||
* Success flag. | ||
*/ | ||
success: true; | ||
|
||
/** | ||
* Success value. | ||
*/ | ||
value: T; | ||
} | ||
|
||
/** | ||
* Failure type of {@link IResult}. | ||
*/ | ||
export interface IFailure<E> { | ||
/** | ||
* Success flag. | ||
*/ | ||
success: false; | ||
|
||
/** | ||
* The error value. | ||
*/ | ||
error: E; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.