The Acore Language
Syntax Overview
Understanding the PKL foundations of Acore.
Acore is a configuration language built on top of Apple's PKL. Unlike static formats like JSON or YAML, Acore is programmable, typed, and validated.
Key Characteristics
- Declarative: You describe what you want (e.g., "Retry 3 times"), not how to implement it.
- Statically Typed: Your editor (via the upcoming VS Code extension) knows exactly which fields are available from your backend.
- Object-Oriented: Leverage PKL's inheritance to share caching or retry logic across multiple endpoints without duplication.
File Structure
An axiom.acore file typically follows a specific order to maintain clarity and ensure proper object resolution:
- The Bridge: Importing your backend structure via the
amendskeyword. - Metadata: Defining project-specific information like IDs and versioning.
- Variants: Defining different API surfaces for different clients (e.g., Mobile vs. Web).
- Global Policies: Setting default behaviors for all routes.
- Overrides: Specific behavioral rules for individual models or routes.
Example Anatomy
// 1. The Bridge: Connects to your FastAPI app
amends "axiom-python:./main.py:app"
// 2. Metadata: Project identifiers
project {
id = "billing-service"
version = "1.2.0"
}
// 3. Logic & Behavior
variants {
["mobile"] { include = new { "*" } }
}
endpoints {
[Routes.get_invoice] {
cache { strategy = "cache_first"; ttlSeconds = 3600 }
}
}