#actix-web #oas3 #openapi #documentation

apistos-shuttle

Actix-web OpenAPI v3.0 documentation generator

27 releases (16 unstable)

Uses new Rust 2024

new 1.0.0-pre-release.12 Apr 29, 2025
1.0.0-pre-release.9 Sep 19, 2024
1.0.0-pre-release.2 Jun 29, 2024
0.5.1 Apr 10, 2025
0.3.4 Jul 12, 2024

#1312 in HTTP server

Download history 1/week @ 2025-02-10 3/week @ 2025-02-24 11/week @ 2025-03-03 108/week @ 2025-03-24 11/week @ 2025-03-31 126/week @ 2025-04-07 20/week @ 2025-04-14 218/week @ 2025-04-21

380 downloads per month

MIT/Apache

130KB
2K SLoC

Apistos Shuttle   Documentation Latest Version Build Status Deps Status

This crate allows you to run an actix-web server documented with Apistos on Shuttle.

Installation

[dependencies]
schemars = "=1.0.0-alpha.15"
apistos = { version = "=1.0.0-pre-release.11" }
apistos-shuttle = { version = "=1.0.0-pre-release.11" }

Example

use actix_web::web::Json;
use actix_web::Error;

use apistos::api_operation;
use apistos::info::Info;
use apistos::spec::Spec;
use apistos::web::{get, resource, ServiceConfig};
use apistos_shuttle::{ApistosActixWebService, ShuttleApistosActixWeb};

#[api_operation(summary = "Say 'Hello world!'")]
pub(crate) async fn hello_world() -> Result<Json<String>, Error> {
  Ok(Json("Hello world!".to_string()))
}

#[shuttle_runtime::main]
async fn actix_web() -> ShuttleApistosActixWeb<impl FnOnce(&mut ServiceConfig) + Send + Clone + 'static> {
  let spec = Spec {
    info: Info {
      title: "A well documented API running on Shuttle".to_string(),
      description: Some(
        "This is an API documented using Apistos,\na wonderful new tool to document your actix API !".to_string(),
      ),
      ..Default::default()
    },
    ..Default::default()
  };

  let service_config = move |cfg: &mut ServiceConfig| {
    cfg.service(resource("/").route(get().to(hello_world)));
  };

  Ok(ApistosActixWebService {
    spec,
    service_config,
    openapi_path: "/openapi".to_string(),
  })
}

[!IMPORTANT]
Default features are disabled for shuttle-runtime to avoid pulling colored which as a license considered as copyleft by cargo-deny. To implement your own tracing, please visit https://docs.shuttle.rs/configuration/logs

About us

apistos is provided by Netwo.

We use this crate for our internal needs and therefore are committed to its maintenance, however we cannot provide any additional guaranty. Use it at your own risks.

While we won't invest in any feature we don't need, we are open to accept any pull request you might propose.

We are a France based full-remote company operating in the telecom industry. If you are interested in learning more, feel free to visit our career page.

Dependencies

~24–39MB
~652K SLoC