influxdata / influxdata/influxdb

refactor HTTP handling to use an openapi-compatible framework

Open
#26,176 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

I've seen a couple discussions on PRs since I joined the team where the possibility of refactoring our HTTP API route handling has come up. A couple of good reasons do to this (in my view) include:

  • Make it easier to define enterprise-specific routes separately from OSS/Core routes.
  • Make it possible to programmatically generate OpenAPI docs.

My suggestion, mostly due to being familiar with it, is to go with axum. With axum we can more easily separate enterprise from core routes (what we have today is somewhat complicated by the use of one large (HTTP_METHOD, HTTP_ROUTE) match block) and we can integrate an existing open api spec generator: https://docs.rs/aide/latest/aide/index.html

If we were to go with axum + aide, we get features like the ability to extended the axum-based spec generation with generated request type examples that help customers understand exactly how to construct different forms of our request types, eg https://github.com/tamasfe/aide/blob/master/examples/example-axum/src/todos/routes.rs#L110

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by mapping the current HTTP API route handling and its large (HTTP_METHOD, HTTP_ROUTE) match block. Compare the proposed axum + aide approach with the linked aide example, then define how enterprise/Core route separation and generated OpenAPI docs would be validated. The issue names no files or tests, so repository exploration and design agreement are prerequisites.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, rust
Domain
api, backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.