Browse Source

fix: avoid lint errors in schematics

pull/5137/head
Arman Ozak 6 years ago
parent
commit
edadf0e74e
  1. 10
      npm/ng-packs/packages/schematics/src/models/method.ts
  2. 2
      npm/ng-packs/packages/schematics/src/models/model.ts
  3. 2
      npm/ng-packs/packages/schematics/src/utils/model.ts

10
npm/ng-packs/packages/schematics/src/models/method.ts

@ -41,20 +41,20 @@ export class Body {
url: string;
registerActionParameter = (param: ParameterInBody) => {
let { bindingSourceId, descriptorName, name, nameOnMethod } = param;
name = strings.camelize(name);
const value = descriptorName ? `${descriptorName}.${name}` : nameOnMethod;
const { bindingSourceId, descriptorName, name, nameOnMethod } = param;
const camelName = strings.camelize(name);
const value = descriptorName ? `${descriptorName}.${camelName}` : nameOnMethod;
switch (bindingSourceId) {
case eBindingSourceId.Model:
case eBindingSourceId.Query:
this.params.push(`${name}: ${value}`);
this.params.push(`${camelName}: ${value}`);
break;
case eBindingSourceId.Body:
this.body = value;
break;
case eBindingSourceId.Path:
const regex = new RegExp('{' + name + '}', 'g');
const regex = new RegExp('{' + camelName + '}', 'g');
this.url = this.url.replace(regex, '${' + value + '}');
break;
default:

2
npm/ng-packs/packages/schematics/src/models/model.ts

@ -31,7 +31,7 @@ export type InterfaceOptions = Omissible<Interface, 'properties'>;
export class Property {
name: string;
type: string;
default: string = '';
default = '';
optional: '' | '?' = '';
refs: string[] = [];

2
npm/ng-packs/packages/schematics/src/utils/model.ts

@ -55,7 +55,7 @@ export function createImportRefsToModelReducer(params: ModelGeneratorParams) {
});
models.forEach(model => {
let toBeImported: TypeWithEnum[] = [];
const toBeImported: TypeWithEnum[] = [];
model.interfaces.forEach(_interface => {
const { baseType } = types[_interface.ref];

Loading…
Cancel
Save