hemmer-provider-generator-parser
Multi-format parsers for cloud SDK specifications (Smithy, OpenAPI, Discovery, Protobuf).
Overview
This crate provides parsers for four different cloud SDK specification formats, converting them into a unified intermediate representation (ServiceDefinition). Each parser extracts resources, operations, and type information from the respective spec format.
Supported Formats
| Format | Cloud Provider(s) | Parser Module |
|---|---|---|
| Smithy | AWS | smithy |
| OpenAPI 3.0 | Kubernetes, Azure | openapi |
| Discovery | Google Cloud | discovery |
| Protobuf | gRPC Services | protobuf |
Usage
Parse a Smithy Spec (AWS)
use SmithyParser;
use fs;
let spec_content = read_to_string?;
let parser = new?;
let service_def = parser.parse?;
println!;
println!;
Parse an OpenAPI Spec (Kubernetes)
use OpenApiParser;
use fs;
let spec_content = read_to_string?;
let parser = new?;
let service_def = parser.parse?;
Parse a Discovery Spec (GCP)
use DiscoveryParser;
use fs;
let spec_content = read_to_string?;
let parser = new?;
let service_def = parser.parse?;
Parse a Protobuf FileDescriptorSet (gRPC)
use ProtobufParser;
use fs;
let spec_bytes = read?;
let parser = new?;
let service_def = parser.parse?;
Features
- Universal IR: All parsers output the same
ServiceDefinitiontype - Resource Discovery: Automatically identifies resources from operations/methods
- CRUD Mapping: Maps operations to Create, Read, Update, Delete
- Type Conversion: Converts spec-specific types to universal
FieldType - Error Handling: Comprehensive error types for parsing failures
Architecture
Spec File → Parser → ServiceDefinition (IR) → Generator
Each parser implements the same transformation:
- Parse spec format into native structures
- Identify resources and operations
- Map types to universal
FieldType - Build
ServiceDefinitionIR
Documentation
For detailed API documentation, see docs.rs/hemmer-provider-generator-parser.
License
Licensed under the Apache License, Version 2.0. See LICENSE for details.