@openapi-generator-plus/generator-common
Advanced tools
Comparing version 0.16.0 to 0.17.0
@@ -8,3 +8,3 @@ import { CodegenObjectSchema, CodegenProperties, CodegenProperty } from '@openapi-generator-plus/types'; | ||
*/ | ||
export declare function uniquePropertiesIncludingInherited(model: CodegenObjectSchema, result?: CodegenProperties): CodegenProperty[]; | ||
export declare function uniquePropertiesIncludingInherited(models: CodegenObjectSchema[], result?: CodegenProperties): CodegenProperty[]; | ||
export declare function stringify(value: any): string; |
@@ -11,9 +11,16 @@ "use strict"; | ||
*/ | ||
function uniquePropertiesIncludingInherited(model, result = core_1.idx.create()) { | ||
if (model.parent) { | ||
uniquePropertiesIncludingInherited(model.parent, result); | ||
function uniquePropertiesIncludingInherited(models, result = core_1.idx.create()) { | ||
const open = [...models]; | ||
for (const model of open) { | ||
if (model.properties) { | ||
core_1.idx.merge(result, model.properties); | ||
} | ||
if (model.parents) { | ||
for (const aParent of model.parents) { | ||
if (open.indexOf(aParent) === -1) { | ||
open.push(aParent); | ||
} | ||
} | ||
} | ||
} | ||
if (model.properties) { | ||
core_1.idx.merge(result, model.properties); | ||
} | ||
return core_1.idx.allValues(result); | ||
@@ -20,0 +27,0 @@ } |
{ | ||
"name": "@openapi-generator-plus/generator-common", | ||
"version": "0.16.0", | ||
"version": "0.17.0", | ||
"description": "Common utilities for openapi-generator-plus generators", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"build": "../../node_modules/.bin/tsc -p tsconfig.prod.json", | ||
"clean": "../../node_modules/.bin/rimraf dist", | ||
"test": "../../node_modules/.bin/jest", | ||
"watch": "../../node_modules/.bin/tsc --watch" | ||
}, | ||
"repository": { | ||
@@ -28,3 +22,3 @@ "type": "git", | ||
"peerDependencies": { | ||
"@openapi-generator-plus/core": "^0.30.1" | ||
"@openapi-generator-plus/core": "^0.31.0" | ||
}, | ||
@@ -34,3 +28,9 @@ "publishConfig": { | ||
}, | ||
"gitHead": "36347a7a7cc3cd0e63b1828a65e262ba784b53a9" | ||
} | ||
"gitHead": "4d7336969427733ca316dfb48219f166adb9182a", | ||
"scripts": { | ||
"build": "../../node_modules/.bin/tsc -p tsconfig.prod.json", | ||
"clean": "../../node_modules/.bin/rimraf dist", | ||
"test": "../../node_modules/.bin/jest", | ||
"watch": "../../node_modules/.bin/tsc --watch" | ||
} | ||
} |
@@ -10,9 +10,16 @@ import { CodegenObjectSchema, CodegenProperties, CodegenProperty } from '@openapi-generator-plus/types' | ||
*/ | ||
export function uniquePropertiesIncludingInherited(model: CodegenObjectSchema, result: CodegenProperties = idx.create()): CodegenProperty[] { | ||
if (model.parent) { | ||
uniquePropertiesIncludingInherited(model.parent, result) | ||
export function uniquePropertiesIncludingInherited(models: CodegenObjectSchema[], result: CodegenProperties = idx.create()): CodegenProperty[] { | ||
const open = [...models] | ||
for (const model of open) { | ||
if (model.properties) { | ||
idx.merge(result, model.properties) | ||
} | ||
if (model.parents) { | ||
for (const aParent of model.parents) { | ||
if (open.indexOf(aParent) === -1) { | ||
open.push(aParent) | ||
} | ||
} | ||
} | ||
} | ||
if (model.properties) { | ||
idx.merge(result, model.properties) | ||
} | ||
@@ -19,0 +26,0 @@ return idx.allValues(result) |
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
32690
493