-
Notifications
You must be signed in to change notification settings - Fork 498
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
657e07e
commit 7dcc380
Showing
47 changed files
with
724 additions
and
1,071 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -13,4 +13,7 @@ npm-debug.log | |
# tests | ||
/test | ||
/coverage | ||
/.nyc_output | ||
/.nyc_output | ||
|
||
# source | ||
dist |
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,7 @@ | ||
# source | ||
lib | ||
index.ts | ||
package-lock.json | ||
tslint.json | ||
tsconfig.json | ||
.prettierrc |
This file was deleted.
Oops, something went wrong.
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,17 +1,15 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DECORATORS_PREFIX = 'swagger'; | ||
exports.DECORATORS = { | ||
API_OPERATION: `${exports.DECORATORS_PREFIX}/apiOperation`, | ||
API_RESPONSE: `${exports.DECORATORS_PREFIX}/apiResponse`, | ||
API_PRODUCES: `${exports.DECORATORS_PREFIX}/apiProduces`, | ||
API_CONSUMES: `${exports.DECORATORS_PREFIX}/apiConsumes`, | ||
API_USE_TAGS: `${exports.DECORATORS_PREFIX}/apiUseTags`, | ||
API_PARAMETERS: `${exports.DECORATORS_PREFIX}/apiParameters`, | ||
API_MODEL_PROPERTIES: `${exports.DECORATORS_PREFIX}/apiModelProperties`, | ||
API_MODEL_PROPERTIES_ARRAY: `${ | ||
exports.DECORATORS_PREFIX | ||
}/apiModelPropertiesArray`, | ||
API_BEARER: `${exports.DECORATORS_PREFIX}/apiBearer`, | ||
API_OAUTH2: `${exports.DECORATORS_PREFIX}/apiOauth2`, | ||
API_OPERATION: `${exports.DECORATORS_PREFIX}/apiOperation`, | ||
API_RESPONSE: `${exports.DECORATORS_PREFIX}/apiResponse`, | ||
API_PRODUCES: `${exports.DECORATORS_PREFIX}/apiProduces`, | ||
API_CONSUMES: `${exports.DECORATORS_PREFIX}/apiConsumes`, | ||
API_USE_TAGS: `${exports.DECORATORS_PREFIX}/apiUseTags`, | ||
API_PARAMETERS: `${exports.DECORATORS_PREFIX}/apiParameters`, | ||
API_MODEL_PROPERTIES: `${exports.DECORATORS_PREFIX}/apiModelProperties`, | ||
API_MODEL_PROPERTIES_ARRAY: `${exports.DECORATORS_PREFIX}/apiModelPropertiesArray`, | ||
API_BEARER: `${exports.DECORATORS_PREFIX}/apiBearer`, | ||
API_OAUTH2: `${exports.DECORATORS_PREFIX}/apiOauth2`, | ||
}; |
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,7 +1,7 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const constants_1 = require('../constants'); | ||
const helpers_1 = require('./helpers'); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const constants_1 = require("../constants"); | ||
const helpers_1 = require("./helpers"); | ||
exports.ApiBearerAuth = () => { | ||
return helpers_1.createMixedDecorator(constants_1.DECORATORS.API_BEARER, []); | ||
return helpers_1.createMixedDecorator(constants_1.DECORATORS.API_BEARER, []); | ||
}; |
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,10 +1,7 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const constants_1 = require('../constants'); | ||
const helpers_1 = require('./helpers'); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const constants_1 = require("../constants"); | ||
const helpers_1 = require("./helpers"); | ||
exports.ApiConsumes = (...mimeTypes) => { | ||
return helpers_1.createMixedDecorator( | ||
constants_1.DECORATORS.API_CONSUMES, | ||
mimeTypes, | ||
); | ||
return helpers_1.createMixedDecorator(constants_1.DECORATORS.API_CONSUMES, mimeTypes); | ||
}; |
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,19 +1,19 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const helpers_1 = require('./helpers'); | ||
const lodash_1 = require('lodash'); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const helpers_1 = require("./helpers"); | ||
const lodash_1 = require("lodash"); | ||
const initialMetadata = { | ||
name: '', | ||
required: true, | ||
name: '', | ||
required: true | ||
}; | ||
exports.ApiImplicitBody = metadata => { | ||
const param = { | ||
name: lodash_1.isNil(metadata.name) ? initialMetadata.name : metadata.name, | ||
in: 'body', | ||
description: metadata.description, | ||
required: metadata.required, | ||
type: metadata.type, | ||
isArray: metadata.isArray, | ||
}; | ||
return helpers_1.createParamDecorator(param, initialMetadata); | ||
exports.ApiImplicitBody = (metadata) => { | ||
const param = { | ||
name: lodash_1.isNil(metadata.name) ? initialMetadata.name : metadata.name, | ||
in: 'body', | ||
description: metadata.description, | ||
required: metadata.required, | ||
type: metadata.type, | ||
isArray: metadata.isArray | ||
}; | ||
return helpers_1.createParamDecorator(param, initialMetadata); | ||
}; |
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,28 +1,28 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const helpers_1 = require('./helpers'); | ||
const lodash_1 = require('lodash'); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const helpers_1 = require("./helpers"); | ||
const lodash_1 = require("lodash"); | ||
const initialMetadata = { | ||
name: '', | ||
required: true, | ||
name: '', | ||
required: true | ||
}; | ||
exports.ApiImplicitHeader = metadata => { | ||
const param = { | ||
name: lodash_1.isNil(metadata.name) ? initialMetadata.name : metadata.name, | ||
in: 'header', | ||
description: metadata.description, | ||
required: metadata.required, | ||
type: String, | ||
}; | ||
return helpers_1.createParamDecorator(param, initialMetadata); | ||
exports.ApiImplicitHeader = (metadata) => { | ||
const param = { | ||
name: lodash_1.isNil(metadata.name) ? initialMetadata.name : metadata.name, | ||
in: 'header', | ||
description: metadata.description, | ||
required: metadata.required, | ||
type: String | ||
}; | ||
return helpers_1.createParamDecorator(param, initialMetadata); | ||
}; | ||
exports.ApiImplicitHeaders = headers => { | ||
const multiMetadata = headers.map(metadata => ({ | ||
name: lodash_1.isNil(metadata.name) ? initialMetadata.name : metadata.name, | ||
in: 'header', | ||
description: metadata.description, | ||
required: metadata.required, | ||
type: String, | ||
})); | ||
return helpers_1.createMultipleParamDecorator(multiMetadata, initialMetadata); | ||
exports.ApiImplicitHeaders = (headers) => { | ||
const multiMetadata = headers.map(metadata => ({ | ||
name: lodash_1.isNil(metadata.name) ? initialMetadata.name : metadata.name, | ||
in: 'header', | ||
description: metadata.description, | ||
required: metadata.required, | ||
type: String | ||
})); | ||
return helpers_1.createMultipleParamDecorator(multiMetadata, initialMetadata); | ||
}; |
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,18 +1,18 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const helpers_1 = require('./helpers'); | ||
const lodash_1 = require('lodash'); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const helpers_1 = require("./helpers"); | ||
const lodash_1 = require("lodash"); | ||
const initialMetadata = { | ||
name: '', | ||
required: true, | ||
name: '', | ||
required: true | ||
}; | ||
exports.ApiImplicitParam = metadata => { | ||
const param = { | ||
name: lodash_1.isNil(metadata.name) ? initialMetadata.name : metadata.name, | ||
in: 'path', | ||
description: metadata.description, | ||
required: metadata.required, | ||
type: metadata.type, | ||
}; | ||
return helpers_1.createParamDecorator(param, initialMetadata); | ||
exports.ApiImplicitParam = (metadata) => { | ||
const param = { | ||
name: lodash_1.isNil(metadata.name) ? initialMetadata.name : metadata.name, | ||
in: 'path', | ||
description: metadata.description, | ||
required: metadata.required, | ||
type: metadata.type | ||
}; | ||
return helpers_1.createParamDecorator(param, initialMetadata); | ||
}; |
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,18 +1,25 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const helpers_1 = require('./helpers'); | ||
const lodash_1 = require('lodash'); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const helpers_1 = require("./helpers"); | ||
const lodash_1 = require("lodash"); | ||
const initialMetadata = { | ||
name: '', | ||
required: true, | ||
name: '', | ||
required: true | ||
}; | ||
exports.ApiImplicitQuery = metadata => { | ||
const param = { | ||
name: lodash_1.isNil(metadata.name) ? initialMetadata.name : metadata.name, | ||
in: 'query', | ||
description: metadata.description, | ||
required: metadata.required, | ||
type: metadata.type, | ||
}; | ||
return helpers_1.createParamDecorator(param, initialMetadata); | ||
exports.ApiImplicitQuery = (metadata) => { | ||
const param = { | ||
name: lodash_1.isNil(metadata.name) ? initialMetadata.name : metadata.name, | ||
in: 'query', | ||
description: metadata.description, | ||
required: metadata.required, | ||
type: metadata.type, | ||
items: undefined | ||
}; | ||
if (metadata.isArray) { | ||
param.type = Array; | ||
param.items = { | ||
type: param.type | ||
}; | ||
} | ||
return helpers_1.createParamDecorator(param, initialMetadata); | ||
}; |
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,12 +1,8 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const constants_1 = require('../constants'); | ||
const helpers_1 = require('./helpers'); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const constants_1 = require("../constants"); | ||
const helpers_1 = require("./helpers"); | ||
exports.ApiModelProperty = (metadata = {}) => { | ||
return helpers_1.createPropertyDecorator( | ||
constants_1.DECORATORS.API_MODEL_PROPERTIES, | ||
metadata, | ||
); | ||
return helpers_1.createPropertyDecorator(constants_1.DECORATORS.API_MODEL_PROPERTIES, metadata); | ||
}; | ||
exports.ApiModelPropertyOptional = (metadata = {}) => | ||
exports.ApiModelProperty(Object.assign({}, metadata, { required: false })); | ||
exports.ApiModelPropertyOptional = (metadata = {}) => exports.ApiModelProperty(Object.assign({}, metadata, { required: false })); |
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,10 +1,7 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const constants_1 = require('../constants'); | ||
const helpers_1 = require('./helpers'); | ||
exports.ApiOAuth2Auth = scopes => { | ||
return helpers_1.createMixedDecorator( | ||
constants_1.DECORATORS.API_OAUTH2, | ||
scopes ? scopes : [], | ||
); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const constants_1 = require("../constants"); | ||
const helpers_1 = require("./helpers"); | ||
exports.ApiOAuth2Auth = (scopes) => { | ||
return helpers_1.createMixedDecorator(constants_1.DECORATORS.API_OAUTH2, scopes ? scopes : []); | ||
}; |
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,23 +1,13 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const constants_1 = require('../constants'); | ||
const helpers_1 = require('./helpers'); | ||
const lodash_1 = require('lodash'); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const constants_1 = require("../constants"); | ||
const helpers_1 = require("./helpers"); | ||
const lodash_1 = require("lodash"); | ||
const initialMetadata = { | ||
summary: '', | ||
summary: '' | ||
}; | ||
exports.ApiOperation = metadata => { | ||
return helpers_1.createMethodDecorator( | ||
constants_1.DECORATORS.API_OPERATION, | ||
lodash_1.pickBy( | ||
Object.assign({}, initialMetadata, { | ||
summary: lodash_1.isNil(metadata.title) | ||
? initialMetadata.summary | ||
: metadata.title, | ||
description: metadata.description, | ||
operationId: metadata.operationId, | ||
}), | ||
lodash_1.negate(lodash_1.isUndefined), | ||
), | ||
); | ||
exports.ApiOperation = (metadata) => { | ||
return helpers_1.createMethodDecorator(constants_1.DECORATORS.API_OPERATION, lodash_1.pickBy(Object.assign({}, initialMetadata, { summary: lodash_1.isNil(metadata.title) | ||
? initialMetadata.summary | ||
: metadata.title, description: metadata.description, operationId: metadata.operationId }), lodash_1.negate(lodash_1.isUndefined))); | ||
}; |
Oops, something went wrong.