Skip to content

Commit 22818f7

Browse files
committed
adaptor; classFilename per Api
1 parent 513df09 commit 22818f7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

adaptor.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ function convertOperation(op,verb,path,pathItem,obj,api) {
428428
return operation;
429429
}
430430

431-
function convertToApis(source,obj) {
431+
function convertToApis(source,obj,defaults) {
432432
let apis = [];
433433
for (let p in source.paths) {
434434
for (let m in source.paths[p]) {
@@ -444,7 +444,13 @@ function convertToApis(source,obj) {
444444
if (!entry) {
445445
entry = {};
446446
entry.name = tagName;
447-
entry.classname = tagName+'Api';
447+
if (defaults.language === 'typescript') {
448+
entry.classname = Case.pascal(entry.name);
449+
}
450+
else {
451+
entry.classname = tagName+'Api';
452+
}
453+
entry.classFilename = tagName+'Api';
448454
entry.classVarName = tagName; // see issue #21
449455
entry.packageName = obj.packageName; //! this may not be enough / sustainable. Or many props at wrong level :(
450456
entry.operations = {};
@@ -789,7 +795,7 @@ function transform(api, defaults, callback) {
789795
obj.produces = [];
790796

791797
obj.apiInfo = {};
792-
obj.apiInfo.apis = convertToApis(api,obj);
798+
obj.apiInfo.apis = convertToApis(api,obj,defaults);
793799

794800
obj.produces = convertArray(obj.produces);
795801
obj.consumes = convertArray(obj.consumes);

0 commit comments

Comments
 (0)