Status: the pilot described here has shipped as
opc-api-nnrf(generatedNfProfile/NfServicetypes from pinned TS 29.510 YAML, with a deterministicmake generate-apitarget). The v0.4 expansion added the NFManagement subscription and notification payloads (SubscriptionData,NotificationData,NotifCondition, and theNotificationEventType/ConditionEventTypeenums). This note now describes the generated-type boundary for NRF and the criteria for adding additional TS 29.5xx generated crates when a consuming CNF needs them.
Eliminate per-NF hand-writing of 3GPP SBI type definitions (TS 29.5xx series) by generating Rust crates from the official 3GPP OpenAPI YAML specifications.
The SDK currently hand-rolls SBI primitives in opc-sbi:
NfProfile,NfStatus,ProblemDetails, retry policies, server builder- These are minimal, tightly-scoped types sufficient for NRF discovery and heartbeat flows.
As new NFs are onboarded (SMF, UPF, AMF, AUSF, PCF, etc.), each requires TS 29.5xx types: hundreds of request/response structs, query parameters, and path patterns per NF. Hand-writing these is unsustainable and error-prone on every 3GPP release update.
3GPP publishes OpenAPI YAML files for each service-based interface:
TS29510_Nnrf_NFDiscovery.yamlTS29502_Nsmf_PDUSession.yamlTS29518_Namf_Communication.yaml- … (full set at
https://forge.3gpp.org/)
The SDK would vendor a pinned release (e.g., R18) and regenerate on major release bumps.
| Tool | License | MSRV | 3GPP-tested | Notes |
|---|---|---|---|---|
openapi-generator (Rust client) |
Apache-2.0 | ~1.70 | No | Heavy dependency tree; output style inconsistent with SDK patterns |
progenitor (Oxide) |
MIT | 1.70 | No | High-quality Rust codegen, but geared toward Oxide-style clients |
typify + openapiv3 |
MIT/Apache-2.0 | 1.70 | No | typify converts JSON Schema → Rust structs; could be adapted for OpenAPI |
| Hand-maintained templates | N/A | N/A | N/A | Rejected — same maintenance burden as hand-writing |
Recommendation: Evaluate typify (for schema-to-struct) combined with a
thin custom OpenAPI path/operation extractor. typify produces clean,
derive-friendly structs that fit the SDK's serde patterns. The custom
layer would handle 3GPP-specific naming conventions and filter out
non-Rust-friendly constructs (e.g., polymorphic oneOf patterns that
require manual enum design).
crates/
opc-api-nnrf/ # TS 29.510 — NFDiscovery, NFManagement
opc-api-nsmf/ # TS 29.502 — PDU Session
opc-api-namf/ # TS 29.518 — Communication, EventExposure
opc-api-npcf/ # TS 29.512 — Policy Authorization
...
Each crate:
types/—typify-generated structs with#[derive(Serialize, Deserialize)]client/— thinreqwest/hyperclient wrapper (optional, behind feature)server/—axum/hyperroute trait stubs (optional, behind feature)CONFORMANCE.md— which operations are generated, hand-written, or outside the generated-type crate boundary
- MSRV risk —
typifyandopenapiv3may require newer Rust features. - 3GPP YAML quality — the published OpenAPI files contain vendor-specific extensions and occasional schema inconsistencies that need a sanitization pipeline.
- SDK pattern alignment — the generated types must integrate with
opc-typesidentifiers (NfInstanceId,PlmnId, etc.) rather than generating redundant string wrappers. - Ownership — runtime client/server behavior remains in
opc-sbiand consuming NF crates; generated API crates own pinned OpenAPI payload types.
-
cargo check -p opc-api-nnrfpasses with generated types forNfProfileandNfServicematching the hand-writtenopc-sbiequivalents. - A
make generate-apitarget exists that downloads pinned 3GPP YAML, runs the generator, and produces deterministic output. - Generated crates carry
status: experimentaland aCONFORMANCE.mddocumenting which TS sections are covered.
- Generator extended to cover
SubscriptionData,NotificationData,NotifCondition,NotificationEventType, andConditionEventType. - Compatibility test shows an
opc-sbi::nf::NfProfileround-tripping through the generatedNfProfileat the serde value level.
- Gap register:
docs/implementation-status.md—GAP-PROTO-004 - Related:
opc-sbihand-written primitives (current baseline)