darius024 opened a new pull request, #3528:
URL: https://github.com/apache/fory/pull/3528
## Why?
Issue #3277 requires unit tests for gRPC service support in the Fory
compiler: IR validation tests covering name, type, and streaming rules, and
golden codegen tests for service schemas. The parser tests for FDL/proto/fbs
service syntax already existed from closed sub-issues. This PR fills the
remaining gaps.
## What does this PR do?
**`compiler/fory_compiler/ir/validator.py`**
- Added `_check_services()` implementing three validation rules:
1. Duplicate service names → error
2. Duplicate method names within the same service → error
3. RPC request/response types must be `message` — `enum` and `union` are
rejected
- Wired `_check_services()` into `validate()` after
`_check_type_references()`
**`compiler/fory_compiler/tests/test_ir_service_validation.py`** (new)
- Tests for all three validation rules above, across FDL, proto, and fbs
frontends
- Tests that streaming RPCs (client, server, bidi) pass validation without
error
**`compiler/fory_compiler/tests/test_service_codegen.py`** (new)
- Asserts service definitions do not alter message codegen output across all
7 language generators
- Documents that `generate_services()` returns `[]` as a baseline for all
generators
- Verifies `compile_file(..., grpc=True)` succeeds and produces output for
all languages using `examples/service.fdl`
- Asserts key signatures (`class HelloRequest`, `String name`, etc.) are
present in Java and Python generated output
## Related issues
- Closes #3277
- Related to #3266
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]