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

fklement
This is a thread to gather some information about the efforts of using elixir in combination with cars or vehicular systems in general. ...
New
adamu
When starting a new project, do you have any go-to libraries you pull in out of habit/preference? For example, Ash, Credo, Mox, ExMachin...
New
fireproofsocks
I’m not a Lambda fan-boy because I think it’s overprescribed as a cure-all for every possible problem when in reality, Lambdas are best s...
New
rump13
Hi everyone, I’ve been following Elixir since around 2016 and tinkering with it on and off, but I haven’t had the opportunity to use it ...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
billylanchantin
If you’re not familiar with this fun bit of math lore, Paul Erdős, the famously eccentric, peripatetic and prolific 20th-century mathem...
New
markmark206
Every time I build a web app, I worry about a bunch of basic things (persisting data, knowing when to compute which things, keeping thing...
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
derpycoder
So, anyone got a chance to look at this?!? I’m kind of glad this came along. We can just throw this into our Auth pages and won’t have t...
New
dogweather
I’ve been brainstorming about ways to solve the N-dimensional code organization problem, and am thinking about developing a Smalltalk-lik...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3268 119930 1237
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
William
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New

We're in Beta

About us Mission Statement