-
-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
const
keyword OpenAPI 3.0 draft
- Loading branch information
Showing
8 changed files
with
341 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* eslint-disable */ | ||
/* tslint:disable */ | ||
/* | ||
* --------------------------------------------------------------- | ||
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## | ||
* ## ## | ||
* ## AUTHOR: acacode ## | ||
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ## | ||
* --------------------------------------------------------------- | ||
*/ | ||
|
||
export interface ObjTest { | ||
/** | ||
* title | ||
* description | ||
* @default "main" | ||
*/ | ||
page_type?: "main"; | ||
/** | ||
* title | ||
* description | ||
*/ | ||
page_type_nullable?: "main" | null; | ||
} | ||
|
||
/** | ||
* title | ||
* description | ||
* @default "string" | ||
*/ | ||
export type TestString = "string"; | ||
|
||
/** | ||
* title | ||
* description | ||
*/ | ||
export type TestStringNullable = "string" | null; | ||
|
||
/** | ||
* title | ||
* description | ||
*/ | ||
export type TestBooleanNullable = false | null; | ||
|
||
/** | ||
* title | ||
* description | ||
* @default false | ||
*/ | ||
export type TestBooleanFalse = false; | ||
|
||
/** | ||
* title | ||
* description | ||
* @default true | ||
*/ | ||
export type TestBooleanTrue = true; | ||
|
||
/** | ||
* title | ||
* description | ||
* @default 5 | ||
*/ | ||
export type TestNumber5 = 5; | ||
|
||
/** | ||
* title | ||
* description | ||
*/ | ||
export type TestNumberNullable = 666 | null; | ||
|
||
/** | ||
* title | ||
* description | ||
* @default 0 | ||
*/ | ||
export type TestNumber0 = 0; | ||
|
||
/** | ||
* title | ||
* description | ||
* @default 10 | ||
*/ | ||
export type TestNumber10 = 10; | ||
|
||
/** | ||
* title | ||
* description | ||
* @default null | ||
*/ | ||
export type TestNull = null; |
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,88 @@ | ||
{ | ||
"openapi": "3.0.1", | ||
"info": { | ||
"title": "Nullable Refs Example", | ||
"version": "1.0.0" | ||
}, | ||
"components": { | ||
"schemas": { | ||
"obj-test": { | ||
"type": "object", | ||
"properties": { | ||
"page_type": { | ||
"const": "main", | ||
"default": "main", | ||
"description": "description", | ||
"title": "title" | ||
}, | ||
"page_type_nullable": { | ||
"const": "main", | ||
"description": "description", | ||
"title": "title", | ||
"nullable": true | ||
} | ||
} | ||
}, | ||
"test-string": { | ||
"const": "string", | ||
"default": "string", | ||
"description": "description", | ||
"title": "title" | ||
}, | ||
"test-string-nullable": { | ||
"const": "string", | ||
"description": "description", | ||
"title": "title", | ||
"nullable": true | ||
}, | ||
"test-boolean-nullable": { | ||
"const": false, | ||
"description": "description", | ||
"title": "title", | ||
"nullable": true | ||
}, | ||
"test-boolean-false": { | ||
"const": false, | ||
"default": false, | ||
"description": "description", | ||
"title": "title" | ||
}, | ||
"test-boolean-true": { | ||
"const": true, | ||
"default": true, | ||
"description": "description", | ||
"title": "title" | ||
}, | ||
"test-number-5": { | ||
"const": 5, | ||
"default": 5, | ||
"description": "description", | ||
"title": "title" | ||
}, | ||
"test-number-nullable": { | ||
"const": 666, | ||
"description": "description", | ||
"title": "title", | ||
"nullable": true, | ||
}, | ||
"test-number-0": { | ||
"const": 0, | ||
"default": 0, | ||
"description": "description", | ||
"title": "title" | ||
}, | ||
"test-number-10": { | ||
"const": 10, | ||
"default": 10, | ||
"description": "description", | ||
"title": "title" | ||
}, | ||
"test-null": { | ||
"const": null, | ||
"default": null, | ||
"description": "description", | ||
"title": "title" | ||
} | ||
} | ||
} | ||
} |
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,91 @@ | ||
/* eslint-disable */ | ||
/* tslint:disable */ | ||
/* | ||
* --------------------------------------------------------------- | ||
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## | ||
* ## ## | ||
* ## AUTHOR: acacode ## | ||
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ## | ||
* --------------------------------------------------------------- | ||
*/ | ||
|
||
export interface ObjTest { | ||
/** | ||
* title | ||
* description | ||
* @default "main" | ||
*/ | ||
page_type?: "main"; | ||
/** | ||
* title | ||
* description | ||
*/ | ||
page_type_nullable?: "main" | null; | ||
} | ||
|
||
/** | ||
* title | ||
* description | ||
* @default "string" | ||
*/ | ||
export type TestString = "string"; | ||
|
||
/** | ||
* title | ||
* description | ||
*/ | ||
export type TestStringNullable = "string" | null; | ||
|
||
/** | ||
* title | ||
* description | ||
*/ | ||
export type TestBooleanNullable = false | null; | ||
|
||
/** | ||
* title | ||
* description | ||
* @default false | ||
*/ | ||
export type TestBooleanFalse = false; | ||
|
||
/** | ||
* title | ||
* description | ||
* @default true | ||
*/ | ||
export type TestBooleanTrue = true; | ||
|
||
/** | ||
* title | ||
* description | ||
* @default 5 | ||
*/ | ||
export type TestNumber5 = 5; | ||
|
||
/** | ||
* title | ||
* description | ||
*/ | ||
export type TestNumberNullable = 666 | null; | ||
|
||
/** | ||
* title | ||
* description | ||
* @default 0 | ||
*/ | ||
export type TestNumber0 = 0; | ||
|
||
/** | ||
* title | ||
* description | ||
* @default 10 | ||
*/ | ||
export type TestNumber10 = 10; | ||
|
||
/** | ||
* title | ||
* description | ||
* @default null | ||
*/ | ||
export type TestNull = null; |
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,22 @@ | ||
const { generateApiForTest } = require("../../helpers/generateApiForTest"); | ||
const { resolve } = require("path"); | ||
const validateGeneratedModule = require("../../helpers/validateGeneratedModule"); | ||
const assertGeneratedModule = require("../../helpers/assertGeneratedModule"); | ||
const createSchemaInfos = require("../../helpers/createSchemaInfos"); | ||
|
||
const schemas = createSchemaInfos({ absolutePathToSchemas: resolve(__dirname, "./") }); | ||
|
||
schemas.forEach(({ absolutePath, apiFileName }) => { | ||
generateApiForTest({ | ||
testName: "const-keyword test", | ||
silent: true, | ||
name: apiFileName, | ||
input: absolutePath, | ||
output: resolve(__dirname, "./"), | ||
addReadonly: true, | ||
generateClient: false, | ||
}).then(() => { | ||
validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); | ||
assertGeneratedModule(resolve(__dirname, `./${apiFileName}`), resolve(__dirname, `./expected.ts`)); | ||
}); | ||
}); |