Skip to content

Add rjapi as a Rust implementation of JSON:API - #1800

Open
mohdbk wants to merge 1 commit into
json-api:gh-pagesfrom
mohdbk:gh-pages
Open

Add rjapi as a Rust implementation of JSON:API#1800
mohdbk wants to merge 1 commit into
json-api:gh-pagesfrom
mohdbk:gh-pages

Conversation

@mohdbk

@mohdbk mohdbk commented Sep 22, 2025

Copy link
Copy Markdown

This PR adds rjapi as a new Rust implementation of the JSON:API 1.1 specification to the implementations list.

Implementation Details

rjapi is a framework-agnostic, type-safe JSON:API 1.1 implementation for Rust that provides:

  • βœ… Full JSON:API 1.1 compliance - Complete support for the specification
  • πŸš€ Framework-agnostic design - Works with Axum, Actix-web, Rocket, and any Rust web framework
  • πŸ›‘οΈ Type-safe by design - Leverages Rust's type system for compile-time guarantees
  • πŸ“¦ Production-ready - Comprehensive documentation, examples, and test coverage
  • πŸ”§ Easy to use - Ergonomic API with builder patterns and trait-based resource definitions

Links

Implementation Features

  • Complete JSON:API document structures (resources, relationships, errors, meta)
  • Request/response handling with type-safe extractors
  • Middleware for content-type validation
  • Query parameter support (filtering, sorting, pagination, sparse fieldsets)
  • Comprehensive error handling with standard HTTP status codes
  • Framework integration examples (Axum provided, others compatible)

Code Example

use rjapi::{JsonApiResponse, JsonApiResource, Resource};
use serde_json::json;

#[derive(Serialize)]
struct Post {
    id: String,
    title: String,
    content: String,
}

impl JsonApiResource for Post {
    const RESOURCE_TYPE: &'static str = "posts";

    fn id(&self) -> String {
        self.id.clone()
    }

    fn attributes(&self) -> serde_json::Value {
        json!({
            "title": self.title,
            "content": self.content,
        })
    }
}

// Create JSON:API compliant response
let response = JsonApiResponse::new(resource).build();

Maintainer

  • Author: Mohamed Al Ali
  • GitHub: @mohdbk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants