{
  "openapi": "3.1.0",
  "info": {
    "title": "Rust Data Types Field Guide API",
    "version": "1.0.0",
    "description": "Beginner-friendly and expert-level reference material for common Rust data types."
  },
  "servers": [{ "url": "/" }],
  "paths": {
    "/api/rust-types": {
      "get": {
        "operationId": "listRustTypeGuides",
        "summary": "List every Rust type guide",
        "responses": {
          "200": {
            "description": "All available guides",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GuideCollection" } } }
          }
        }
      }
    },
    "/api/rust-types/{slug}": {
      "get": {
        "operationId": "getRustTypeGuide",
        "summary": "Get one Rust type guide",
        "parameters": [{
          "name": "slug",
          "in": "path",
          "required": true,
          "schema": { "type": "string", "enum": ["str-slice", "string", "i32", "u64", "bool", "f64", "char"] }
        }],
        "responses": {
          "200": {
            "description": "A matching guide",
            "content": { "application/json": { "schema": { "type": "object", "properties": { "schemaVersion": { "type": "string" }, "type": { "$ref": "#/components/schemas/Guide" } } } } }
          },
          "400": {
            "description": "No guide matches the slug",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Guide": {
        "type": "object",
        "required": ["slug", "typeName", "category", "summary", "code", "beginner", "mentalModel", "useWhen", "watchFor", "expertNote", "relatedTypes", "officialDocs"],
        "properties": {
          "slug": { "type": "string" },
          "typeName": { "type": "string" },
          "category": { "type": "string", "enum": ["text", "integer", "scalar"] },
          "accent": { "type": "string" },
          "eyebrow": { "type": "string" },
          "summary": { "type": "string" },
          "code": { "type": "string" },
          "beginner": { "type": "string" },
          "mentalModel": { "type": "string" },
          "useWhen": { "type": "array", "items": { "type": "string" } },
          "watchFor": { "type": "array", "items": { "type": "string" } },
          "expertNote": { "type": "string" },
          "relatedTypes": { "type": "array", "items": { "type": "string" } },
          "officialDocs": { "type": "string", "format": "uri" }
        }
      },
      "GuideCollection": {
        "type": "object",
        "required": ["schemaVersion", "title", "description", "count", "types"],
        "properties": {
          "schemaVersion": { "type": "string" },
          "title": { "type": "string" },
          "description": { "type": "string" },
          "count": { "type": "integer" },
          "types": { "type": "array", "items": { "$ref": "#/components/schemas/Guide" } },
          "discovery": { "type": "object" }
        }
      },
      "ApiError": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": { "type": "string" },
          "availableSlugs": { "type": "array", "items": { "type": "string" } },
          "allowedMethods": { "type": "array", "items": { "type": "string" } }
        }
      }
    }
  }
}
