This directory contains the OpenAPI specifications for the Network Access Management API, organized into modular components for better maintainability and reusability.
The API definitions have been restructured from a monolithic approach to a modular, component-based architecture. This allows for better code reuse, easier maintenance, and cleaner separation of concerns.
API_definitions/
├── README.md # This file (authoring & process docs)
├── redocly.yaml # Lint/bundle configuration (Redocly CLI)
├── network-access-management.yaml # Source API spec with $ref references (committed on main)
├── common/
│ └── CAMARA_common.yaml # Shared CAMARA-style error responses
└── modules/ # Modular domain-focused component files
├── NAM_Common.yaml # Shared primitives (UUID, DateTime, ResourceAudit, securitySchemes)
├── AccessDetail.yaml # Discriminated access detail variants (Wi-Fi, Thread)
├── Capabilities.yaml # Device capability schemas
├── Policy.yaml # Trust Domain policy schemas (maxDevices, bandwidth, egress)
├── NetworkAccessDevices/ # Network Access Device resource schemas
├── RebootRequests/ # Reboot Request lifecycle schemas
├── Services/ # Service and ServiceSite schemas
└── TrustDomains/ # Trust Domain & related capability schemas
Before: Single monolithic OpenAPI file (network-access-management.yaml)
- ✅ Simple to understand initially
- ❌ Became very large (2000+ lines)
- ❌ Hard to maintain and review
- ❌ Schema duplication across different APIs
- ❌ Merge conflicts in collaborative development
- ❌ No reusability between different API specifications
After: Modular component-based structure
- ✅ Each file has a single, clear responsibility
- ✅ Reusable schemas can be shared across APIs
- ✅ Easier to review and maintain individual components
- ✅ Parallel development by different team members
- ✅ Clear separation of concerns
- ✅ Smaller, focused files
| File | Purpose | Reusability |
|---|---|---|
Common.yaml |
Base types (UUID, DateTime, ErrorInfo) | High - used across all APIs |
Policy.yaml |
Trust Domain governance policies | Medium - Trust Domain specific |
AccessDetail.yaml |
Network access configurations | Medium - Network-related APIs |
TrustDomains.yaml |
Core Trust Domain schemas | Low - Trust Domain specific |
Per the CAMARA Consumption and Bundling Design, bundled (standalone) API definitions are never committed on main. The committed network-access-management.yaml retains its $ref references to common/ and modules/. Bundled standalone OAS files are produced only on release branches/tags and for local validation.
This avoids merge conflicts in the large bundled output and keeps main as the single source of truth for modular schema authoring.
Bundled output files (*-bundled.yaml) are listed in .gitignore.
Install Redocly CLI:
npm install -g @redocly/cliValidate the spec and all referenced modules resolve correctly:
cd code/API_definitions
redocly lint network-access-management.yamlTo produce a fully resolved, standalone OAS file locally:
cd code/API_definitions
redocly bundle network-access-management.yaml --output network-access-management-bundled.yamlThe bundled file is useful for:
- Importing into API tools (Swagger UI, Postman, etc.)
- Validating the fully resolved spec with external validators
- Generating SDKs or documentation locally
Do not commit *-bundled.yaml files to main. They are git-ignored.
The redocly.yaml file contains:
- Linting rules - Ensures consistency and quality
- File resolution - Allows
.yamland.ymlextensions
Key bundling features:
- Resolves all
$refreferences to external files - Validates schema compatibility
- Generates self-contained OpenAPI specifications
- Preserves examples and documentation
network-access-management.yaml- Source API specification with$refreferences tocommon/andmodules/. This is the file committed onmain. Bundling resolves these refs into a standalone OAS file for release branches and local tooling.
common/CAMARA_common.yaml- Shared CAMARA-style error responses and common schemasmodules/NAM_Common.yaml- Shared fundamental types (UUID, DateTime, ResourceAudit, securitySchemes)modules/Policy.yaml- Trust Domain policy schemas (maxDevices, bandwidth limits, egress rules)modules/AccessDetail.yaml- Network access configuration schemas (Wi-Fi, Thread, security modes)modules/Capabilities.yaml- Device capability schemasmodules/TrustDomains/TrustDomains.yaml- Core Trust Domain schemas and examplesmodules/NetworkAccessDevices/NetworkAccessDevices.yaml- Network Access Device resource schemasmodules/RebootRequests/RebootRequests.yaml- Reboot Request lifecycle schemasmodules/Services/Services.yaml- Service schemasmodules/Services/ServiceSites.yaml- Service Site schemas
- High reusability - Schemas used by multiple APIs
- Logical grouping - Related schemas that form a cohesive unit
- Size management - When a file exceeds ~500 lines
- Use
$reffor external schema references - Keep examples close to their schemas
- Use YAML anchors for internal reuse within files
- Document inheritance and discriminator patterns clearly
Important: While schemas can be easily shared across files using $ref, examples have significant limitations in the distributed component model:
# ❌ This does NOT work - cannot use $ref inside example values
TrustDomainExample:
summary: Trust Domain with Wi-Fi access
value:
name: "My Network"
accessDetails:
- $ref: "modules/AccessDetail.yaml#/components/examples/WiFiExample/value" # Invalid!Option 1: Local Example Duplication (Recommended)
# ✅ Define examples locally where they're used
TrustDomainExample:
summary: Trust Domain with Wi-Fi access
value:
name: "My Network"
accessDetails:
- accessType: "Wi-Fi"
ssid: "my-network"
securityMode:
password: "my-password"
securityModeType: "WPA2-Personal"Option 2: YAML Anchors (Within Same File Only)
# ✅ Use anchors for reuse within the same file
_wifi_example: &wifi-access
accessType: "Wi-Fi"
ssid: "my-network"
securityMode:
password: "my-password"
securityModeType: "WPA2-Personal"
components:
examples:
TrustDomainExample:
value:
accessDetails:
- *wifi-access # Reuse within same fileOption 3: Component-Level Example References
# ✅ Reference complete examples at component level (not within values)
WiFiAccessExample:
$ref: "modules/AccessDetail.yaml#/components/examples/WiFiAccessDetailWPA2Personal"
# But you still can't compose these inside other example values