manuel-rubio

manuel-rubio

A portolan was a medieval nautical chart describing ports and the routes between them. Portolan does the same for your Phoenix API.

Portolan is removing the boilerplate. Uses types, comments, and the definition of the routes to create the documentation your users need for implementing your great service :slight_smile:

Portolan builds the OpenAPI document of a Phoenix application from what the code already says:

  • the router gives the paths, verbs and actions
  • @spec gives the parameters and responses of every action
  • @type gives the schemas
  • @moduledoc, @doc and @typedoc give the descriptions
  • @deprecated marks deprecated operations

There is no extra DSL to learn and nothing to keep in sync. If something needed for the document is missing, such as an action without @spec or a type that cannot be represented in JSON, the build fails with a compiler diagnostic pointing to the exact file and line.

Check it out and let me know if you have suggestions or improvements.

Showing Posts 1 to 5

ryanzidago

ryanzidago

Pretty cool!

krasenyp

krasenyp

I’m still waiting for a library to generate a Phoenix API from an OpenAPI spec.

manuel-rubio

manuel-rubio OP

Challenge accepted :wink:

lud

lud

What would that look like? I was interested to add a similar thing into Oaskit but at some point you need to add business logic: the spec does not tell what the controller does. And a simple phoenix controller is a very short and concise way to wrap the logic calls.

I can imagine a shortcut in oaskit like operation :foo, request_body: SomeSchema, do: &SomeModule.some_fun/2 that calls SomeModule.some_fun(request_body, context) but I don’t like adding macro layers for the sake of saving a few keystroke (or tokens…).

We could do basic CRUD stuff, but an independent macro that declares a controller, an Ecto action and the OpenAPI operation would give more control to the developer. And yet you still have to move permissions or other validations somewhere else, so it’s displaced in plugs, and now your are repeating some logic on different layers.

Nothing beats a simple Phoenix router + controller layers setups in my opinion.

Challenge accepted :wink:

But I’d be glad to see how it goes.

manuel-rubio

manuel-rubio OP

The idea isn’t you get the whole application done. The idea is you get the scaffolding for Phoenix, routing, controllers, serialization, params, … everything in place only to write your business logic in place.

— All posts loaded —

Where Next? Top

Trending in Announcing Top

achempion
Hi, I would like to tell about my initiative to further maintain and develop Waffle project which is the fork of Arc library. The progre...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
gtcode
Aloha gang, There’s a new class of AI model out from TypeSafe. Jev is their flagship model. You can learn about it here: ...
New
danschultzer
I’ve moved the strategies out of PowAssent and created a multi-provider framework for Elixir. This way the strategies can be used in any ...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
raa-ziq
Hi everyone :waving_hand: I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
AstonJ
With advancements in AI gathering pace and set to increasingly accelerate, perhaps it’s worth having an annual thread on the topic - feel...
New
bartblast
If you haven’t tried Hologram yet, what’s stopped you? Here’s why I’m asking. Building a framework turns out to be two jobs, the framewo...
New
mat-hek
Popcorn, the library that runs Elixir code in the browser, is now stable :popcorn: This is possible because it now builds on a very stab...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews