Skip to content

Commit

Permalink
Merge pull request #69 from samchon/feat/tuple
Browse files Browse the repository at this point in the history
`OpenApiTypeChecker.escape()` erases discriminator
  • Loading branch information
samchon authored Nov 11, 2024
2 parents 19deb53 + 08b9281 commit 5737602
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@samchon/openapi",
"version": "1.2.1",
"version": "1.2.2",
"description": "OpenAPI definitions and converters for 'typia' and 'nestia'.",
"main": "./lib/index.js",
"module": "./lib/index.mjs",
Expand Down
13 changes: 2 additions & 11 deletions src/converters/HttpLlmConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { IHttpMigrateApplication } from "../structures/IHttpMigrateApplication";
import { IHttpMigrateRoute } from "../structures/IHttpMigrateRoute";
import { ILlmSchema } from "../structures/ILlmSchema";
import { LlmSchemaSeparator } from "../utils/LlmSchemaSeparator";
import { LlmTypeChecker } from "../utils/LlmTypeChecker";
import { OpenApiTypeChecker } from "../utils/OpenApiTypeChecker";
import { OpenApiV3Downgrader } from "./OpenApiV3Downgrader";

Expand Down Expand Up @@ -81,18 +80,10 @@ export namespace HttpLlmConverter {
recursive: props.recursive,
});
if (resolved === null) return null;
const downgraded: ILlmSchema = OpenApiV3Downgrader.downgradeSchema({
return OpenApiV3Downgrader.downgradeSchema({
original: {},
downgraded: {},
})(resolved) as ILlmSchema;
LlmTypeChecker.visit(downgraded, (schema) => {
if (
LlmTypeChecker.isOneOf(schema) &&
(schema as any).discriminator !== undefined
)
delete (schema as any).discriminator;
});
return downgraded;
})(resolved);
};
}

Expand Down
1 change: 1 addition & 0 deletions src/utils/OpenApiTypeChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export namespace OpenApiTypeChecker {
return {
...props,
oneOf: filtered.map(flat(props.components)).flat(),
discriminator: undefined,
};
} else if (isObject(props.schema)) {
// OBJECT
Expand Down

0 comments on commit 5737602

Please sign in to comment.