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

bartblast
With the core component system and HTTP/WebSocket infrastructure solid, it’s time to tackle Pub/Sub support. What We Have vs What’s Miss...
New
jdumont
I could write forever about this, but I’ll do my best to keep it succinct. For anyone familiar with event sourcing, what is your opinion...
New
Morzaram
Hey everyone. I’m feeling a bit conflicted. I’ve learned Flutter and built a somewhat MVP of this app. I’m a solo dev and throughout this...
New
bartblast
Hey there! :slight_smile: I’m working on updating the Hologram website home page and would love to get your input. Current situation: ...
New
ashkan117
I’m wondering how do people structure their JSON Api’s with Phoenix. Using the blogs example, let’s say I have a blogs view like the foll...
New
garrison
I have been thinking about how I might write a new web framework in Elixir. (Not committing to anything, just thinking about it.) One th...
New
bartblast
Some great comments in the home page thread shifted toward what you’d like to see in Hologram’s future, particularly standalone mode. I’v...
New
AstonJ
A remark @Garrison made… ..has already inspired a thread for the technical side of reclaiming our internet, but there is of course anot...
New
matreyes
I haven’t seen this paper being discussed by the community, but I think this makes Elixir more relevant than ever. TLDR; The paper...
New
PragTob
:wave: I’m currently extracting the statistics calculation part from benchee and stumbled upon how to present error conditions. In the c...
New

Other popular topics Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New

We're in Beta

About us Mission Statement