Skip to content

@param.path generated with lb4 relation considers Wrapper datatypes #3711

@basavarajvs

Description

@basavarajvs

Steps to reproduce

  1. Create 2 related DB tables with table ID as a varchar or uuid
  2. Discover the DB tables with lb4 discover
  3. Create repository for both the tables ( lb4 repository)
  4. run the command "lb4 relation"

Current Behavior

The controller files are generated with methods which have reference to String wrapper under the @param.path

async find(
    @param.path.**_String_**('id') id: String,
    @param.query.object('filter') filter?: Filter<Rolesinsaas>,
  ): Promise<Rolesinsaas[]> {
    return this.accountRepository.rolesinsaas(id).find(filter);
  }

This is causing an error to be thrown on npm start

> src/controllers/account-rolesinsaas.controller.ts:42:17 - error TS2551: Property 'String' does not exist on type '{ string: (name: string, spec?: Partial<ParameterObject> | undefined) => (target: object, member: string, index: number) => void; number: (name: string, spec?: Partial<ParameterObject> | undefined) => (target: object, member: string, index: number) => void; ... 9 more ...; password: (name: string, spec?: Partial<......'. Did you mean 'string'?
> 
> 42     @param.path.String('id') id: String,

Also the parameter.decorator.d.ts file does not contain a reference to the String wrapper data type.

Expected Behavior

lb4 relations should generate @parameter.path.<type> using only the supported data types and not wrapper classes.
or
parameter.decorator.d.ts file should support wrapper data types for String, Number

Link to reproduction sandbox

Additional information

lb4 --version
@loopback/cli version: **1.21.6**

@loopback/* dependencies:
  - @loopback/authentication: ^3.0.0
  - @loopback/boot: ^1.5.5
  - @loopback/build: ^2.0.10
  - @loopback/context: ^1.22.1
  - @loopback/core: ^1.10.1
  - @loopback/metadata: ^1.3.1
  - @loopback/openapi-spec-builder: ^1.2.12
  - @loopback/openapi-v3: ^1.9.6
  - @loopback/repository-json-schema: ^1.9.7
  - @loopback/repository: ^1.13.1
  - @loopback/rest: ^1.18.1
  - @loopback/testlab: ^1.8.0
  - @loopback/docs: ^2.0.0
  - @loopback/example-hello-world: ^1.2.13
  - @loopback/example-log-extension: ^1.2.13
  - @loopback/example-rpc-server: ^1.2.13
  - @loopback/example-todo: ^1.7.6
  - @loopback/example-soap-calculator: ^1.6.14
  - @loopback/service-proxy: ^1.3.5
  - @loopback/http-caching-proxy: ^1.1.12
  - @loopback/http-server: ^1.4.12
  - @loopback/example-todo-list: ^1.9.6
  - @loopback/dist-util: ^0.4.0
  - @loopback/rest-explorer: ^1.3.6
  - @loopback/eslint-config: ^4.0.2
  - @loopback/example-express-composition: ^1.5.6
  - @loopback/example-greeter-extension: ^1.3.13
  - @loopback/booter-lb3app: ^1.2.13
  - @loopback/example-lb3-application: ^1.1.13
  - @loopback/example-greeting-app: ^1.1.13
  - @loopback/example-context: ^1.2.13
  - @loopback/repository-tests: ^0.4.4
  - @loopback/extension-health: ^0.2.5
  - @loopback/authorization: ^0.2.2
  - @loopback/rest-crud: ^0.2.0
  - @loopback/security: ^0.1.1

Related Issues

See Reporting Issues for more tips on writing good issues

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions