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

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

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

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

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

Loading…
Cancel
Save