πŸ§ͺ

raps-mock

Test APS integrations without credentials

A comprehensive mock server for Autodesk Platform Services (APS) APIs, auto-generated from OpenAPI specifications.

What is raps-mock?

raps-mock is a comprehensive mock server for Autodesk Platform Services (APS) APIs. It auto-generates routes from OpenAPI 3.0 specifications and can run in either stateless (fixed responses) or stateful (in-memory storage) mode.

Built with Rust for reliability and performance, raps-mock can be used as a standalone server or as a library in your Rust projects.

Why raps-mock?

The Problem: Developing against live APS APIs requires valid credentials, costs tokens for Model Derivative operations, and creates test data pollution in your ACC environment. Network issues can derail your development session. CI/CD pipelines become flaky when dependent on external services.

The Solution: raps-mock provides a fully functional APS mock server that runs locally or in your CI environment. Test your integrations without credentials, without costs, without network dependencies.

Use Cases

  • Local Development - Work offline, iterate quickly, no credential setup for new team members
  • CI/CD Testing - Reliable, deterministic tests that don’t depend on external services
  • Demo Environments - Show APS features without real data or credentials
  • Learning - Experiment with APS APIs without consequences

Key Features

  • Auto-generated routes from OpenAPI 3.0 specifications
  • Configurable modes: Stateless (fixed responses) or Stateful (in-memory storage)
  • Library and CLI: Use as a library or standalone server
  • Full APS coverage: Authentication, OSS, Data Management, Model Derivative, Construction, Webhooks
  • Custom handlers: Extend with custom endpoint handlers
  • Type-safe: Built with Rust for reliability and performance

Quick Start

As a Standalone Server

# Start the mock server (stateful mode by default)
raps-mock --port 3000

# Start in stateless mode (fixed OpenAPI example responses)
raps-mock --port 3000 --mode stateless

# With custom OpenAPI directory
raps-mock --openapi-dir ./my-openapi-specs --port 3000

As a Library

use raps_mock::{'{'}MockServer, MockServerConfig, MockMode{'}'};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {'{'}
    let config = MockServerConfig {'{'}
        mode: MockMode::Stateful,
        openapi_dir: "../aps-sdk-openapi".into(),
        ..Default::default()
    {'}'};

    let server = MockServer::new(config).await?;
    server.start("0.0.0.0:3000").await?;
    Ok(())
{'}'}

In Integration Tests

use raps_mock::testing::TestServer;

#[tokio::test]
async fn test_bucket_creation() {'{'}
    // Start mock server on random port
    let server = TestServer::start_default().await.unwrap();

    // Use any HTTP client against server.url
    let client = reqwest::Client::new();
    let response = client
        .post(&format!("{'{}'}​/oss/v2/buckets", server.url))
        .json(&serde_json::json!({'{'}
            "bucketKey": "test-bucket",
            "policyKey": "transient"
        {'}'}))
        .send()
        .await
        .unwrap();

    assert!(response.status().is_success());
{'}'}

Configuration

Command Line Options

OptionShortDefaultDescription
--port-p3000Server port
--host-H0.0.0.0Server host
--mode-mstatefulstateless or stateful
--openapi-dir../aps-sdk-openapiPath to OpenAPI specs
--state-file-Path to state persistence file
--verbose-vfalseEnable verbose logging

Modes Explained

Stateful Mode (Default)

In stateful mode, the mock server maintains in-memory state. Operations have side effects:

  • Creating a bucket adds it to the list
  • Uploading an object associates it with a bucket
  • Starting a translation creates a job with status that can be queried
  • Deleting resources removes them from state

This mode is ideal for testing workflows that span multiple API calls.

Stateless Mode

In stateless mode, every request returns fixed responses based on OpenAPI specification examples. No state is maintained between requests.

This mode is useful for:

  • Simple contract testing
  • Validating request/response formats
  • Scenarios where state persistence isn’t needed

Supported APIs

APIVersionStatusNotes
Authenticationv2Full2-legged and 3-legged OAuth simulation
OSS (Buckets)v2FullCreate, list, delete buckets
OSS (Objects)v2FullUpload metadata, listing, signed URLs
Data Managementv1FullHubs, projects, folders, items
Model Derivativev2FullTranslation jobs, manifests, status
Construction Issuesv1FullIssues CRUD, comments
ACC Account Adminv1PartialBasic account operations
Webhooksv1FullSubscription management
ACC Submittalsv1PlannedPhase 1
ACC Checklistsv1PlannedPhase 1
ACC RFIsv1PlannedPhase 1
ACC Assetsv1PlannedPhase 1
Design Automationv3PlannedPhase 4
Reality Capturev1PlannedPhase 4

Integration with RAPS CLI

raps-mock is designed to work seamlessly with the RAPS CLI:

# Terminal 1: Start mock server
raps-mock --port 3000

# Terminal 2: Configure raps to use mock server
export APS_BASE_URL=http://localhost:3000
export APS_CLIENT_ID=mock-client
export APS_CLIENT_SECRET=mock-secret

# Now raps commands work against the mock
raps auth test
raps bucket create --key test-bucket --policy transient
raps bucket list

Roadmap

  • Phase 1 (v0.3.0): Complete ACC module coverage (Submittals, Checklists, RFIs, Assets)
  • Phase 2 (v0.4.0): State persistence and fixtures
  • Phase 3 (v0.5.0): Simulation capabilities (latency, errors, progress)
  • Phase 4 (v0.6.0): Design Automation and Reality Capture
  • Phase 5 (v0.7.0): Developer experience (recording, dashboard, validation)
  • Phase 6 (v1.0.0): Docker, GitHub Actions, production release

Related Products