@openapi-generator-plus/generator-common
Advanced tools
Comparing version 0.3.1 to 0.3.2
import { CodegenGenerator, CodegenServer } from '@openapi-generator-plus/types'; | ||
export * from './case-transforms'; | ||
export * from './http-methods'; | ||
export declare function commonGenerator<O>(): Pick<CodegenGenerator<O>, 'toOperationName' | 'toModelNameFromPropertyName'>; | ||
export declare function commonGenerator<O>(): Pick<CodegenGenerator<O>, 'toOperationName' | 'toModelName'>; | ||
export declare function apiBasePath(servers: CodegenServer[] | undefined): string; |
@@ -9,2 +9,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const types_1 = require("@openapi-generator-plus/types"); | ||
const case_transforms_1 = require("./case-transforms"); | ||
@@ -25,4 +26,9 @@ __export(require("./case-transforms")); | ||
}, | ||
toModelNameFromPropertyName: (name, state) => { | ||
return state.generator.toClassName(pluralize_1.default.singular(name), state); | ||
toModelName: (name, options, state) => { | ||
if (options.purpose === types_1.CodegenSchemaPurpose.ARRAY_ITEM || options.purpose === types_1.CodegenSchemaPurpose.MAP_VALUE) { | ||
return state.generator.toClassName(pluralize_1.default.singular(name), state); | ||
} | ||
else { | ||
return state.generator.toClassName(name, state); | ||
} | ||
}, | ||
@@ -29,0 +35,0 @@ }; |
{ | ||
"name": "@openapi-generator-plus/generator-common", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Common utilities for openapi-generator-plus generators", | ||
@@ -24,3 +24,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@openapi-generator-plus/types": "^0.7.0", | ||
"@openapi-generator-plus/types": "^0.8.0", | ||
"pluralize": "^8.0.0", | ||
@@ -32,3 +32,3 @@ "url-parse": "^1.4.7" | ||
}, | ||
"gitHead": "1417dfe522b31430bfd1e3f7274ef8efe4ef695a" | ||
"gitHead": "ef8774d3f7001408a65789bd3ad2a8939a3520d8" | ||
} |
@@ -1,2 +0,2 @@ | ||
import { CodegenGenerator, CodegenServer } from '@openapi-generator-plus/types' | ||
import { CodegenGenerator, CodegenServer, CodegenSchemaPurpose } from '@openapi-generator-plus/types' | ||
import { camelCase } from './case-transforms' | ||
@@ -8,3 +8,3 @@ export * from './case-transforms' | ||
export function commonGenerator<O>(): Pick<CodegenGenerator<O>, 'toOperationName' | 'toModelNameFromPropertyName'> { | ||
export function commonGenerator<O>(): Pick<CodegenGenerator<O>, 'toOperationName' | 'toModelName'> { | ||
return { | ||
@@ -21,4 +21,8 @@ | ||
toModelNameFromPropertyName: (name, state) => { | ||
return state.generator.toClassName(pluralize.singular(name), state) | ||
toModelName: (name, options, state) => { | ||
if (options.purpose === CodegenSchemaPurpose.ARRAY_ITEM || options.purpose === CodegenSchemaPurpose.MAP_VALUE) { | ||
return state.generator.toClassName(pluralize.singular(name), state) | ||
} else { | ||
return state.generator.toClassName(name, state) | ||
} | ||
}, | ||
@@ -25,0 +29,0 @@ |
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
29107
400
+ Added@openapi-generator-plus/types@0.8.0(transitive)
- Removed@openapi-generator-plus/types@0.7.1(transitive)