lud

lud

What OpenAPI client/generator do you use on the frontend?

Hello,

I’m working on the support for array parameters in Oaskit and there is a difference between how OpenAPI and Phoenix handle them.

In OpenAPI you can declare a query parameter with explode: true which means that passing ?users=Alice&users=Bob should give users: ["Alice", "Bob"] when deserialized.

With Phoenix, this will give users: "Bob". You need to encode it as ?users[]=Alice&users[]=Bob if you want an array.

OpenAPI can support that, you just have to include the [] suffix in the parameter name: "parameters": [{"name": "users[]", "in": "query", "schema": {"type": "array"}}].

So my goal is to automatically include the brackets suffix for array parameters when dumping the API spec to JSON. But I need to check if this is correctly handled by different clients.

My team uses Orval and it seems to work fine. The query parameter can be called users or users[] in the OpenAPI spec, in both cases Orval sends the same thing. Though it sends users%5B%5D instead of users[] but this is valid.

I would like to do the same test with different clients, starting by those used in the community. Can you tell my what client or generator do you use for OpenAPI 3.1?

Thank you :slight_smile:

Most Liked

dimitarvp

dimitarvp

You lost me here. Who and how and why is dumping an API spec to JSON? From what format? Do you mean from f.ex. a JS or Elixir project that have tags that the tooling uses to produce a spec?

I only ever used the official openapi-generator but I strongly recommend openapi-tui for inspection. Helped me multiple times in the last year.

dimitarvp

dimitarvp

I have honestly forgotten, last time I used it was several months ago, but I was generating Rust clients for various APIs and then making sure they work and make small adjustments here and there. In general I was very happy with the quality. But not much recent memories on using it for Elixir, sorry.

Did you find it confusing to use?

RE: openapi-tui, it was also some months ago. Not sure I ever used :query though, I was kind of exploring what was there in APIs and then used the generated clients.

Where Next?

Popular in Discussions Top

PragTob
Hello everyone, I know we had quite some threads (read through lots of them) about background job processing but it remains a hotly deba...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 53690 245
New
thojanssens1
It would be nice to be able to define a redirect from one route to another from the router.ex file. E.g.: redirect "/", UserController, ...
New
arcanemachine
https://nitter.net/josevalim/status/1744395345872683471 https://twitter.com/josevalim/status/1744395345872683471
New
AstonJ
Are there any Elixir or Erlang libraries that help with this? I’ve been thinking how streaming services like twitch have exploded recentl...
New
sashaafm
Piggy backing a bit on @dvcrn topic BEAM optimization for functions with static return type?, I’ve been trying to understand in a deeper ...
New
tmbb
This is a post to discuss the new Phoenix LiveView functionality. From Chris’s talk, it appears that they generate all HTML on the serve...
342 18146 126
New
praveenperera
How We Replaced React with Phoenix By: Thought Bot
New
shishini
I think this twitter post and youtube video didn’t get as much attention as I hoped I am still new to Elixir, so can’t really judge ...
New
CharlesO
Erlang :list.nth simple, but 1 - based nth(1, [H|_]) -> H; nth(N, [_|T]) when N > 1 -> nth(N - 1, T). Elixir Enum.at … coo...
New

Other popular topics Top

lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39297 209
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New

We're in Beta

About us Mission Statement