Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter in query of type object treated as string #394

Closed
b-admike opened this issue Jun 24, 2017 · 2 comments
Closed

Filter in query of type object treated as string #394

b-admike opened this issue Jun 24, 2017 · 2 comments
Labels

Comments

@b-admike
Copy link
Contributor

Description/Steps to reproduce

Define a parameter for a route which has type object

  paths: {
    '/accounts': {
      get: {
        'x-operation-name': 'getAccount',
        parameters: [
          {
            name: 'filter',
            in: 'query',
            description: 'The criteria used to narrow down the number of accounts returned.',
            required: false,
            type: 'object'
          }

method in controller:

  async getAccount(filter) {
    return await this.repository.find(filter);
  }

Expected result

The parameter filter should be of type object if we check it in the controller method for the route.

Additional information

___________________    | ~/routertestapp @ biniams-mbp (badmike)
| => node -e 'console.log(process.platform, process.arch, process.versions.node)'
darwin x64 8.0.0
___________________    | ~/routertestapp @ biniams-mbp (badmike)
| => npm ls --prod --depth 0 | grep loopback
└── @loopback/[email protected]
@bajtos
Copy link
Member

bajtos commented Jul 13, 2017

Note that in SwaggerSpec 2.x (which LoopBack Next is based on so far), query parameters can have only primitive type (string, number, etc.), see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterObject

However, for LB 3.x backwards compatibility, I have proposed to support complex types in query strings, see #100.

I've been told that OpenAPI Spec 3.0 will support complex objects in query parameters. In which case we need to upgrade LB.next to OpenAPI Spec 3.0 first, see #182.

@dhmlau
Copy link
Member

dhmlau commented Mar 27, 2018

Closing as duplicate of #100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants