@openapi-generator-plus/generator-common
Advanced tools
Comparing version 0.7.1 to 0.8.0
@@ -5,3 +5,3 @@ import { CodegenGenerator, CodegenServer, CodegenGeneratorContext, CodegenConfig } from '@openapi-generator-plus/types'; | ||
export * from './utils'; | ||
export declare function commonGenerator(config: CodegenConfig, context: CodegenGeneratorContext): Pick<CodegenGenerator, 'toOperationName' | 'toSchemaName' | 'templateRootContext'>; | ||
export declare function commonGenerator(config: CodegenConfig, context: CodegenGeneratorContext): Pick<CodegenGenerator, 'toOperationName' | 'toSchemaName' | 'toSuggestedSchemaName' | 'templateRootContext'>; | ||
export declare function apiBasePath(servers: CodegenServer[] | null): string; |
@@ -34,11 +34,11 @@ "use strict"; | ||
}, | ||
toSchemaName: (name, options) => { | ||
if (options.nameSpecified) { | ||
return context.generator().toClassName(name); | ||
} | ||
toSchemaName: (name) => { | ||
return name; | ||
}, | ||
toSuggestedSchemaName: (name, options) => { | ||
if (options.purpose === types_1.CodegenSchemaPurpose.ARRAY_ITEM || options.purpose === types_1.CodegenSchemaPurpose.MAP_VALUE) { | ||
return context.generator().toClassName(pluralize_1.default.singular(name)); | ||
return pluralize_1.default.singular(name); | ||
} | ||
else { | ||
return context.generator().toClassName(name); | ||
return name; | ||
} | ||
@@ -45,0 +45,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
import { CodegenModel, CodegenProperties, CodegenProperty } from '@openapi-generator-plus/types'; | ||
import { CodegenObjectSchema, CodegenProperties, CodegenProperty } from '@openapi-generator-plus/types'; | ||
/** | ||
@@ -8,3 +8,3 @@ * Return an object containing all of the unique properties, including inherited properties, for a model, where properties | ||
*/ | ||
export declare function uniquePropertiesIncludingInherited(model: CodegenModel, result?: CodegenProperties): CodegenProperty[]; | ||
export declare function uniquePropertiesIncludingInherited(model: CodegenObjectSchema, result?: CodegenProperties): CodegenProperty[]; | ||
export declare function stringify(value: any): string; |
{ | ||
"name": "@openapi-generator-plus/generator-common", | ||
"version": "0.7.1", | ||
"version": "0.8.0", | ||
"description": "Common utilities for openapi-generator-plus generators", | ||
@@ -28,3 +28,3 @@ "main": "dist/index.js", | ||
"peerDependencies": { | ||
"@openapi-generator-plus/core": "^0.18.0" | ||
"@openapi-generator-plus/core": "^0.19.0" | ||
}, | ||
@@ -34,3 +34,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "ed262f38e2d56e4fffd0f6e5b1effd582412d4d3" | ||
"gitHead": "5aa2c2f8b549dfbe0b6c3a96991c92a025159e04" | ||
} |
@@ -9,3 +9,3 @@ import { CodegenGenerator, CodegenServer, CodegenSchemaPurpose, CodegenGeneratorContext, CodegenConfig } from '@openapi-generator-plus/types' | ||
export function commonGenerator(config: CodegenConfig, context: CodegenGeneratorContext): Pick<CodegenGenerator, 'toOperationName' | 'toSchemaName' | 'templateRootContext'> { | ||
export function commonGenerator(config: CodegenConfig, context: CodegenGeneratorContext): Pick<CodegenGenerator, 'toOperationName' | 'toSchemaName' | 'toSuggestedSchemaName' | 'templateRootContext'> { | ||
return { | ||
@@ -21,11 +21,11 @@ /** Create a default operation name for operations that lack an operationId */ | ||
toSchemaName: (name, options) => { | ||
if (options.nameSpecified) { | ||
return context.generator().toClassName(name) | ||
} | ||
toSchemaName: (name) => { | ||
return name | ||
}, | ||
toSuggestedSchemaName: (name, options) => { | ||
if (options.purpose === CodegenSchemaPurpose.ARRAY_ITEM || options.purpose === CodegenSchemaPurpose.MAP_VALUE) { | ||
return context.generator().toClassName(pluralize.singular(name)) | ||
return pluralize.singular(name) | ||
} else { | ||
return context.generator().toClassName(name) | ||
return name | ||
} | ||
@@ -32,0 +32,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
import { CodegenModel, CodegenProperties, CodegenProperty } from '@openapi-generator-plus/types' | ||
import { CodegenObjectSchema, CodegenProperties, CodegenProperty } from '@openapi-generator-plus/types' | ||
import { idx } from '@openapi-generator-plus/core' | ||
@@ -10,3 +10,3 @@ | ||
*/ | ||
export function uniquePropertiesIncludingInherited(model: CodegenModel, result: CodegenProperties = idx.create()): CodegenProperty[] { | ||
export function uniquePropertiesIncludingInherited(model: CodegenObjectSchema, result: CodegenProperties = idx.create()): CodegenProperty[] { | ||
if (model.parent) { | ||
@@ -13,0 +13,0 @@ uniquePropertiesIncludingInherited(model.parent, 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
34817