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.

Last Post!

lud

lud

Yeah confusing as i did not find easily how to send a request :smiley:

Alright so you generate the client once and then edit it. Thank you :slight_smile:

Where Next?

Popular in Discussions Top

wmnnd
The Go vs Elixir thread got me thinking: Would it be too hard to implement a simple mechanism for creating Go-style static app binaries f...
New
nburkley
AWS re:Invent is on at the moment with some interesting announcements. One new feature in particular is the Lambda Runtime API for AWS La...
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 40165 209
New
opsb
We’re considering our architecture from a viewpoint of scaling our traffic heavily over the next 6 months. Our current deployment is runn...
New
owaisqayum
I have a sample string sentence = "Hello, world ... 123 *** ^%&*())^% %%:>" From this string, I want to only keep the integers, ...
New
marciol
Please, let me know if this kind of discussion already took place in another topic . Hi all, how do you consider if is better to build ...
New
pillaiindu
I want to convert a Phoenix LiveView CRUD website to a CRUD mobile app. What do you think is the easiest way to do so?
New

Other popular topics Top

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
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
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 40165 209
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42716 114
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement