-
-
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 #17 from samchon/features/downgrade
Fix bug of v3 downgrader about const type
- Loading branch information
Showing
5 changed files
with
60 additions
and
7 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { OpenApi, SwaggerV2 } from "../../src"; | ||
import { TestValidator } from "@nestia/e2e"; | ||
import { SwaggerV2Downgrader } from "../../src/internal/SwaggerV2Downgrader"; | ||
|
||
export const test_downgrade_v20 = () => { | ||
const schema: OpenApi.IJsonSchema = { | ||
oneOf: [{ const: "a" }, { const: "b" }, { const: "c" }], | ||
title: "something", | ||
description: "nothing", | ||
}; | ||
const downgraded: SwaggerV2.IJsonSchema = SwaggerV2Downgrader.downgradeSchema( | ||
{ | ||
original: {}, | ||
downgraded: {}, | ||
}, | ||
)(schema); | ||
TestValidator.equals("enum")(downgraded)({ | ||
type: "string", | ||
title: "something", | ||
description: "nothing", | ||
enum: ["a", "b", "c"], | ||
}); | ||
}; |
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,23 @@ | ||
import { OpenApi, OpenApiV3 } from "../../src"; | ||
import { OpenApiV3Downgrader } from "../../src/internal/OpenApiV3Downgrader"; | ||
import { TestValidator } from "@nestia/e2e"; | ||
|
||
export const test_downgrade_v30 = () => { | ||
const schema: OpenApi.IJsonSchema = { | ||
oneOf: [{ const: "a" }, { const: "b" }, { const: "c" }], | ||
title: "something", | ||
description: "nothing", | ||
}; | ||
const downgraded: OpenApiV3.IJsonSchema = OpenApiV3Downgrader.downgradeSchema( | ||
{ | ||
original: {}, | ||
downgraded: {}, | ||
}, | ||
)(schema); | ||
TestValidator.equals("enum")(downgraded)({ | ||
type: "string", | ||
title: "something", | ||
description: "nothing", | ||
enum: ["a", "b", "c"], | ||
}); | ||
}; |
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