@tsoa/runtime
Advanced tools
Comparing version 6.0.0-rc.2 to 6.0.0-rc.5
@@ -26,16 +26,20 @@ /// <reference types="node" /> | ||
/** | ||
* combine all schemas once without backwards combinations ie | ||
* combine all schemas once, ignoring order ie | ||
* input: [[value1], [value2]] should be [[value1, value2]] | ||
* not [[value1, value2],[value2, value1]] | ||
* and | ||
* input: [[value1], [value2], [value3]] should be [ | ||
* [value1, value2, value3], | ||
* [value1, value2], | ||
* [value1, value3], | ||
* [value2, value3] | ||
* input: [[value1, value2], [value3, value4], [value5, value6]] should be [ | ||
* [value1, value3, value5], | ||
* [value1, value3, value6], | ||
* [value1, value4, value5], | ||
* [value1, value4, value6], | ||
* [value2, value3, value5], | ||
* [value2, value3, value6], | ||
* [value2, value4, value5], | ||
* [value2, value4, value6], | ||
* ] | ||
* @param modelSchemass | ||
*/ | ||
private selfIntersectionExcludingCombinations; | ||
private intersectRefObjectModelSchemas; | ||
private selfIntersectionCombinations; | ||
private getAllCombinations; | ||
private combineProperties; | ||
@@ -42,0 +46,0 @@ private getExcessPropertiesFor; |
@@ -495,3 +495,3 @@ "use strict"; | ||
} | ||
const schemas = this.selfIntersectionExcludingCombinations(subSchemas.map(subSchema => this.toModelLike(subSchema))); | ||
const schemas = this.selfIntersectionCombinations(subSchemas.map(subSchema => this.toModelLike(subSchema))); | ||
const getRequiredPropError = (schema) => { | ||
@@ -558,3 +558,3 @@ const requiredPropError = {}; | ||
const modelss = schema.subSchemas.map(subSchema => this.toModelLike(subSchema)); | ||
return this.selfIntersectionExcludingCombinations(modelss); | ||
return this.selfIntersectionCombinations(modelss); | ||
} | ||
@@ -571,31 +571,47 @@ else if (schema.subSchemas && schema.dataType === 'union') { | ||
/** | ||
* combine all schemas once without backwards combinations ie | ||
* combine all schemas once, ignoring order ie | ||
* input: [[value1], [value2]] should be [[value1, value2]] | ||
* not [[value1, value2],[value2, value1]] | ||
* and | ||
* input: [[value1], [value2], [value3]] should be [ | ||
* [value1, value2, value3], | ||
* [value1, value2], | ||
* [value1, value3], | ||
* [value2, value3] | ||
* input: [[value1, value2], [value3, value4], [value5, value6]] should be [ | ||
* [value1, value3, value5], | ||
* [value1, value3, value6], | ||
* [value1, value4, value5], | ||
* [value1, value4, value6], | ||
* [value2, value3, value5], | ||
* [value2, value3, value6], | ||
* [value2, value4, value5], | ||
* [value2, value4, value6], | ||
* ] | ||
* @param modelSchemass | ||
*/ | ||
selfIntersectionExcludingCombinations(modelSchemass) { | ||
selfIntersectionCombinations(modelSchemass) { | ||
const res = []; | ||
for (let outerIndex = 0; outerIndex < modelSchemass.length; outerIndex++) { | ||
let currentCollector = { ...modelSchemass[outerIndex][0] }; | ||
for (let innerIndex = outerIndex + 1; innerIndex < modelSchemass.length; innerIndex++) { | ||
currentCollector = { ...this.intersectRefObjectModelSchemas([currentCollector], modelSchemass[innerIndex])[0] }; | ||
if (innerIndex - outerIndex > 1) { | ||
res.push(currentCollector); | ||
} | ||
const currentCombination = this.intersectRefObjectModelSchemas(modelSchemass[outerIndex], modelSchemass[innerIndex]); | ||
res.push(...currentCombination); | ||
// Picks one schema from each sub-array | ||
const combinations = this.getAllCombinations(modelSchemass); | ||
for (const combination of combinations) { | ||
// Combine all schemas of this combination | ||
let currentCollector = { ...combination[0] }; | ||
for (let subSchemaIdx = 1; subSchemaIdx < combination.length; subSchemaIdx++) { | ||
currentCollector = { ...this.combineProperties(currentCollector, combination[subSchemaIdx]) }; | ||
} | ||
res.push(currentCollector); | ||
} | ||
return res; | ||
} | ||
intersectRefObjectModelSchemas(a, b) { | ||
return a.reduce((acc, aModel) => [...acc, ...b.reduce((acc, bModel) => [...acc, this.combineProperties(aModel, bModel)], [])], []); | ||
getAllCombinations(arrays) { | ||
function combine(current, index) { | ||
if (index === arrays.length) { | ||
result.push(current.slice()); | ||
return; | ||
} | ||
for (let i = 0; i < arrays[index].length; i++) { | ||
current.push(arrays[index][i]); | ||
combine(current, index + 1); | ||
current.pop(); | ||
} | ||
} | ||
const result = []; | ||
combine([], 0); | ||
return result; | ||
} | ||
@@ -602,0 +618,0 @@ combineProperties(a, b) { |
@@ -357,2 +357,6 @@ export declare namespace Swagger { | ||
} | ||
export interface OpenIDSecurity extends BaseSecurity { | ||
type: 'openIdConnect'; | ||
openIdConnectUrl: string; | ||
} | ||
export interface OAuth2Security3 extends BaseSecurity { | ||
@@ -396,3 +400,3 @@ type: 'oauth2'; | ||
export type OAuth2FlowTypes = 'authorizationCode' | 'implicit' | 'password' | 'clientCredentials'; | ||
export type SecuritySchemes = ApiKeySecurity | BasicSecurity | BasicSecurity3 | BearerSecurity3 | OAuth2AccessCodeSecurity | OAuth2ApplicationSecurity | OAuth2ImplicitSecurity | OAuth2PasswordSecurity | OAuth2Security3; | ||
export type SecuritySchemes = ApiKeySecurity | BasicSecurity | BasicSecurity3 | BearerSecurity3 | OpenIDSecurity | OAuth2AccessCodeSecurity | OAuth2ApplicationSecurity | OAuth2ImplicitSecurity | OAuth2PasswordSecurity | OAuth2Security3; | ||
export interface Security { | ||
@@ -399,0 +403,0 @@ [key: string]: string[]; |
{ | ||
"name": "@tsoa/runtime", | ||
"description": "Build swagger-compliant REST APIs using TypeScript and Node", | ||
"version": "6.0.0-rc.2", | ||
"version": "6.0.0-rc.5", | ||
"main": "./dist/index.js", | ||
@@ -31,10 +31,10 @@ "typings": "./dist/index.d.ts", | ||
"dependencies": { | ||
"@types/multer": "^1.4.7", | ||
"@types/multer": "^1.4.8", | ||
"reflect-metadata": "^0.1.13", | ||
"validator": "^13.9.0" | ||
"validator": "^13.11.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^16.18.23", | ||
"@types/validator": "^13.7.14", | ||
"typescript": "^5.1.6" | ||
"@types/node": "^18.0.0", | ||
"@types/validator": "^13.11.2", | ||
"typescript": "^5.2.2" | ||
}, | ||
@@ -47,3 +47,3 @@ "repository": { | ||
"yarn": ">=1.9.4", | ||
"node": ">=16.0.0" | ||
"node": ">=18.0.0" | ||
}, | ||
@@ -54,3 +54,3 @@ "engineStrict": true, | ||
}, | ||
"gitHead": "ec57bd84bfa281e6a04428b39d18ad2425c3322b" | ||
"gitHead": "be1484646e99036032cf5257b1adf983d939b31b" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
128547
2511
Updated@types/multer@^1.4.8
Updatedvalidator@^13.11.0