Skip to content

Commit 21605d9

Browse files
committed
Format
1 parent 1d27797 commit 21605d9

13 files changed

Lines changed: 207 additions & 125 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11+
1112
- **Service/RPC Support** - Complete implementation of Protocol Buffer services
1213
- Added `Service` and `Method` types to parser
1314
- Full parsing support for service definitions with RPC methods
@@ -30,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3031
- Seamless integration with import system and code generation
3132

3233
### Changed
34+
3335
- **Parser Documentation** - Updated to reflect new capabilities
3436
- Added service definitions to supported proto3 features
3537
- Updated capability descriptions to include field options and streaming
@@ -43,12 +45,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4345
- Service stubs include TODO placeholders for implementation
4446

4547
### Fixed
48+
4649
- **Service Block Parsing** - Proper handling of service definitions
4750
- Service blocks are now correctly skipped in message/enum parsing
4851
- Fixed method signature parsing to handle multiple space-separated parts
4952
- Improved error handling for malformed service definitions
5053

5154
### Technical Details
55+
5256
- **Test Coverage**: 139 tests (increased from 137) with comprehensive service testing
5357
- **Streaming Support**: All 4 streaming modes fully supported
5458
- Unary: `rpc Method(Request) returns (Response)`
@@ -60,6 +64,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6064
## [1.0.0] - Initial Release
6165

6266
### Added
67+
6368
- **Core Protocol Buffer Support**
6469
- Complete proto3 syntax parsing
6570
- Message and enum definitions
@@ -97,6 +102,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
97102
- Efficient bit array operations
98103

99104
### Technical Specifications
105+
100106
- **Language**: Gleam with Erlang runtime
101107
- **Proto Version**: proto3 only
102108
- **Test Coverage**: 137 comprehensive tests
@@ -108,15 +114,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
108114
## Future Roadmap
109115

110116
### High Priority
117+
111118
- **Proto2 Support** - Required/optional semantics, default values, extensions
112119
- **JSON Support** - JSON encoding/decoding per proto3 JSON mapping
113120
- **Unknown Field Handling** - Preserve unknown fields during decode/encode
114121

115122
### Medium Priority
123+
116124
- **File Options** - Support for `java_package`, `optimize_for`, `go_package`
117125
- **Recursive Messages** - Enhanced self-referential message support
118126
- **Advanced Parsing** - Comment preservation, source locations, better errors
119127

120128
### Low Priority
129+
121130
- **Performance Optimizations** - Lazy decoding, streaming for large messages
122-
- **Extended Validation** - Enhanced semantic validation and error reporting
131+
- **Extended Validation** - Enhanced semantic validation and error reporting
132+

src/protozoa/internal/codegen/decoders.gleam

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,6 @@ fn get_field_decoder_for_type(field_type: parser.ProtoType) -> String {
256256
}
257257
}
258258

259-
260-
261259
fn generate_decoder_function_body(message: Message) -> String {
262260
let field_decoders =
263261
message.fields
@@ -490,4 +488,3 @@ fn collect_nested_messages_flattened(
490488
[flattened_msg, ..list.append(deeper_nested, acc)]
491489
})
492490
}
493-

src/protozoa/internal/codegen/encoders.gleam

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,12 +653,10 @@ fn is_nested_enum_in_message(enum_name: String, parent_message: Message) -> Bool
653653
|> list.any(fn(nested_enum) { nested_enum.name == enum_name })
654654
}
655655

656-
657656
fn get_type_name(proto_type: ProtoType) -> String {
658657
case proto_type {
659658
parser.MessageType(name) -> name
660659
parser.EnumType(name) -> name
661660
_ -> "UnknownType"
662661
}
663662
}
664-

src/protozoa/internal/codegen/types.gleam

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,9 @@ fn resolve_external_type_simple(
348348
file_path: String,
349349
) -> String {
350350
// Get current file's package for type resolution
351-
let current_package = case type_registry.get_file_package(registry, file_path) {
351+
let current_package = case
352+
type_registry.get_file_package(registry, file_path)
353+
{
352354
option.Some(pkg) -> pkg
353355
option.None -> ""
354356
}
@@ -363,8 +365,10 @@ fn resolve_external_type_simple(
363365
True -> flatten_type_name(resolved_fqn)
364366
False -> {
365367
case source_file == file_path {
366-
True -> flatten_type_name(name) // Same file
367-
False -> qualify_cross_file_type(name, source_file) // Different file
368+
True -> flatten_type_name(name)
369+
// Same file
370+
False -> qualify_cross_file_type(name, source_file)
371+
// Different file
368372
}
369373
}
370374
}
@@ -404,7 +408,7 @@ fn qualify_cross_file_type(type_name: String, source_file: String) -> String {
404408
}
405409
}
406410
}
407-
411+
408412
module_name <> "." <> flatten_type_name(type_name)
409413
}
410414

src/protozoa/internal/type_registry.gleam

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,27 @@ pub fn describe_error(error: Error) -> String {
3434

3535
/// Create a new TypeRegistry with well-known types pre-loaded.
3636
pub fn new() -> TypeRegistry {
37-
let registry = TypeRegistry(
38-
messages: dict.new(),
39-
enums: dict.new(),
40-
type_sources: dict.new(),
41-
file_packages: dict.new(),
42-
)
43-
37+
let registry =
38+
TypeRegistry(
39+
messages: dict.new(),
40+
enums: dict.new(),
41+
type_sources: dict.new(),
42+
file_packages: dict.new(),
43+
)
44+
4445
// Pre-populate with well-known types
4546
load_well_known_types(registry)
4647
}
4748

4849
/// Load well-known types into the registry
4950
fn load_well_known_types(registry: TypeRegistry) -> TypeRegistry {
5051
let well_known_files = well_known_types.get_well_known_proto_files()
51-
52+
5253
dict.fold(well_known_files, registry, fn(acc, file_path, proto_file) {
5354
case add_file(acc, file_path, proto_file) {
5455
Ok(updated_registry) -> updated_registry
55-
Error(_) -> acc // Ignore errors when loading well-known types
56+
Error(_) -> acc
57+
// Ignore errors when loading well-known types
5658
}
5759
})
5860
}

0 commit comments

Comments
 (0)