tsoa-custom-decorators
Version:
Build swagger-compliant REST APIs using TypeScript and Node
32 lines (28 loc) • 884 B
text/typescript
import { TestModel, TestSubModel, TestClassModel } from '../testModel';
export class ModelService {
public getModel(): TestModel {
return {
boolArray: [true, false],
boolValue: true,
id: 1,
modelValue: {
email: 'test@test.com',
id: 100,
},
modelsArray: new Array<TestSubModel>(),
numberArray: [1, 2, 3],
numberValue: 1,
optionalString: 'optional string',
strLiteralArr: ['Foo', 'Bar'],
strLiteralVal: 'Foo',
stringArray: ['string one', 'string two'],
stringValue: 'a string'
};
}
public getClassModel(): TestClassModel {
const testClassModel = new TestClassModel('constructor var', 'private constructor var');
testClassModel.id = 1;
testClassModel.publicStringProperty = 'public string property';
return testClassModel;
}
}