-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
API Explorer ignores filter options where, fields, and order #2208
Comments
I assume this is happening when making the request from the API Explorer, is that correct? I am afraid this is a known bug/limitation of swagger-ui and swagger-js, see the discussion in #1679 and the tracking issue swagger-api/swagger-js#1385. You can see this yourself in API Explorer UI. When you send the request, the UI shows the full URL, request headers and response headers. There you can see that the request URL created by API Explorer (swagger-js) does not contain the filter properties. Unfortunately swagger-ui does not warn the user about this problem, which makes the entire experience less than ideal. Having said that, the actual implementation in LoopBack4 does support where/fields/order, you need to create the request URL manually or use a different OpenAPI client.
LoopBack 4 uses the same format as LoopBack 3 does. I agree our documentation should be more explicit about this fact. To keep things simple, maybe it's enough to add a link pointing to existing LB3 docs? Would you like to contribute such change yourself? See https://loopback.io/doc/en/contrib/doc-contrib.html to get started. |
Me and my team we are using this great framework, loopback 2 and 3 from more 3 year and we are testig the new loopback 4 version to upgrade some of our apps. I installed the last versión of Loopback from CLI @loopback/cli version: 1.5.2. and the problem related with the atributes "where", "fields", and "order not works. Of course if generated the services from swagger generator for angular 6 the problem persist if you try to pass any filters, orders or fields from the services created. Like a user of loopback for many years and like @ewrayjohnson said, LoopBack 4 GA can't be launch to production!. Where do you resolve this problem related with Open API? Regards. |
Filter parameter value in UI: { Generated query: |
Hello, any update for this issue? |
Not really. Re-posting one of my earlier comments:
@sergiomata Would you like to contribute the necessary changes to swagger-js yourself? |
Based on OAI/OpenAPI-Specification#1706 (comment) (cross-posted below), maybe we can switch Here is an experiment we can try:
The comment:
|
In the url I passed in ?where={"id":"1"} and it worked in the controller if I put this.userRepository.find({where}). However, if I put ?where={"is":"1"} (an invalid where), then it returns all the users and ignores the where clause. Is this expected behaviour/a limitation? |
This is a known bug in our SQL connector(s), see loopbackio/loopback-connector#125 and loopbackio/loopback-connector#132 |
@deepakrkris, do you think you can add acceptance criteria for this task? Thinking whether we can include this in Dec. Thanks. |
IMO, we need to finish the spike story #3770 first. Until then, we don't know how the solution is going to look like. |
all tasks completed, acceptance criteria satisfied. |
@deepakrkris Just wanted to thank you for this work. It's a welcome relief to be able to write my filters normally, instead of weird workarounds like "include][][relation": "someRelation" and so on. Cheers! |
@deepakrkris: I just looked back to when I first reported this. Its been a long journey. Thanks for persevering and resolving this impediment! |
I am using the example Todo model with the memory connector. The GET/ operations show the following example filter object, but "where", "fields", and "order "o are stripped before getting to the controller's find method.
From other posts, this may be a coercion issue, but I would expect this functionality from LB3 to work flawlessly in LB4. I strongly disagree with the announcement that "...LoopBack 4 GA is Now Ready for Production Use!" Also, I cannot find ANY documentation on filters in the LB4 documentation. My test filter is as simple as:
Acceptance Criteria:
including content field in param spec, helps to support both exploded filter conditions like filter[limit] = 0 and json objects as per spike PR feat: spike on API Explorer supporting complex objects in query param #4141
content
field along withschema
,explode
,type
fields. swagger validation fails (check with https://editor.swagger.io/) if they appear together.content
field. if we are including schema undercontent
and notschema
field, then it means additional changes in tests and source.The text was updated successfully, but these errors were encountered: