Skip to content

Swagger frontend generates faulty URL when filtering #250

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

Closed
t0rs opened this issue Oct 25, 2024 · 6 comments
Closed

Swagger frontend generates faulty URL when filtering #250

t0rs opened this issue Oct 25, 2024 · 6 comments
Labels
bug Something isn't working needs review

Comments

@t0rs
Copy link

t0rs commented Oct 25, 2024

When trying to filter on something like this:

{"id": {"eq": "f9d691ee-5f13-4a75-8c13-b917b640119c"}}

Image:

image

It does not generate the correct url which has this included:

?filter[id][eq]=f9d691ee-5f13-4a75-8c13-b917b640119c

But instead generates:

?filter[id]={"eq":"f9d691ee-5f13-4a75-8c13-b917b640119c"}
@t0rs t0rs added bug Something isn't working needs review labels Oct 25, 2024
@zachdaniel
Copy link
Contributor

This is so strange. You're the second person to report this but I can't seem to reproduce this 😢

@zachdaniel
Copy link
Contributor

Okay, I've got it reproduced. Unfortunately I'm not sure if there is much that I can do about it yet.

@zachdaniel
Copy link
Contributor

Relevant issue: OAI/OpenAPI-Specification#1706

@zachdaniel
Copy link
Contributor

@mbuhot Maybe you have some thoughts here? We have a parameter of style :deepObject. It has some fields who's values are :object and some who's value are not (or could be a union of string or object even). The value is being encoded as a JSON string which seems like a very very strange choice. I have a "fix" which is that if the inner things are marked as a :deepObject also (for whatever reason), it just shows a "regular" text box. I could then detect the value of "filter" being a string and query decode it as an object 😂

We should set up a test project we can run locally to try out swagger UI, because I don't have a great way to share an example here currently aside from saying mix igniter.new --with phx.new --install ash,ash_json_api --example --extend json_api and then add an index route.

@zachdaniel
Copy link
Contributor

Okay, @t0rs I've "fixed" this in main in a way I'm not very happy with. Now you type in the query string directly. i.e first_name[eq]=foo&last_name[eq]=bar

@zachdaniel
Copy link
Contributor

I'm not really sure any other way to fix this given the behavior in swagger_ui 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs review
Projects
None yet
Development

No branches or pull requests

2 participants