-
-
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.
Fix
OpenApi.IJsonSchema.ITuple
downgrading problem.
- Loading branch information
Showing
8 changed files
with
109 additions
and
51 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
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
35 changes: 35 additions & 0 deletions
35
test/features/openapi/test_json_schema_downgrade_v20_tuple.ts
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { TestValidator } from "@nestia/e2e"; | ||
import { SwaggerV2Downgrader } from "@samchon/openapi/lib/converters/SwaggerV2Downgrader"; | ||
import typia from "typia"; | ||
|
||
export const test_json_schema_downgrade_v20_tuple = (): void => { | ||
const collection = typia.json.application<[[false, 1, 2, "three", null]]>(); | ||
const schema = SwaggerV2Downgrader.downgradeSchema({ | ||
original: collection.components, | ||
downgraded: {}, | ||
})(collection.schemas[0]); | ||
TestValidator.equals("tuple")(schema)({ | ||
type: "array", | ||
items: { | ||
"x-oneOf": [ | ||
{ | ||
type: "boolean", | ||
enum: [false], | ||
"x-nullable": true, | ||
}, | ||
{ | ||
type: "number", | ||
enum: [1, 2], | ||
"x-nullable": true, | ||
}, | ||
{ | ||
type: "string", | ||
enum: ["three"], | ||
"x-nullable": true, | ||
}, | ||
], | ||
}, | ||
minItems: 5, | ||
maxItems: 5, | ||
}); | ||
}; |
35 changes: 35 additions & 0 deletions
35
test/features/openapi/test_json_schema_downgrade_v30_tuple.ts
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { TestValidator } from "@nestia/e2e"; | ||
import { OpenApiV3Downgrader } from "@samchon/openapi/lib/converters/OpenApiV3Downgrader"; | ||
import typia from "typia"; | ||
|
||
export const test_json_schema_downgrade_v30_tuple = (): void => { | ||
const collection = typia.json.application<[[false, 1, 2, "three", null]]>(); | ||
const schema = OpenApiV3Downgrader.downgradeSchema({ | ||
original: collection.components, | ||
downgraded: {}, | ||
})(collection.schemas[0]); | ||
TestValidator.equals("tuple")(schema)({ | ||
type: "array", | ||
items: { | ||
oneOf: [ | ||
{ | ||
type: "boolean", | ||
enum: [false], | ||
nullable: true, | ||
}, | ||
{ | ||
type: "number", | ||
enum: [1, 2], | ||
nullable: true, | ||
}, | ||
{ | ||
type: "string", | ||
enum: ["three"], | ||
nullable: true, | ||
}, | ||
], | ||
}, | ||
minItems: 5, | ||
maxItems: 5, | ||
}); | ||
}; |